Socket
Socket
Sign inDemoInstall

apollo-codegen

Package Overview
Dependencies
Maintainers
1
Versions
102
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

apollo-codegen - npm Package Compare versions

Comparing version 0.11.2 to 0.11.3

11

lib/cli.js

@@ -111,2 +111,7 @@ #!/usr/bin/env node

},
namespace: {
demand: false,
describe: 'Optional namespace for generated types [currently Swift-only]',
type: 'string'
},
"passthrough-custom-scalars": {

@@ -133,3 +138,7 @@ demand: false,

const options = { passthroughCustomScalars: argv["passthrough-custom-scalars"] || argv["custom-scalars-prefix"] !== '', customScalarsPrefix: argv["custom-scalars-prefix"] || '' };
const options = {
passthroughCustomScalars: argv["passthrough-custom-scalars"] || argv["custom-scalars-prefix"] !== '',
customScalarsPrefix: argv["custom-scalars-prefix"] || '',
namespace: argv.namespace
};
(0, _.generate)(inputPaths, argv.schema, argv.output, argv.target, options);

@@ -136,0 +145,0 @@ }).fail(function (message, error) {

19

lib/swift/codeGeneration.js

@@ -50,12 +50,15 @@ 'use strict';

context.typesUsed.forEach(type => {
typeDeclarationForGraphQLType(generator, type);
});
(0, _language.namespaceDeclaration)(generator, context.namespace, () => {
(0, _values2.default)(context.operations).forEach(operation => {
classDeclarationForOperation(generator, (0, _extends3.default)({}, operation, { selectionSet: selectionSetFrom(operation) }));
});
context.typesUsed.forEach(type => {
typeDeclarationForGraphQLType(generator, type);
});
(0, _values2.default)(context.fragments).forEach(fragment => {
structDeclarationForFragment(generator, (0, _extends3.default)({}, fragment, { selectionSet: selectionSetFrom(fragment) }));
(0, _values2.default)(context.operations).forEach(operation => {
classDeclarationForOperation(generator, (0, _extends3.default)({}, operation, { selectionSet: selectionSetFrom(operation) }));
});
(0, _values2.default)(context.fragments).forEach(fragment => {
structDeclarationForFragment(generator, (0, _extends3.default)({}, fragment, { selectionSet: selectionSetFrom(fragment) }));
});
});

@@ -62,0 +65,0 @@

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

exports.namespaceDeclaration = namespaceDeclaration;
exports.classDeclaration = classDeclaration;

@@ -29,2 +30,16 @@ exports.structDeclaration = structDeclaration;

function namespaceDeclaration(generator, namespace, closure) {
if (namespace) {
generator.printNewlineIfNeeded();
generator.printNewline();
generator.printOnNewline(`/// ${namespace} namespace`);
generator.printOnNewline(`public enum ${namespace}`);
generator.pushScope({ typeName: namespace });
generator.withinBlock(closure);
generator.popScope();
} else {
closure();
}
}
function classDeclaration(generator, _ref, closure) {

@@ -40,4 +55,3 @@ let className = _ref.className,

generator.printNewline();
generator.print((0, _printing.wrap)('', (0, _printing.join)(modifiers, ' '), ' '));
generator.print(`class ${className}`);
generator.printOnNewline((0, _printing.wrap)('', (0, _printing.join)(modifiers, ' '), ' ') + `class ${className}`);
generator.print((0, _printing.wrap)(': ', (0, _printing.join)([superClass].concat((0, _toConsumableArray3.default)(adoptedProtocols)), ', ')));

@@ -44,0 +58,0 @@ generator.pushScope({ typeName: className });

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

const name = field.name || field.responseName;
const propertyName = (0, _language.escapeIdentifierIfNeeded)((0, _changeCase.camelCase)(name));
const unescapedPropertyName = isMetaFieldName(name) ? name : (0, _changeCase.camelCase)(name);
const propertyName = (0, _language.escapeIdentifierIfNeeded)(unescapedPropertyName);

@@ -103,2 +104,6 @@ const type = field.type;

}
function isMetaFieldName(name) {
return name.startsWith("__");
}
//# sourceMappingURL=naming.js.map
{
"name": "apollo-codegen",
"version": "0.11.2",
"version": "0.11.3",
"description": "Generate API code or type annotations based on a GraphQL schema and query documents",

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

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