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

magiql

Package Overview
Dependencies
Maintainers
1
Versions
74
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

magiql - npm Package Compare versions

Comparing version 0.0.2-beta.24 to 0.0.2

3

dist/cjs/development/babel.js

@@ -19,4 +19,3 @@ 'use strict';

function getCalleeArgs(calleePath) {
const parent = calleePath.findParent(p => p.isCallExpression()); // console.log(parent);
const parent = calleePath.findParent(p => p.isCallExpression());
const arg = calleePath.container.arguments;

@@ -23,0 +22,0 @@ return arg;

@@ -33,3 +33,2 @@ 'use strict';

mergeAllFields(allFields, hasInterfaces) {
console.log(allFields);
return [...allFields, " fragment: (fragment?: MagiQLFragment) => Maybe<" + this.currentNode + ">;"].join("\n");

@@ -36,0 +35,0 @@ }

@@ -10,6 +10,6 @@ 'use strict';

function useMagiqlQuery(name, options) {
throw new Error("Unimplemented: I think your babel config is not working. \n Make sure magiql/babel is added as a plugin.");
throw new Error("Unimplemented: Make sure magiql/babel is added as a plugin.");
}
function useFragment(name) {
throw new Error("Unimplemented: I think your babel config is not working. \n Make sure magiql/babel is added as a plugin.");
throw new Error("Unimplemented: Make sure magiql/babel is added as a plugin.");
}

@@ -16,0 +16,0 @@ function withFragment(Component) {

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

"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var n=require("@graphql-codegen/typescript"),t=require("graphql"),i=require("@graphql-codegen/visitor-plugin-common"),r=e(require("auto-bind")),o=require("pascal-case"),s=e(require("graphql-tag")),a=require("graphql/language/printer");class p extends n.TsVisitor{constructor(e,n){super(e,n),this.currentNode=void 0,this._argumentsTransformer._avoidOptionals=!1}mergeAllFields(e,n){return console.log(e),[...e," fragment: (fragment?: MagiQLFragment) => Maybe<"+this.currentNode+">;"].join("\n")}convertName(e){return this.currentNode=super.convertName(e),this.currentNode}FieldDefinition(e,n,r){var o=this.config.wrapFieldDefinitions?"FieldWrapper<"+e.type+">":e.type,s=r[n];s.arguments.length>0&&(o="(args: { "+s.arguments.map(e=>this._argumentsTransformer.transformVariable(e)).join(", ")+" }) => "+o);var a=!this.config.avoidOptionals.object&&s.type.kind!==t.Kind.NON_NULL_TYPE,p=this.getFieldComment(e),{type:m}=this.config.declarationKind;return p+i.indent((this.config.immutableTypes?"readonly ":"")+e.name+(a?"?":"")+": "+o+this.getPunctuation(m))}}var m='\nimport { UseQueryResult, UseQueryOptions } from "./client/hooks";\n\nexport type Type<K extends keyof Types = "Query"> = Types[K];\n\nexport type MagiQLFragment = (name?: string) => string;\n\nexport function useMagiqlQuery<TVariables = {}>(\n name: string,\n options?: UseQueryOptions<Query, TVariables>\n): Omit<UseQueryResult<Query>, "data"> & {\n query: Query;\n variables: TVariables;\n};\n\nexport function useFragment<K extends keyof Types>(name: K): Type<K>;\n\nexport type FragmentProps<F = {}> = {\n [K in keyof F]?: Maybe<F[K]>;\n};\n\nexport type ComponentTypeWithFragment<\n F = {},\n P = {}\n> = React.ComponentType<FragmentProps<F> & P>;\n\nexport type ComponentWithFragment<\n F extends FragmentDictionary,\n P = {}\n> = ComponentTypeWithFragment<F, P> & { [K in keyof F]?: MagiQLFragment };\n\nexport function withFragment<F = {}, P = any>(\n Component: ComponentTypeWithFragment<F, P>\n): ComponentWithFragment<F, P>;\n\n';class u extends i.ClientSideBaseVisitor{constructor(e,n,t,o){super(e,n,t,{importHooksFrom:i.getConfigValue(t.importHooksFrom,"./client"),addDocBlocks:i.getConfigValue(t.addDocBlocks,!0),codegen:i.getConfigValue(t.codegen,!1),mode:i.getConfigValue(t.mode,"hooks-types")}),this._externalImportPrefix=void 0,this.imports=new Set,this._externalImportPrefix=this.config.importOperationTypesFrom?this.config.importOperationTypesFrom+".":"",this._documents=o,r(this)}printFragments(e){if(!e)return[];var n=[];t.visit(e,{enter:{FragmentSpread:e=>{n.push(e.name.value)}}});var i=n.map(e=>this.getFragmentName(e));return i&&i.length>0?""+i.filter((e,n,t)=>t.indexOf(e)===n).map(e=>{var n=this._fragments.find(n=>n.name+"Fragment"===e);return n?a.print(n.node):null}).filter(e=>e).join("\n"):""}printDocument(e){var n="\n"+a.print(e).split("\\").join("\\\\")+"\n"+this.printFragments(e),t=s(n);return a.print(t)}OperationDefinition(e){if(!e.name||!e.name.value)return null;this._collectedOperations.push(e);var n=o.pascalCase(e.operation),t=this.config.dedupeOperationSuffix&&e.name.value.toLowerCase().endsWith(e.operation)?"":n,i=this._externalImportPrefix+this.convertName(e,{suffix:t+this._parsedConfig.operationResultSuffix}),r=this._externalImportPrefix+this.convertName(e,{suffix:t+"Variables"}),s=this._getHookSuffix(e.name.value,n),a=this.convertName(e.name.value,{suffix:s,useTypesPrefix:!1}),p="`"+this.printDocument(e)+"`";return"hooks-types"===this.config.mode?(this.imports.add('import * as Magiql from "'+this.config.importHooksFrom+'";'),(this.config.noExport?"":"export ")+"function use"+a+"(options?: Magiql.Use"+n+"Options<"+i+", "+r+">): Magiql.UseQueryResult<"+i+", "+r+">;\n \n "):"hooks-esm"===this.config.mode?(this.imports.add('import * as Magiql from "'+this.config.importHooksFrom+'";'),(this.config.noExport?"":"export ")+"function use"+a+"(options) {\n return Magiql.use"+n+"("+p+', { opName: "'+e.name.value+'", ...options });\n }\n \n '):"hooks-cjs"===this.config.mode?(this.imports.add('const Magiql = require("'+this.config.importHooksFrom+'");'),(this.config.noExport?"":"module.exports.use"+a+" = ")+"function use"+a+'(_options) {\n const options = Object.assign({}, { opName: "'+e.name.value+'" }, _options);\n return Magiql.use'+n+"("+JSON.stringify(this.printDocument(e))+", options);\n }\n \n "):""}getImports(){var e=super.getImports();return this._collectedOperations.length>0?[...Array.from(this.imports)]:e}_getHookSuffix(e,n){return this.config.dedupeOperationSuffix&&(e.includes("Query")||e.includes("Mutation")||e.includes("Subscription"))?"":o.pascalCase(n)}}exports.plugin=(e,n,i)=>"magic"===i.mode?((e,n,i)=>{var r=new p(e,i),o=t.printSchema(e),s=t.parse(o),a=t.visit(s,{leave:r}),u=function(e){var n="export type Types = {\n";return e.definitions.forEach(e=>{"ObjectTypeDefinition"===e.kind&&(n+=" "+e.name.value+": "+e.name.value+";\n")}),n+="}\n"}(s),g=r.scalarsDefinition;return{prepend:['import React from "react";',...r.getEnumsImports(),...r.getScalarsImports(),...r.getWrapperDefinitions()],content:[g,...a.definitions,u,m].join("\n")}})(e,0,i):((e,n,i)=>{var r=t.concatAST(n.map(e=>e.document)),o=[...r.definitions.filter(e=>e.kind===t.Kind.FRAGMENT_DEFINITION).map(e=>({node:e,name:e.name.value,onType:e.typeCondition.name.value,isExternal:!1})),...i.externalFragments||[]],s=new u(e,o,i,n),a=t.visit(r,{enter:null,leave:s});return{prepend:s.getImports(),content:[...a.definitions.filter(e=>"string"==typeof e)].join("\n")}})(e,n,i);
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var n=require("@graphql-codegen/typescript"),t=require("graphql"),i=require("@graphql-codegen/visitor-plugin-common"),r=e(require("auto-bind")),o=require("pascal-case"),s=e(require("graphql-tag")),a=require("graphql/language/printer");class p extends n.TsVisitor{constructor(e,n){super(e,n),this.currentNode=void 0,this._argumentsTransformer._avoidOptionals=!1}mergeAllFields(e,n){return[...e," fragment: (fragment?: MagiQLFragment) => Maybe<"+this.currentNode+">;"].join("\n")}convertName(e){return this.currentNode=super.convertName(e),this.currentNode}FieldDefinition(e,n,r){var o=this.config.wrapFieldDefinitions?"FieldWrapper<"+e.type+">":e.type,s=r[n];s.arguments.length>0&&(o="(args: { "+s.arguments.map(e=>this._argumentsTransformer.transformVariable(e)).join(", ")+" }) => "+o);var a=!this.config.avoidOptionals.object&&s.type.kind!==t.Kind.NON_NULL_TYPE,p=this.getFieldComment(e),{type:m}=this.config.declarationKind;return p+i.indent((this.config.immutableTypes?"readonly ":"")+e.name+(a?"?":"")+": "+o+this.getPunctuation(m))}}var m='\nimport { UseQueryResult, UseQueryOptions } from "./client/hooks";\n\nexport type Type<K extends keyof Types = "Query"> = Types[K];\n\nexport type MagiQLFragment = (name?: string) => string;\n\nexport function useMagiqlQuery<TVariables = {}>(\n name: string,\n options?: UseQueryOptions<Query, TVariables>\n): Omit<UseQueryResult<Query>, "data"> & {\n query: Query;\n variables: TVariables;\n};\n\nexport function useFragment<K extends keyof Types>(name: K): Type<K>;\n\nexport type FragmentProps<F = {}> = {\n [K in keyof F]?: Maybe<F[K]>;\n};\n\nexport type ComponentTypeWithFragment<\n F = {},\n P = {}\n> = React.ComponentType<FragmentProps<F> & P>;\n\nexport type ComponentWithFragment<\n F extends FragmentDictionary,\n P = {}\n> = ComponentTypeWithFragment<F, P> & { [K in keyof F]?: MagiQLFragment };\n\nexport function withFragment<F = {}, P = any>(\n Component: ComponentTypeWithFragment<F, P>\n): ComponentWithFragment<F, P>;\n\n';class u extends i.ClientSideBaseVisitor{constructor(e,n,t,o){super(e,n,t,{importHooksFrom:i.getConfigValue(t.importHooksFrom,"./client"),addDocBlocks:i.getConfigValue(t.addDocBlocks,!0),codegen:i.getConfigValue(t.codegen,!1),mode:i.getConfigValue(t.mode,"hooks-types")}),this._externalImportPrefix=void 0,this.imports=new Set,this._externalImportPrefix=this.config.importOperationTypesFrom?this.config.importOperationTypesFrom+".":"",this._documents=o,r(this)}printFragments(e){if(!e)return[];var n=[];t.visit(e,{enter:{FragmentSpread:e=>{n.push(e.name.value)}}});var i=n.map(e=>this.getFragmentName(e));return i&&i.length>0?""+i.filter((e,n,t)=>t.indexOf(e)===n).map(e=>{var n=this._fragments.find(n=>n.name+"Fragment"===e);return n?a.print(n.node):null}).filter(e=>e).join("\n"):""}printDocument(e){var n="\n"+a.print(e).split("\\").join("\\\\")+"\n"+this.printFragments(e),t=s(n);return a.print(t)}OperationDefinition(e){if(!e.name||!e.name.value)return null;this._collectedOperations.push(e);var n=o.pascalCase(e.operation),t=this.config.dedupeOperationSuffix&&e.name.value.toLowerCase().endsWith(e.operation)?"":n,i=this._externalImportPrefix+this.convertName(e,{suffix:t+this._parsedConfig.operationResultSuffix}),r=this._externalImportPrefix+this.convertName(e,{suffix:t+"Variables"}),s=this._getHookSuffix(e.name.value,n),a=this.convertName(e.name.value,{suffix:s,useTypesPrefix:!1}),p="`"+this.printDocument(e)+"`";return"hooks-types"===this.config.mode?(this.imports.add('import * as Magiql from "'+this.config.importHooksFrom+'";'),(this.config.noExport?"":"export ")+"function use"+a+"(options?: Magiql.Use"+n+"Options<"+i+", "+r+">): Magiql.UseQueryResult<"+i+", "+r+">;\n \n "):"hooks-esm"===this.config.mode?(this.imports.add('import * as Magiql from "'+this.config.importHooksFrom+'";'),(this.config.noExport?"":"export ")+"function use"+a+"(options) {\n return Magiql.use"+n+"("+p+', { opName: "'+e.name.value+'", ...options });\n }\n \n '):"hooks-cjs"===this.config.mode?(this.imports.add('const Magiql = require("'+this.config.importHooksFrom+'");'),(this.config.noExport?"":"module.exports.use"+a+" = ")+"function use"+a+'(_options) {\n const options = Object.assign({}, { opName: "'+e.name.value+'" }, _options);\n return Magiql.use'+n+"("+JSON.stringify(this.printDocument(e))+", options);\n }\n \n "):""}getImports(){var e=super.getImports();return this._collectedOperations.length>0?[...Array.from(this.imports)]:e}_getHookSuffix(e,n){return this.config.dedupeOperationSuffix&&(e.includes("Query")||e.includes("Mutation")||e.includes("Subscription"))?"":o.pascalCase(n)}}exports.plugin=(e,n,i)=>"magic"===i.mode?((e,n,i)=>{var r=new p(e,i),o=t.printSchema(e),s=t.parse(o),a=t.visit(s,{leave:r}),u=function(e){var n="export type Types = {\n";return e.definitions.forEach(e=>{"ObjectTypeDefinition"===e.kind&&(n+=" "+e.name.value+": "+e.name.value+";\n")}),n+="}\n"}(s),g=r.scalarsDefinition;return{prepend:['import React from "react";',...r.getEnumsImports(),...r.getScalarsImports(),...r.getWrapperDefinitions()],content:[g,...a.definitions,u,m].join("\n")}})(e,0,i):((e,n,i)=>{var r=t.concatAST(n.map(e=>e.document)),o=[...r.definitions.filter(e=>e.kind===t.Kind.FRAGMENT_DEFINITION).map(e=>({node:e,name:e.name.value,onType:e.typeCondition.name.value,isExternal:!1})),...i.externalFragments||[]],s=new u(e,o,i,n),a=t.visit(r,{enter:null,leave:s});return{prepend:s.getImports(),content:[...a.definitions.filter(e=>"string"==typeof e)].join("\n")}})(e,n,i);
//# sourceMappingURL=codegen.js.map

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

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./client"),r=require("./hooks"),t=require("./devtools");Object.keys(e).forEach((function(r){"default"!==r&&Object.defineProperty(exports,r,{enumerable:!0,get:function(){return e[r]}})})),Object.keys(r).forEach((function(e){"default"!==e&&Object.defineProperty(exports,e,{enumerable:!0,get:function(){return r[e]}})})),Object.keys(t).forEach((function(e){"default"!==e&&Object.defineProperty(exports,e,{enumerable:!0,get:function(){return t[e]}})})),exports.useFragment=function(e){throw new Error("Unimplemented: I think your babel config is not working. \n Make sure magiql/babel is added as a plugin.")},exports.useMagiqlQuery=function(e,r){throw new Error("Unimplemented: I think your babel config is not working. \n Make sure magiql/babel is added as a plugin.")},exports.withFragment=function(e){return e};
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./client"),r=require("./hooks"),t=require("./devtools");Object.keys(e).forEach((function(r){"default"!==r&&Object.defineProperty(exports,r,{enumerable:!0,get:function(){return e[r]}})})),Object.keys(r).forEach((function(e){"default"!==e&&Object.defineProperty(exports,e,{enumerable:!0,get:function(){return r[e]}})})),Object.keys(t).forEach((function(e){"default"!==e&&Object.defineProperty(exports,e,{enumerable:!0,get:function(){return t[e]}})})),exports.useFragment=function(e){throw new Error("Unimplemented: Make sure magiql/babel is added as a plugin.")},exports.useMagiqlQuery=function(e,r){throw new Error("Unimplemented: Make sure magiql/babel is added as a plugin.")},exports.withFragment=function(e){return e};
//# sourceMappingURL=magiql.js.map

@@ -27,3 +27,2 @@ import { TsVisitor } from '@graphql-codegen/typescript';

mergeAllFields(allFields, hasInterfaces) {
console.log(allFields);
return [...allFields, " fragment: (fragment?: MagiQLFragment) => Maybe<" + this.currentNode + ">;"].join("\n");

@@ -30,0 +29,0 @@ }

@@ -6,6 +6,6 @@ export * from './client';

function useMagiqlQuery(name, options) {
throw new Error("Unimplemented: I think your babel config is not working. \n Make sure magiql/babel is added as a plugin.");
throw new Error("Unimplemented: Make sure magiql/babel is added as a plugin.");
}
function useFragment(name) {
throw new Error("Unimplemented: I think your babel config is not working. \n Make sure magiql/babel is added as a plugin.");
throw new Error("Unimplemented: Make sure magiql/babel is added as a plugin.");
}

@@ -12,0 +12,0 @@ function withFragment(Component) {

{
"name": "magiql",
"version": "0.0.2-beta.24",
"version": "0.0.2",
"description": "",

@@ -5,0 +5,0 @@ "repository": "Nikhil Saraf",

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

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