You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

@droz-js/sdk

Package Overview
Dependencies
Maintainers
1
Versions
216
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@droz-js/sdk - npm Package Compare versions

Comparing version

to
0.2.8

2

package.json
{
"name": "@droz-js/sdk",
"description": "Droz SDK",
"version": "0.2.7",
"version": "0.2.8",
"private": false,

@@ -6,0 +6,0 @@ "exports": {

@@ -9,2 +9,12 @@ import type { ExecutionResult } from 'graphql';

export declare function mapGraphqlResponse<T>(response: ExecutionResult<T> | Error): T;
export declare function mapAsyncIterableGraphqlResponse<T>(iterable: AsyncIterableIterator<ExecutionResult<T, any>>): AsyncGenerator<Awaited<T>, void, unknown>;
declare class AsyncIterableIteratorMapper<T = any> implements AsyncIterableIterator<T> {
private from;
private mapper;
constructor(from: AsyncIterableIterator<ExecutionResult<T, any>>, mapper: (response: ExecutionResult<T, any>) => T);
next(...args: [] | [undefined]): Promise<IteratorResult<T, any>>;
return(value?: any): Promise<IteratorResult<T, any>>;
throw(e?: any): Promise<IteratorResult<T, any>>;
[Symbol.asyncIterator](): AsyncIterableIterator<T>;
}
export declare function mapAsyncIterableGraphqlResponse<T>(iterable: AsyncIterableIterator<ExecutionResult<T, any>>): AsyncIterableIteratorMapper<T>;
export {};

@@ -44,7 +44,37 @@ "use strict";

exports.mapGraphqlResponse = mapGraphqlResponse;
async function* mapAsyncIterableGraphqlResponse(iterable) {
for await (const each of iterable) {
yield mapGraphqlResponse(each);
class AsyncIterableIteratorMapper {
from;
mapper;
constructor(from, mapper) {
this.from = from;
this.mapper = mapper;
}
async next(...args) {
const next = await this.from.next(...args);
return {
done: next.done,
value: this.mapper(next.value)
};
}
async return(value) {
const ret = await this.from.return(value);
return {
done: ret.done,
value: this.mapper(ret.value)
};
}
async throw(e) {
const thr = await this.from.throw(e);
return {
done: thr.done,
value: this.mapper(thr.value)
};
}
[Symbol.asyncIterator]() {
return this;
}
}
function mapAsyncIterableGraphqlResponse(iterable) {
return new AsyncIterableIteratorMapper(iterable, mapGraphqlResponse);
}
exports.mapAsyncIterableGraphqlResponse = mapAsyncIterableGraphqlResponse;