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

graphql-transformer-common

Package Overview
Dependencies
Maintainers
2
Versions
766
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

graphql-transformer-common - npm Package Compare versions

Comparing version 1.0.12 to 1.0.13-publish-test.0

lib/nodeUtils.d.ts

8

CHANGELOG.md

@@ -6,2 +6,10 @@ # Change Log

<a name="1.0.13-publish-test.0"></a>
## [1.0.13-publish-test.0](https://github.com/aws-amplify/amplify-cli/compare/graphql-transformer-common@1.0.12...graphql-transformer-common@1.0.13-publish-test.0) (2018-10-03)
**Note:** Version bump only for package graphql-transformer-common
<a name="1.0.12"></a>

@@ -8,0 +16,0 @@ ## [1.0.12](https://github.com/aws-amplify/amplify-cli/compare/graphql-transformer-common@1.0.11...graphql-transformer-common@1.0.12) (2018-08-23)

9

lib/definition.d.ts

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

import { ObjectTypeDefinitionNode, InputValueDefinitionNode, FieldDefinitionNode, TypeNode, SchemaDefinitionNode, OperationTypeNode, OperationTypeDefinitionNode, ObjectTypeExtensionNode, NamedTypeNode, NonNullTypeNode, ListTypeNode, DirectiveNode, EnumTypeDefinitionNode } from 'graphql';
import { ObjectTypeDefinitionNode, InputValueDefinitionNode, FieldDefinitionNode, TypeNode, SchemaDefinitionNode, OperationTypeNode, OperationTypeDefinitionNode, ObjectTypeExtensionNode, NamedTypeNode, NonNullTypeNode, ListTypeNode, ArgumentNode, DirectiveNode, EnumTypeDefinitionNode, ValueNode } from 'graphql';
export declare const STANDARD_SCALARS: {

@@ -33,6 +33,9 @@ String: string;

export declare function extensionWithFields(object: ObjectTypeExtensionNode, fields: FieldDefinitionNode[]): ObjectTypeExtensionNode;
export declare function makeField(name: string, args: InputValueDefinitionNode[], type: TypeNode): FieldDefinitionNode;
export declare function makeArg(name: string, type: TypeNode): InputValueDefinitionNode;
export declare function makeField(name: string, args: InputValueDefinitionNode[], type: TypeNode, directives?: DirectiveNode[]): FieldDefinitionNode;
export declare function makeDirective(name: string, args: ArgumentNode[]): DirectiveNode;
export declare function makeArgument(name: string, value: ValueNode): ArgumentNode;
export declare function makeValueNode(value: any): ValueNode;
export declare function makeInputValueDefinition(name: string, type: TypeNode): InputValueDefinitionNode;
export declare function makeNamedType(name: string): NamedTypeNode;
export declare function makeNonNullType(type: NamedTypeNode | ListTypeNode): NonNullTypeNode;
export declare function makeListType(type: TypeNode): TypeNode;

@@ -172,3 +172,4 @@ "use strict";

exports.extensionWithFields = extensionWithFields;
function makeField(name, args, type) {
function makeField(name, args, type, directives) {
if (directives === void 0) { directives = []; }
return {

@@ -182,13 +183,72 @@ kind: graphql_1.Kind.FIELD_DEFINITION,

type: type,
directives: []
directives: directives
};
}
exports.makeField = makeField;
function makeArg(name, type) {
function makeDirective(name, args) {
return {
kind: 'InputValueDefinition',
kind: graphql_1.Kind.DIRECTIVE,
name: {
kind: graphql_1.Kind.NAME,
value: name
},
arguments: args
};
}
exports.makeDirective = makeDirective;
function makeArgument(name, value) {
return {
kind: graphql_1.Kind.ARGUMENT,
name: {
kind: 'Name',
value: name
},
value: value
};
}
exports.makeArgument = makeArgument;
function makeValueNode(value) {
if (typeof value === 'string') {
return { kind: graphql_1.Kind.STRING, value: value };
}
else if (Number.isInteger(value)) {
return { kind: graphql_1.Kind.INT, value: value };
}
else if (typeof value === 'number') {
return { kind: graphql_1.Kind.FLOAT, value: String(value) };
}
else if (typeof value === 'boolean') {
return { kind: graphql_1.Kind.BOOLEAN, value: value };
}
else if (value === null) {
return { kind: graphql_1.Kind.NULL };
}
else if (Array.isArray(value)) {
return {
kind: graphql_1.Kind.LIST,
values: value.map(function (v) { return makeValueNode(v); })
};
}
else if (typeof value === 'object') {
return {
kind: graphql_1.Kind.OBJECT,
fields: Object.keys(value).map(function (key) {
var keyValNode = makeValueNode(value[key]);
return {
kind: graphql_1.Kind.OBJECT_FIELD,
name: { kind: graphql_1.Kind.NAME, value: key },
value: keyValNode
};
})
};
}
}
exports.makeValueNode = makeValueNode;
function makeInputValueDefinition(name, type) {
return {
kind: graphql_1.Kind.INPUT_VALUE_DEFINITION,
name: {
kind: 'Name',
value: name
},
type: type,

@@ -198,3 +258,3 @@ directives: []

}
exports.makeArg = makeArg;
exports.makeInputValueDefinition = makeInputValueDefinition;
function makeNamedType(name) {

@@ -201,0 +261,0 @@ return {

@@ -7,1 +7,2 @@ export * from './ResourceConstants';

export * from './SearchableResourceIDs';
export * from './nodeUtils';

@@ -12,2 +12,3 @@ "use strict";

__export(require("./SearchableResourceIDs"));
__export(require("./nodeUtils"));
//# sourceMappingURL=index.js.map

@@ -11,2 +11,6 @@ export declare class ModelResourceIDs {

static ModelCreateInputObjectName(typeName: string): string;
static ModelOnCreateSubscriptionName(typeName: string): string;
static ModelOnUpdateSubscriptionName(typeName: string): string;
static ModelOnDeleteSubscriptionName(typeName: string): string;
static NonModelInputObjectName(typeName: string): string;
}

@@ -39,2 +39,14 @@ "use strict";

};
ModelResourceIDs.ModelOnCreateSubscriptionName = function (typeName) {
return util_1.graphqlName("onCreate" + util_1.toUpper(typeName));
};
ModelResourceIDs.ModelOnUpdateSubscriptionName = function (typeName) {
return util_1.graphqlName("onUpdate" + util_1.toUpper(typeName));
};
ModelResourceIDs.ModelOnDeleteSubscriptionName = function (typeName) {
return util_1.graphqlName("onDelete" + util_1.toUpper(typeName));
};
ModelResourceIDs.NonModelInputObjectName = function (typeName) {
return util_1.graphqlName(util_1.toUpper(typeName) + 'Input');
};
return ModelResourceIDs;

@@ -41,0 +53,0 @@ }());

{
"name": "graphql-transformer-common",
"version": "1.0.12",
"version": "1.0.13-publish-test.0",
"description": "Common code and constants for AppSync Transformers",

@@ -9,4 +9,3 @@ "main": "lib/index.js",

"build": "tsc",
"clean": "rm -rf ./lib",
"lint": "tslint -p ./tslint.json"
"clean": "rm -rf ./lib"
},

@@ -23,4 +22,4 @@ "keywords": [

"graphql": "^0.13.2",
"graphql-mapping-template": "^1.0.12",
"graphql-transformer-core": "^1.0.12"
"graphql-mapping-template": "^1.0.13-publish-test.0",
"graphql-transformer-core": "^1.0.13-publish-test.0"
},

@@ -27,0 +26,0 @@ "devDependencies": {

@@ -5,4 +5,8 @@ import {

ObjectTypeExtensionNode, NamedTypeNode, Kind, NonNullTypeNode, ListTypeNode,
valueFromASTUntyped, ArgumentNode, DirectiveNode, EnumTypeDefinitionNode
valueFromASTUntyped, ArgumentNode, DirectiveNode, EnumTypeDefinitionNode,
ValueNode,
ListValueNode,
ObjectValueNode
} from 'graphql'
import { access } from 'fs';

@@ -177,3 +181,3 @@ export const STANDARD_SCALARS = {

export function makeField(name: string, args: InputValueDefinitionNode[], type: TypeNode): FieldDefinitionNode {
export function makeField(name: string, args: InputValueDefinitionNode[], type: TypeNode, directives: DirectiveNode[] = []): FieldDefinitionNode {
return {

@@ -187,13 +191,66 @@ kind: Kind.FIELD_DEFINITION,

type,
directives: []
directives
}
}
export function makeArg(name: string, type: TypeNode): InputValueDefinitionNode {
export function makeDirective(name: string, args: ArgumentNode[]): DirectiveNode {
return {
kind: 'InputValueDefinition',
kind: Kind.DIRECTIVE,
name: {
kind: Kind.NAME,
value: name
},
arguments: args
}
}
export function makeArgument(name: string, value: ValueNode): ArgumentNode {
return {
kind: Kind.ARGUMENT,
name: {
kind: 'Name',
value: name
},
value
}
}
export function makeValueNode(value: any): ValueNode {
if (typeof value === 'string') {
return { kind: Kind.STRING, value: value }
} else if (Number.isInteger(value)) {
return { kind: Kind.INT, value: value }
} else if (typeof value === 'number') {
return { kind: Kind.FLOAT, value: String(value) }
} else if (typeof value === 'boolean') {
return { kind: Kind.BOOLEAN, value: value }
} else if (value === null) {
return { kind: Kind.NULL }
} else if (Array.isArray(value)) {
return {
kind: Kind.LIST,
values: value.map(v => makeValueNode(v))
}
} else if (typeof value === 'object') {
return {
kind: Kind.OBJECT,
fields: Object.keys(value).map((key: string) => {
const keyValNode = makeValueNode(value[key])
return {
kind: Kind.OBJECT_FIELD,
name: { kind: Kind.NAME, value: key },
value: keyValNode
}
})
}
}
}
export function makeInputValueDefinition(name: string, type: TypeNode): InputValueDefinitionNode {
return {
kind: Kind.INPUT_VALUE_DEFINITION,
name: {
kind: 'Name',
value: name
},
type,

@@ -200,0 +257,0 @@ directives: []

@@ -6,2 +6,3 @@ export * from './ResourceConstants'

export * from './ModelResourceIDs'
export * from './SearchableResourceIDs'
export * from './SearchableResourceIDs'
export * from './nodeUtils'

@@ -36,2 +36,14 @@ import { graphqlName, toUpper } from './util'

}
static ModelOnCreateSubscriptionName(typeName: string): string {
return graphqlName(`onCreate` + toUpper(typeName))
}
static ModelOnUpdateSubscriptionName(typeName: string): string {
return graphqlName(`onUpdate` + toUpper(typeName))
}
static ModelOnDeleteSubscriptionName(typeName: string): string {
return graphqlName(`onDelete` + toUpper(typeName))
}
static NonModelInputObjectName(typeName: string): string {
return graphqlName(toUpper(typeName) + 'Input')
}
}

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