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

@replit/clui-gql

Package Overview
Dependencies
Maintainers
6
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@replit/clui-gql - npm Package Compare versions

Comparing version 0.0.3 to 0.0.4

1

dist/index.d.ts

@@ -36,3 +36,4 @@ import { __Type, __Field } from './graphqlTypes';

transformCommandName?: ((str: string) => string) | undefined;
transformArgName?: ((str: string) => string) | undefined;
skipArgs?: boolean | undefined;
}) => {};

11

dist/index.js

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

};
var toArgs = function (args) {
var toArgs = function (args, transformName) {
var ret = args.reduce(function (acc, inputValue) {

@@ -117,3 +117,6 @@ var arg = {

}
acc[inputValue.name] = arg;
var name = transformName
? transformName(inputValue.name)
: inputValue.name;
acc[name] = arg;
return acc;

@@ -134,3 +137,5 @@ }, {});

var command = {
args: options.skipArgs ? undefined : toArgs(field.args),
args: options.skipArgs
? undefined
: toArgs(field.args, options.transformArgName),
description: field.description || undefined,

@@ -137,0 +142,0 @@ run: runFn({

{
"name": "@replit/clui-gql",
"version": "0.0.3",
"version": "0.0.4",
"description": "A utility to transform GraphQL introspection type into a CLUI command",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

# CLUI GraphQL
A utility to transform GraphQL introspection type into a CLUI command
`@replit/clui-gql` is a small utility that transforms [GraphQL introspection](https://graphql.org/learn/introspection) data for a type into commands.
## Install

@@ -14,3 +15,2 @@

```js
import { toCommand } from '@replit/clui-gql';

@@ -17,0 +17,0 @@

@@ -57,2 +57,15 @@ // @ts-nocheck

it('transforms arg name', async () => {
const data = await query<__Type>({ name: 'Cli' });
const command = toCommand({
type: data.__type,
transformArgName: (str: string) => str.toUpperCase(),
mountPath: ['cli'],
// eslint-disable-next-line
runFn: () => () => {},
outputFn: () => 'name',
});
expect(command.commands.weather.args.ZIPCODE).toBeTruthy();
});
it('skips args', async () => {

@@ -59,0 +72,0 @@ const data = await query<__Type>({ name: 'Cli' });

@@ -90,3 +90,6 @@ import { __InputValue, __Type, __Field } from './graphqlTypes';

const toArgs = (args: Array<__InputValue>) => {
const toArgs = (
args: Array<__InputValue>,
transformName?: (name: string) => string,
) => {
const ret = args.reduce((acc: any, inputValue: __InputValue) => {

@@ -116,3 +119,6 @@ const arg: any = {

acc[inputValue.name] = arg;
const name = transformName
? transformName(inputValue.name)
: inputValue.name;
acc[name] = arg;

@@ -145,2 +151,3 @@ return acc;

transformCommandName?: (str: string) => string;
transformArgName?: (str: string) => string;
skipArgs?: boolean;

@@ -165,3 +172,5 @@ }) => {

const command = {
args: options.skipArgs ? undefined : toArgs(field.args),
args: options.skipArgs
? undefined
: toArgs(field.args, options.transformArgName),
description: field.description || undefined,

@@ -168,0 +177,0 @@ run: runFn({

@@ -11,3 +11,3 @@ {

"strict": true,
"lib": ["dom", "es2017", "esnext.asynciterable"],
"lib": ["es2017", "esnext.asynciterable"],
"noUnusedLocals": true,

@@ -21,3 +21,6 @@ "noUnusedParameters": true,

"forceConsistentCasingInFileNames": true,
"typeRoots": ["./node_modules/@types", "./typings"],
"typeRoots": [
"../../node_modules/@types",
"./node_modules/@types",
"./typings"],
"baseUrl": ".",

@@ -24,0 +27,0 @@ "paths": {

{
"moduleResolution": "node",
"name":"GraphQl CLUI",
"name":"CLUI GraphQl ",
"includeDeclarations": true,
"excludeExternals": true,
"exclude": ["src/__tests__/**/*"],
"out": "docs"
"out": "typedeoc"
}

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