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

ar-gql

Package Overview
Dependencies
Maintainers
2
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ar-gql - npm Package Compare versions

Comparing version 1.2.2 to 1.2.3

3

dist/index.d.ts
import GQLResultInterface, { GQLEdgeInterface, GQLNodeInterface } from "./faces";
export type PageCallback = (pageEdges: GQLEdgeInterface[]) => Promise<void>;
export interface ArGqlInterface {
run: (query: string, variables?: Record<string, unknown>) => Promise<GQLResultInterface>;
all: (query: string, variables?: Record<string, unknown>) => Promise<GQLEdgeInterface[]>;
all: (query: string, variables?: Record<string, unknown>, pageCallback?: PageCallback) => Promise<GQLEdgeInterface[]>;
tx: (id: string) => Promise<GQLNodeInterface>;

@@ -6,0 +7,0 @@ fetchTxTag: (id: string, name: string) => Promise<string | undefined>;

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

}); };
var all = function (query, variables) { return __awaiter(_this, void 0, void 0, function () {
var hasNextPage, edges, cursor, res;
var all = function (query, variables, pageCallback) { return __awaiter(_this, void 0, void 0, function () {
var hasNextPage, edges, cursor, pageCallbacks, res;
return __generator(this, function (_a) {

@@ -95,2 +95,3 @@ switch (_a.label) {

cursor = "";
pageCallbacks = [];
_a.label = 1;

@@ -103,3 +104,8 @@ case 1:

if (res.edges && res.edges.length) {
edges = edges.concat(res.edges);
if (typeof pageCallback === 'function') {
pageCallbacks.push(pageCallback(res.edges));
}
else {
edges = edges.concat(res.edges);
}
cursor = res.edges[res.edges.length - 1].cursor;

@@ -109,3 +115,6 @@ }

return [3 /*break*/, 1];
case 3: return [2 /*return*/, edges];
case 3: return [4 /*yield*/, Promise.all(pageCallbacks)];
case 4:
_a.sent();
return [2 /*return*/, edges];
}

@@ -115,15 +124,8 @@ });

var tx = function (id) { return __awaiter(_this, void 0, void 0, function () {
var isBrowser, res;
var res;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
isBrowser = typeof window !== "undefined";
return [4 /*yield*/, run(tx_1["default"], { id: id })];
case 0: return [4 /*yield*/, run(tx_1["default"], { id: id })];
case 1:
res = _a.sent();
// if (isBrowser && res.data.transaction.block) {
// const cache = JSON.parse(localStorage.getItem("gqlCache") || "{}");
// cache[id] = res.data.transaction;
// localStorage.setItem("gqlCache", JSON.stringify(cache));
// }
return [2 /*return*/, res.data.transaction];

@@ -130,0 +132,0 @@ }

{
"name": "ar-gql",
"version": "1.2.2",
"version": "1.2.3",
"main": "dist/index",

@@ -5,0 +5,0 @@ "types": "dist/index",

@@ -55,3 +55,3 @@ # `ar-gql` version 1

### `all(query, variables?)`
### `all(query, variables?, pageCallback?)`

@@ -87,2 +87,5 @@ Similar to the `run` function, the `all` function receives a query and optional variables.

The optional `pageCallback` feature is the convenience functon to process pages as they are returned. The page results are processed asynchronously, and the function `all` returns after all callback functions have completed internally.
> N.B When a callback function is passed to `all`, `all` returns an empty edges array once all page callbacks are complete `[]`.
### `tx(id)`

@@ -89,0 +92,0 @@

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