@replit/clui-gql
Advanced tools
Comparing version 0.0.1 to 0.0.2
@@ -57,2 +57,5 @@ "use strict"; | ||
} | ||
else if (n.kind === 'ENUM' && n.name) { | ||
parts = __spread(start, [n.name], parts); | ||
} | ||
} | ||
@@ -59,0 +62,0 @@ return "$" + inputValue.name + ": " + parts.join(''); |
{ | ||
"name": "@replit/clui-gql", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "A utility to transform GraphQL introspection type into a CLUI command", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -30,3 +30,4 @@ export type Maybe<T> = T | null; | ||
tomorrow?: Maybe<Scalars['Boolean']>, | ||
today: Scalars['Boolean'] | ||
today: Scalars['Boolean'], | ||
status?: Maybe<Status> | ||
}; | ||
@@ -33,0 +34,0 @@ |
@@ -44,21 +44,20 @@ // @ts-nocheck | ||
describe('toOperation', () => { | ||
it('..', async () => { | ||
const data = await query<__Type>({ name: 'Cli' }); | ||
const field = data.__type.fields.find( | ||
(f: { name: string }) => f.name === 'weather', | ||
); | ||
test('toOperation', async () => { | ||
const data = await query<__Type>({ name: 'Cli' }); | ||
const field = data.__type.fields.find( | ||
(f: { name: string }) => f.name === 'weather', | ||
); | ||
const output = 'services { name }'; | ||
const res = toOperation({ | ||
path: ['cli', field.name], | ||
field, | ||
output: () => ({ fields: output }), | ||
}); | ||
const output = 'services { name }'; | ||
const res = toOperation({ | ||
path: ['cli', field.name], | ||
field, | ||
output: () => ({ fields: output }), | ||
}); | ||
/* eslint-disable max-len */ | ||
expect(res) | ||
.toEqual(`query Query($zipcode: String!, $view: String, $count: Int, $time: Float, $days: [String], $hours: [Int], $minutes: [Float!]!, $tomorrow: Boolean, $today: Boolean!) { | ||
/* eslint-disable max-len */ | ||
expect(res) | ||
.toEqual(`query Query($zipcode: String!, $view: String, $count: Int, $time: Float, $days: [String], $hours: [Int], $minutes: [Float!]!, $tomorrow: Boolean, $today: Boolean!, $status: STATUS) { | ||
cli { | ||
weather(zipcode: $zipcode, view: $view, count: $count, time: $time, days: $days, hours: $hours, minutes: $minutes, tomorrow: $tomorrow, today: $today) { | ||
weather(zipcode: $zipcode, view: $view, count: $count, time: $time, days: $days, hours: $hours, minutes: $minutes, tomorrow: $tomorrow, today: $today, status: $status) { | ||
${output} | ||
@@ -68,4 +67,3 @@ } | ||
}`); | ||
/* eslint-enable max-len */ | ||
}); | ||
/* eslint-enable max-len */ | ||
}); |
@@ -28,2 +28,5 @@ import { __InputValue, __Type, __Field } from './graphqlTypes'; | ||
parts = [...start, n.name, ...parts]; | ||
} else if (n.kind === 'ENUM' && n.name) { | ||
// TODO convert enum values to options | ||
parts = [...start, n.name, ...parts]; | ||
} | ||
@@ -30,0 +33,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
45000
1024