New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

graphql-codegen-typescript-operations

Package Overview
Dependencies
Maintainers
1
Versions
91
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

graphql-codegen-typescript-operations - npm Package Compare versions

Comparing version 0.19.0-alpha.82e27c41 to 0.19.0-alpha.8e3376c3

cjs/index.js

16

dist/index.js

@@ -1,11 +0,9 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var graphql_1 = require("graphql");
var visitor_1 = require("./visitor");
exports.plugin = function (schema, documents, config) {
var allAst = graphql_1.concatAST(documents.reduce(function (prev, v) {
return prev.concat([v.content]);
import { visit, concatAST } from 'graphql';
import { TypeScriptDocumentsVisitor } from './visitor';
export const plugin = (schema, documents, config) => {
const allAst = concatAST(documents.reduce((prev, v) => {
return [...prev, v.content];
}, []));
var visitorResult = graphql_1.visit(allAst, {
leave: new visitor_1.TypeScriptDocumentsVisitor(schema, config)
const visitorResult = visit(allAst, {
leave: new TypeScriptDocumentsVisitor(schema, config)
});

@@ -12,0 +10,0 @@ return visitorResult.definitions.join('\n');

@@ -1,29 +0,12 @@

"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
var graphql_codegen_visitor_plugin_common_1 = require("graphql-codegen-visitor-plugin-common");
var graphql_1 = require("graphql");
var TypeScriptSelectionSetToObject = /** @class */ (function (_super) {
__extends(TypeScriptSelectionSetToObject, _super);
function TypeScriptSelectionSetToObject(_scalars, _schema, _convertName, _addTypename, _immutableTypes, _parentSchemaType, _selectionSet) {
var _this = _super.call(this, _scalars, _schema, _convertName, _addTypename, _parentSchemaType, _selectionSet) || this;
_this._immutableTypes = _immutableTypes;
return _this;
import { SelectionSetToObject } from 'graphql-codegen-visitor-plugin-common';
import { isNonNullType, isListType } from 'graphql';
export class TypeScriptSelectionSetToObject extends SelectionSetToObject {
constructor(_scalars, _schema, _convertName, _addTypename, _immutableTypes, _parentSchemaType, _selectionSet) {
super(_scalars, _schema, _convertName, _addTypename, _parentSchemaType, _selectionSet);
this._immutableTypes = _immutableTypes;
}
TypeScriptSelectionSetToObject.prototype.createNext = function (parentSchemaType, selectionSet) {
createNext(parentSchemaType, selectionSet) {
return new TypeScriptSelectionSetToObject(this._scalars, this._schema, this._convertName, this._addTypename, this._immutableTypes, parentSchemaType, selectionSet);
};
TypeScriptSelectionSetToObject.prototype.clearOptional = function (str) {
}
clearOptional(str) {
if (str.startsWith('Maybe')) {

@@ -33,21 +16,19 @@ return str.replace(/^Maybe<(.*?)>$/i, '$1');

return str;
};
TypeScriptSelectionSetToObject.prototype.formatNamedField = function (name) {
return this._immutableTypes ? "readonly " + name : name;
};
TypeScriptSelectionSetToObject.prototype.wrapTypeWithModifiers = function (baseType, type) {
if (graphql_1.isNonNullType(type)) {
}
formatNamedField(name) {
return this._immutableTypes ? `readonly ${name}` : name;
}
wrapTypeWithModifiers(baseType, type) {
if (isNonNullType(type)) {
return this.clearOptional(this.wrapTypeWithModifiers(baseType, type.ofType));
}
else if (graphql_1.isListType(type)) {
var innerType = this.wrapTypeWithModifiers(baseType, type.ofType);
return "Maybe<" + (this._immutableTypes ? 'ReadonlyArray' : 'Array') + "<" + innerType + ">>";
else if (isListType(type)) {
const innerType = this.wrapTypeWithModifiers(baseType, type.ofType);
return `Maybe<${this._immutableTypes ? 'ReadonlyArray' : 'Array'}<${innerType}>>`;
}
else {
return "Maybe<" + baseType + ">";
return `Maybe<${baseType}>`;
}
};
return TypeScriptSelectionSetToObject;
}(graphql_codegen_visitor_plugin_common_1.SelectionSetToObject));
exports.TypeScriptSelectionSetToObject = TypeScriptSelectionSetToObject;
}
}
//# sourceMappingURL=ts-selection-set-to-object.js.map

@@ -1,33 +0,14 @@

"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
var graphql_codegen_visitor_plugin_common_1 = require("graphql-codegen-visitor-plugin-common");
var ts_selection_set_to_object_1 = require("./ts-selection-set-to-object");
var graphql_codegen_typescript_1 = require("graphql-codegen-typescript");
var TypeScriptDocumentsVisitor = /** @class */ (function (_super) {
__extends(TypeScriptDocumentsVisitor, _super);
function TypeScriptDocumentsVisitor(schema, config) {
var _this = _super.call(this, config, {
import { BaseDocumentsVisitor } from 'graphql-codegen-visitor-plugin-common';
import { TypeScriptSelectionSetToObject } from './ts-selection-set-to-object';
import { TypeScriptOperationVariablesToObject } from 'graphql-codegen-typescript';
export class TypeScriptDocumentsVisitor extends BaseDocumentsVisitor {
constructor(schema, config) {
super(config, {
avoidOptionals: config.avoidOptionals || false,
immutableTypes: config.immutableTypes || false
}, schema) || this;
_this.setSelectionSetHandler(new ts_selection_set_to_object_1.TypeScriptSelectionSetToObject(_this.scalars, _this.schema, _this.convertName, _this.config.addTypename, _this.config.immutableTypes));
_this.setVariablesTransformer(new graphql_codegen_typescript_1.TypeScriptOperationVariablesToObject(_this.scalars, _this.convertName, _this.config.avoidOptionals, _this.config.immutableTypes));
return _this;
}, schema);
this.setSelectionSetHandler(new TypeScriptSelectionSetToObject(this.scalars, this.schema, this.convertName, this.config.addTypename, this.config.immutableTypes));
this.setVariablesTransformer(new TypeScriptOperationVariablesToObject(this.scalars, this.convertName, this.config.avoidOptionals, this.config.immutableTypes));
}
return TypeScriptDocumentsVisitor;
}(graphql_codegen_visitor_plugin_common_1.BaseDocumentsVisitor));
exports.TypeScriptDocumentsVisitor = TypeScriptDocumentsVisitor;
}
//# sourceMappingURL=visitor.js.map
{
"name": "graphql-codegen-typescript-operations",
"version": "0.19.0-alpha.82e27c41",
"version": "0.19.0-alpha.8e3376c3",
"description": "GraphQL Code Generator plugin for generating TypeScript types for GraphQL queries, mutations, subscriptions and fragments",

@@ -12,8 +12,11 @@ "repository": "git@github.com:dotansimha/graphql-code-generator.git",

"dependencies": {
"graphql-codegen-plugin-helpers": "0.19.0-alpha.82e27c41",
"graphql-codegen-typescript": "0.19.0-alpha.82e27c41",
"graphql-codegen-visitor-plugin-common": "0.19.0-alpha.82e27c41"
"esm": "3.2.11",
"graphql-codegen-plugin-helpers": "0.19.0-alpha.8e3376c3",
"graphql-codegen-typescript": "0.19.0-alpha.8e3376c3",
"graphql-codegen-visitor-plugin-common": "0.19.0-alpha.8e3376c3",
"tslib": "1.9.3"
},
"devDependencies": {
"graphql": "14.1.1",
"graphql-codegen-testing": "0.19.0-alpha.8e3376c3",
"jest": "24.1.0",

@@ -23,3 +26,4 @@ "ts-jest": "24.0.0",

},
"main": "./dist/index.js",
"main": "cjs/index.js",
"module": "dist/index.js",
"typings": "dist/index.d.ts",

@@ -32,3 +36,6 @@ "typescript": {

"ts-jest": {
"enableTsDiagnostics": false
"enableTsDiagnostics": false,
"tsConfig": {
"esModuleInterop": true
}
}

@@ -35,0 +42,0 @@ },

{
"compilerOptions": {
"importHelpers": true,
"experimentalDecorators": true,
"module": "commonjs",
"target": "es5",
"module": "esnext",
"target": "es2018",
"lib": ["es6", "esnext", "es2015"],

@@ -7,0 +8,0 @@ "suppressImplicitAnyIndexErrors": true,

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