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

@web3api/core-js

Package Overview
Dependencies
Maintainers
2
Versions
83
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@web3api/core-js - npm Package Compare versions

Comparing version 0.0.1-prealpha.6 to 0.0.1-prealpha.7

2

build/algorithms/get-implementations.d.ts
import { Uri, UriRedirect } from "../types";
export declare function getImplementations(abstractApi: Uri, redirects: readonly UriRedirect[]): Uri[];
export declare function getImplementations(abstractApi: Uri, redirects: readonly UriRedirect<Uri>[]): Uri[];

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

import { InvokeApiOptions, QueryDocument, Uri } from "../types";
export declare function parseQuery(uri: Uri, doc: QueryDocument, variables?: Record<string, unknown>): InvokeApiOptions[];
import { QueryApiInvocations, QueryDocument, Uri } from "../types";
export declare function parseQuery(uri: Uri, doc: QueryDocument, variables?: Record<string, unknown>): QueryApiInvocations;

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

}
var invokeOptions = [];
var queryInvocations = {};
for (var _i = 0, _a = doc.definitions; _i < _a.length; _i++) {

@@ -34,2 +34,6 @@ var def = _a[_i];

var method = selection.name.value;
var invocationName = selection.alias ? selection.alias.value : method;
if (queryInvocations[invocationName]) {
throw Error("Duplicate query name found \"" + invocationName + "\". Please use GraphQL aliases that each have unique names.");
}
// Get all input arguments

@@ -55,3 +59,3 @@ var selectionArgs = selection.arguments;

}
invokeOptions.push({
queryInvocations[invocationName] = {
uri: uri,

@@ -62,6 +66,6 @@ module: module_1,

resultFilter: resultFilter,
});
};
}
}
return invokeOptions;
return queryInvocations;
}

@@ -68,0 +72,0 @@ exports.parseQuery = parseQuery;

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

return client.invoke({
uri: api,
uri: api.uri,
module: "query",

@@ -20,3 +20,3 @@ method: "tryResolveUri",

return client.invoke({
uri: api,
uri: api.uri,
module: "query",

@@ -23,0 +23,0 @@ method: "getFile",

@@ -1,4 +0,4 @@

import { UriRedirect, QueryHandler, InvokeHandler } from "./";
import { Uri, UriRedirect, QueryHandler, InvokeHandler } from "./";
export interface Client extends QueryHandler, InvokeHandler {
redirects: () => readonly UriRedirect[];
redirects: () => readonly UriRedirect<Uri>[];
}
import { Uri } from ".";
export declare type InvokableModules = "query" | "mutation";
/** Options required for an API invocation. */
export interface InvokeApiOptions {
export interface InvokeApiOptions<TUri = Uri> {
/** The API's URI */
uri: Uri;
uri: TUri;
/** Module to be called into. */

@@ -46,3 +46,3 @@ module: InvokableModules;

export interface InvokeHandler {
invoke<TData = unknown>(options: InvokeApiOptions): Promise<InvokeApiResult<TData>>;
invoke<TData = unknown>(options: InvokeApiOptions<string>): Promise<InvokeApiResult<TData>>;
}

@@ -43,7 +43,7 @@ import { Uri, Client, InvokableModules, MaybeAsync } from ".";

}
export declare type PluginFactory = () => Plugin;
export interface PluginPackage {
factory: PluginFactory;
export declare type PluginPackage = {
factory: () => Plugin;
manifest: PluginManifest;
}
};
export declare type PluginFactory<TOpts> = (opts: TOpts) => PluginPackage;
export {};

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

import { Uri } from "./";
import { Uri, InvokeApiOptions } from "./";
import { DocumentNode } from "graphql";

@@ -12,5 +12,5 @@ /** GraphQL SchemaDocument */

/** Options required for an API query. */
export interface QueryApiOptions<TVariables extends Record<string, unknown> = Record<string, unknown>> {
export interface QueryApiOptions<TVariables extends Record<string, unknown> = Record<string, unknown>, TUri = Uri> {
/** The API's URI */
uri: Uri;
uri: TUri;
/**

@@ -47,5 +47,8 @@ * The GraphQL query to parse and execute, leading to one or more

}
export interface QueryApiInvocations {
[methodOrAlias: string]: InvokeApiOptions;
}
/** A type that can parse & execute a given query */
export interface QueryHandler {
query<TData extends Record<string, unknown> = Record<string, unknown>, TVariables extends Record<string, unknown> = Record<string, unknown>>(options: QueryApiOptions<TVariables>): Promise<QueryApiResult<TData>>;
query<TData extends Record<string, unknown> = Record<string, unknown>, TVariables extends Record<string, unknown> = Record<string, unknown>>(options: QueryApiOptions<TVariables, string>): Promise<QueryApiResult<TData>>;
}

@@ -1,10 +0,8 @@

import { Uri, PluginPackage } from ".";
/**
* Redirect from one URI, or a set of URIs, to a new URI or a plugin.
*/
export interface UriRedirect {
import { PluginPackage, Uri } from ".";
export interface UriRedirect<TUri = string> {
/** Redirect from this URI */
from: Uri;
from: TUri;
/** The destination URI, or plugin, that will now handle the invocation. */
to: Uri | PluginPackage;
to: TUri | PluginPackage;
}
export declare function sanitizeUriRedirects(input: UriRedirect[]): UriRedirect<Uri>[];
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.sanitizeUriRedirects = void 0;
var _1 = require(".");
function sanitizeUriRedirects(input) {
var output = [];
for (var _i = 0, input_1 = input; _i < input_1.length; _i++) {
var definition = input_1[_i];
var from = new _1.Uri(definition.from);
var to = typeof definition.to === "string"
? new _1.Uri(definition.to)
: definition.to;
output.push({
from: from,
to: to,
});
}
return output;
}
exports.sanitizeUriRedirects = sanitizeUriRedirects;
//# sourceMappingURL=UriRedirect.js.map
{
"name": "@web3api/core-js",
"description": "Web3API Javascript Core",
"version": "0.0.1-prealpha.6",
"version": "0.0.1-prealpha.7",
"license": "MIT",

@@ -23,3 +23,3 @@ "repository": {

"dependencies": {
"@web3api/manifest-schema": "0.0.1-prealpha.6",
"@web3api/manifest-schema": "0.0.1-prealpha.7",
"graphql": "15.3.0",

@@ -40,3 +40,3 @@ "graphql-tag": "2.10.4",

},
"gitHead": "4eccf972b3cf44dea493c07e803d40cde81970ff",
"gitHead": "4e285019a0b3b0f371aab362afa6977acfb15c49",
"publishConfig": {

@@ -43,0 +43,0 @@ "access": "public"

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