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

@freshsqueezed/mammothgql

Package Overview
Dependencies
Maintainers
0
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@freshsqueezed/mammothgql - npm Package Compare versions

Comparing version 1.0.20 to 1.0.21

2

__tests__/mammothgql.spec.ts

@@ -57,4 +57,4 @@ import request from 'supertest';

expect(response.text).toContain('<title>GraphiQL</title>');
expect(response.text).toContain('<title>Mammoth GraphiQL</title>');
});
});

@@ -0,1 +1,9 @@

## [1.0.21](https://github.com/freshsqueezed/mammothgql/compare/v1.0.20...v1.0.21) (2025-01-07)
### Bug Fixes
* **graphiql:** references must deploy ([a794920](https://github.com/freshsqueezed/mammothgql/commit/a7949209f1e335f3b56923a8591c0b2e2a3a116a))
* **ws-pipeline:** update withFilter, update graphiql ([52bf362](https://github.com/freshsqueezed/mammothgql/commit/52bf362e79cf35b989eccd0125fd2e0615656639))
## [1.0.20](https://github.com/freshsqueezed/mammothgql/compare/v1.0.19...v1.0.20) (2025-01-07)

@@ -2,0 +10,0 @@

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

<head>
<title>GraphiQL</title>
<title>Mammoth GraphiQL</title>
<style>

@@ -118,0 +118,0 @@ body {

@@ -7,35 +7,18 @@ "use strict";

const asyncIterator = await asyncIteratorFn(rootValue, args, context, info);
const getNextPromise = () => {
return new Promise((resolve, reject) => {
const inner = () => {
asyncIterator
.next()
.then((payload) => {
if (payload.done === true) {
resolve(payload);
return;
}
Promise.resolve(filterFn(payload.value, args, context, info))
.catch(() => false) // We ignore errors from filter function
.then((filterResult) => {
if (filterResult === true) {
resolve(payload);
return;
}
// Skip the current value and wait for the next one
inner();
});
})
.catch((err) => {
reject(err);
});
};
inner();
});
const next = async () => {
const payload = await asyncIterator.next();
if (payload.done)
return payload;
const filterResult = await filterFn(payload.value, args, context, info);
if (filterResult) {
return payload;
}
// Recursively skip and try again with the next item
return next();
};
const asyncIterator2 = {
next() {
return getNextPromise();
},
// Return the AsyncIterableIterator directly, wrapping in Promise.resolve() when done
const iterable = {
next,
return() {
// Ensure return is always a Promise of IteratorResult
return asyncIterator.return

@@ -54,5 +37,5 @@ ? asyncIterator.return()

};
return asyncIterator2;
return iterable;
};
}
//# sourceMappingURL=with-filter.js.map

@@ -6,3 +6,3 @@ {

"types": "lib/index.d.ts",
"version": "1.0.20",
"version": "1.0.21",
"author": "Matt Gordon <matt@lemonade.tech>",

@@ -9,0 +9,0 @@ "license": "MIT",

@@ -182,3 +182,3 @@ import { Request, Response } from 'express';

<head>
<title>GraphiQL</title>
<title>Mammoth GraphiQL</title>
<style>

@@ -185,0 +185,0 @@ body {

@@ -22,6 +22,2 @@ export type FilterFn<TSource = any, TArgs = any, TContext = any> = (

interface IterallAsyncIterator<T> extends AsyncIterableIterator<T> {
[Symbol.asyncIterator](): IterallAsyncIterator<T>;
}
export type WithFilter<TSource = any, TArgs = any, TContext = any> = (

@@ -37,44 +33,27 @@ asyncIteratorFn: ResolverFn<TSource, TArgs, TContext>,

return async (
rootValue: TSource,
args: TArgs,
context: TContext,
info: any,
): Promise<IterallAsyncIterator<any>> => {
rootValue,
args,
context,
info,
): Promise<AsyncIterableIterator<any>> => {
const asyncIterator = await asyncIteratorFn(rootValue, args, context, info);
const getNextPromise = () => {
return new Promise<IteratorResult<any>>((resolve, reject) => {
const inner = () => {
asyncIterator
.next()
.then((payload) => {
if (payload.done === true) {
resolve(payload);
return;
}
Promise.resolve(filterFn(payload.value, args, context, info))
.catch(() => false) // We ignore errors from filter function
.then((filterResult) => {
if (filterResult === true) {
resolve(payload);
return;
}
// Skip the current value and wait for the next one
inner();
});
})
.catch((err) => {
reject(err);
});
};
const next = async (): Promise<IteratorResult<any>> => {
const payload = await asyncIterator.next();
if (payload.done) return payload;
inner();
});
const filterResult = await filterFn(payload.value, args, context, info);
if (filterResult) {
return payload;
}
// Recursively skip and try again with the next item
return next();
};
const asyncIterator2: IterallAsyncIterator<any> = {
next() {
return getNextPromise();
},
// Return the AsyncIterableIterator directly, wrapping in Promise.resolve() when done
const iterable: AsyncIterableIterator<any> = {
next,
return() {
// Ensure return is always a Promise of IteratorResult
return asyncIterator.return

@@ -94,4 +73,4 @@ ? asyncIterator.return()

return asyncIterator2;
return iterable;
};
}

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