@jcoreio/graphql-sequelize-extra
Advanced tools
Comparing version 1.0.0 to 1.2.0
@@ -1,3 +0,3 @@ | ||
// flow-typed signature: f80f981d039947b3f29f0f437061852a | ||
// flow-typed version: da30fe6876/chai_v3.5.x/flow_>=v0.25.0 | ||
// flow-typed signature: 98fefd085adee7e50ffc1f2e8c96033f | ||
// flow-typed version: b43d75317c/chai_v3.5.x/flow_>=v0.25.0 | ||
@@ -38,4 +38,8 @@ declare module "chai" { | ||
above: (value: T & number) => ExpectChain<T>, | ||
greaterThan: (value: T & number) => ExpectChain<T>, | ||
gt: (value: T & number) => ExpectChain<T>, | ||
least: (value: T & number) => ExpectChain<T>, | ||
below: (value: T & number) => ExpectChain<T>, | ||
lessThan: (value: T & number) => ExpectChain<T>, | ||
lt: (value: T & number) => ExpectChain<T>, | ||
most: (value: T & number) => ExpectChain<T>, | ||
@@ -42,0 +46,0 @@ within: (start: T & number, finish: T & number) => ExpectChain<T>, |
@@ -1,3 +0,3 @@ | ||
// flow-typed signature: 196c17cc5f7f821ccdc3dcd798742acf | ||
// flow-typed version: <<STUB>>/semantic-release_v^6.3.6/flow_v0.61.0 | ||
// flow-typed signature: 48d6eb2c0bb5e548e53d1adf26798250 | ||
// flow-typed version: <<STUB>>/semantic-release_v^11.0.0/flow_v0.61.0 | ||
@@ -29,34 +29,46 @@ /** | ||
declare module 'semantic-release/src/lib/commits' { | ||
declare module 'semantic-release/cli' { | ||
declare module.exports: any; | ||
} | ||
declare module 'semantic-release/src/lib/get-registry' { | ||
declare module 'semantic-release/lib/debug' { | ||
declare module.exports: any; | ||
} | ||
declare module 'semantic-release/src/lib/plugin-noop' { | ||
declare module 'semantic-release/lib/get-commits' { | ||
declare module.exports: any; | ||
} | ||
declare module 'semantic-release/src/lib/plugins' { | ||
declare module 'semantic-release/lib/get-config' { | ||
declare module.exports: any; | ||
} | ||
declare module 'semantic-release/src/lib/type' { | ||
declare module 'semantic-release/lib/get-next-version' { | ||
declare module.exports: any; | ||
} | ||
declare module 'semantic-release/src/lib/verify' { | ||
declare module 'semantic-release/lib/git' { | ||
declare module.exports: any; | ||
} | ||
declare module 'semantic-release/src/post' { | ||
declare module 'semantic-release/lib/logger' { | ||
declare module.exports: any; | ||
} | ||
declare module 'semantic-release/src/pre' { | ||
declare module 'semantic-release/lib/plugins/definitions' { | ||
declare module.exports: any; | ||
} | ||
declare module 'semantic-release/lib/plugins/index' { | ||
declare module.exports: any; | ||
} | ||
declare module 'semantic-release/lib/plugins/normalize' { | ||
declare module.exports: any; | ||
} | ||
declare module 'semantic-release/lib/plugins/pipeline' { | ||
declare module.exports: any; | ||
} | ||
// Filename aliases | ||
@@ -66,25 +78,40 @@ declare module 'semantic-release/bin/semantic-release.js' { | ||
} | ||
declare module 'semantic-release/src/lib/commits.js' { | ||
declare module.exports: $Exports<'semantic-release/src/lib/commits'>; | ||
declare module 'semantic-release/cli.js' { | ||
declare module.exports: $Exports<'semantic-release/cli'>; | ||
} | ||
declare module 'semantic-release/src/lib/get-registry.js' { | ||
declare module.exports: $Exports<'semantic-release/src/lib/get-registry'>; | ||
declare module 'semantic-release/index' { | ||
declare module.exports: $Exports<'semantic-release'>; | ||
} | ||
declare module 'semantic-release/src/lib/plugin-noop.js' { | ||
declare module.exports: $Exports<'semantic-release/src/lib/plugin-noop'>; | ||
declare module 'semantic-release/index.js' { | ||
declare module.exports: $Exports<'semantic-release'>; | ||
} | ||
declare module 'semantic-release/src/lib/plugins.js' { | ||
declare module.exports: $Exports<'semantic-release/src/lib/plugins'>; | ||
declare module 'semantic-release/lib/debug.js' { | ||
declare module.exports: $Exports<'semantic-release/lib/debug'>; | ||
} | ||
declare module 'semantic-release/src/lib/type.js' { | ||
declare module.exports: $Exports<'semantic-release/src/lib/type'>; | ||
declare module 'semantic-release/lib/get-commits.js' { | ||
declare module.exports: $Exports<'semantic-release/lib/get-commits'>; | ||
} | ||
declare module 'semantic-release/src/lib/verify.js' { | ||
declare module.exports: $Exports<'semantic-release/src/lib/verify'>; | ||
declare module 'semantic-release/lib/get-config.js' { | ||
declare module.exports: $Exports<'semantic-release/lib/get-config'>; | ||
} | ||
declare module 'semantic-release/src/post.js' { | ||
declare module.exports: $Exports<'semantic-release/src/post'>; | ||
declare module 'semantic-release/lib/get-next-version.js' { | ||
declare module.exports: $Exports<'semantic-release/lib/get-next-version'>; | ||
} | ||
declare module 'semantic-release/src/pre.js' { | ||
declare module.exports: $Exports<'semantic-release/src/pre'>; | ||
declare module 'semantic-release/lib/git.js' { | ||
declare module.exports: $Exports<'semantic-release/lib/git'>; | ||
} | ||
declare module 'semantic-release/lib/logger.js' { | ||
declare module.exports: $Exports<'semantic-release/lib/logger'>; | ||
} | ||
declare module 'semantic-release/lib/plugins/definitions.js' { | ||
declare module.exports: $Exports<'semantic-release/lib/plugins/definitions'>; | ||
} | ||
declare module 'semantic-release/lib/plugins/index.js' { | ||
declare module.exports: $Exports<'semantic-release/lib/plugins/index'>; | ||
} | ||
declare module 'semantic-release/lib/plugins/normalize.js' { | ||
declare module.exports: $Exports<'semantic-release/lib/plugins/normalize'>; | ||
} | ||
declare module 'semantic-release/lib/plugins/pipeline.js' { | ||
declare module.exports: $Exports<'semantic-release/lib/plugins/pipeline'>; | ||
} |
@@ -13,38 +13,29 @@ 'use strict'; | ||
var HasOne = _sequelize.Association.HasOne, | ||
BelongsTo = _sequelize.Association.BelongsTo, | ||
HasMany = _sequelize.Association.HasMany, | ||
BelongsToMany = _sequelize.Association.BelongsToMany; | ||
const { HasOne, BelongsTo, HasMany, BelongsToMany } = _sequelize.Association; | ||
function associationFields(model, options) { | ||
var getType = options.getType; | ||
const { getType } = options; | ||
const getArgs = options.getArgs || _graphqlSequelize.defaultArgs; | ||
const getResolver = options.getResolver || ((model, association) => (0, _graphqlSequelize.resolver)(association)); | ||
var getArgs = options.getArgs || _graphqlSequelize.defaultArgs; | ||
var getResolver = options.getResolver || function (model, association) { | ||
return (0, _graphqlSequelize.resolver)(association); | ||
}; | ||
const result = {}; | ||
for (let key in model.associations) { | ||
const association = model.associations[key]; | ||
const { target, as } = association; | ||
var result = {}; | ||
for (var key in model.associations) { | ||
var _association = model.associations[key]; | ||
var target = _association.target, | ||
as = _association.as; | ||
let type = getType(target); | ||
if (!type) throw new Error(`missing type for model: ${String(target)}`); | ||
const args = getArgs(target); | ||
var _type = getType(target); | ||
if (!_type) throw new Error('missing type for model: ' + String(target)); | ||
const resolve = getResolver(target, association); | ||
if (!resolve) throw new Error(`missing resolver for model: ${String(target)}, association: ${String(association)}`); | ||
var _args = getArgs(target); | ||
let fieldName; | ||
var _resolve = getResolver(target, _association); | ||
if (!_resolve) throw new Error('missing resolver for model: ' + String(target) + ', association: ' + String(_association)); | ||
var fieldName = void 0; | ||
if (_association instanceof HasOne || _association instanceof BelongsTo) { | ||
if (association instanceof HasOne || association instanceof BelongsTo) { | ||
fieldName = typeof as === 'string' ? as : as.singular; | ||
} else if (_association instanceof HasMany || _association instanceof BelongsToMany) { | ||
} else if (association instanceof HasMany || association instanceof BelongsToMany) { | ||
fieldName = typeof as === 'string' ? as : as.plural; | ||
_type = new graphql.GraphQLList(_type); | ||
type = new graphql.GraphQLList(type); | ||
} else { | ||
@@ -55,4 +46,4 @@ // istanbul ignore next | ||
result[fieldName] = { type: _type, resolve: _resolve }; | ||
if (_args) result[fieldName].args = _args; | ||
result[fieldName] = { type, resolve }; | ||
if (args) result[fieldName].args = args; | ||
} | ||
@@ -59,0 +50,0 @@ return result; |
@@ -7,4 +7,29 @@ 'use strict'; | ||
var _attributeFieldsForCreate = require('./attributeFieldsForCreate'); | ||
var _attributeFieldsForCreate2 = _interopRequireDefault(_attributeFieldsForCreate); | ||
var _attributeFieldsForUpdate = require('./attributeFieldsForUpdate'); | ||
var _attributeFieldsForUpdate2 = _interopRequireDefault(_attributeFieldsForUpdate); | ||
var _createMutation = require('./createMutation'); | ||
var _createMutation2 = _interopRequireDefault(_createMutation); | ||
var _updateOneMutation = require('./updateOneMutation'); | ||
var _updateOneMutation2 = _interopRequireDefault(_updateOneMutation); | ||
var _destroyMutation = require('./destroyMutation'); | ||
var _destroyMutation2 = _interopRequireDefault(_destroyMutation); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
exports.associationFields = _associationFields2.default; | ||
exports.associationFields = _associationFields2.default; | ||
exports.attributeFieldsForCreate = _attributeFieldsForCreate2.default; | ||
exports.attributeFieldsForUpdate = _attributeFieldsForUpdate2.default; | ||
exports.createMutation = _createMutation2.default; | ||
exports.updateOneMutation = _updateOneMutation2.default; | ||
exports.destroyMutation = _destroyMutation2.default; |
112
package.json
@@ -1,1 +0,111 @@ | ||
{"name":"@jcoreio/graphql-sequelize-extra","version":"1.0.0","description":"some missing pieces of the graphql-sequelize bridge","main":"lib/index.js","scripts":{"lint":"eslint src test --cache","lint:fix":"eslint --fix src test --cache","lint:watch":"esw --watch src test --cache","flow":"flow","flow:coverage":"for file in src/**.js test/**.js; do echo $file; flow coverage $file; done","flow:watch":"flow-watch -e js,js.flow,flowconfig --ignore lib/ --ignore node_modules/ --watch .flowconfig --watch src/ --watch test/","build":"rimraf lib && babel src --out-dir lib && flow-copy-source -v src/ lib","test":"NODE_ENV=production BABEL_ENV=test nyc --reporter=lcov --reporter=text mocha $npm_package_config_mocha","test:watch":"mocha --watch $npm_package_config_mocha","codecov":"nyc report --reporter=text-lcov > coverage.lcov; codecov","commitmsg":"commitlint -e $GIT_PARAMS","precommit":"npm run lint && flow","prepush":"npm test","prepublish":"npm run lint && flow && npm test && npm run build","open:coverage":"open coverage/lcov-report/index.html","semantic-release":"semantic-release"},"config":{"mocha":"--compilers js:babel-core/register ./test/index.js","commitizen":{"path":"cz-conventional-changelog"}},"nyc":{"include":["src/**/*.js"],"require":["babel-register"],"sourceMap":false,"instrument":false},"repository":{"type":"git","url":"https://github.com/jcoreio/graphql-sequelize-extra.git"},"keywords":["es2015"],"author":"Andy Edwards","license":"MIT","bugs":{"url":"https://github.com/jcoreio/graphql-sequelize-extra/issues"},"homepage":"https://github.com/jcoreio/graphql-sequelize-extra#readme","devDependencies":{"@commitlint/cli":"^5.2.5","@commitlint/config-conventional":"^5.2.3","@jcoreio/condition-solano":"^1.0.0","@jedwards1211/eslint-config":"^1.0.0","@jedwards1211/eslint-config-flow":"^1.0.0","babel-cli":"^6.23.0","babel-core":"^6.23.1","babel-eslint":"^7.1.1","babel-plugin-istanbul":"^4.0.0","babel-plugin-transform-runtime":"^6.23.0","babel-preset-es2015":"^6.22.0","babel-preset-flow":"^6.23.0","babel-preset-stage-1":"^6.22.0","babel-register":"^6.23.0","babel-runtime":"^6.23.0","chai":"^3.5.0","codecov":"^2.3.0","copy":"^0.3.0","eslint":"^3.15.0","eslint-plugin-flowtype":"^2.30.0","eslint-watch":"^3.0.0","flow-bin":"^0.61.0","flow-copy-source":"^1.2.1","flow-watch":"^1.1.0","glob":"^7.1.2","graphql":"^0.12.3","graphql-relay":"^0.5.4","graphql-sequelize":"^5.6.1","husky":"^0.13.1","istanbul":"^0.4.5","lodash.mapvalues":"^4.6.0","mocha":"^3.2.0","nyc":"^10.1.2","pg":"^7.4.0","rimraf":"^2.6.0","semantic-release":"^11.0.0","sequelize":"^4.28.6"},"peerDependencies":{"graphql":"^0.12.3","graphql-sequelize":"^5.6.0","sequelize":"^4.0.0"},"publishConfig":{"access":"restricted"},"release":{"verifyConditions":["@semantic-release/npm","@semantic-release/github","@jcoreio/condition-solano"]}} | ||
{ | ||
"name": "@jcoreio/graphql-sequelize-extra", | ||
"version": "1.2.0", | ||
"description": "some missing pieces of the graphql-sequelize bridge", | ||
"main": "lib/index.js", | ||
"scripts": { | ||
"lint": "eslint src test --cache", | ||
"lint:fix": "eslint --fix src test --cache", | ||
"lint:watch": "esw --watch src test --cache", | ||
"flow": "flow", | ||
"flow:coverage": "for file in src/**.js test/**.js; do echo $file; flow coverage $file; done", | ||
"flow:watch": "flow-watch -e js,js.flow,flowconfig --ignore lib/ --ignore node_modules/ --watch .flowconfig --watch src/ --watch test/", | ||
"build": "rimraf lib && babel src --out-dir lib && flow-copy-source -v src/ lib", | ||
"test": "NODE_ENV=production BABEL_ENV=test defaultenv env/test.js nyc --reporter=lcov --reporter=text mocha $npm_package_config_mocha", | ||
"test:watch": "defaultenv env/test.js mocha --watch $npm_package_config_mocha", | ||
"codecov": "nyc report --reporter=text-lcov > coverage.lcov; codecov", | ||
"commitmsg": "commitlint -e $GIT_PARAMS", | ||
"precommit": "npm run lint && flow", | ||
"prepush": "npm test", | ||
"prepublish": "npm run lint && flow && npm test && npm run build", | ||
"open:coverage": "open coverage/lcov-report/index.html", | ||
"semantic-release": "semantic-release" | ||
}, | ||
"config": { | ||
"mocha": "-r babel-register ./test/*.js", | ||
"commitizen": { | ||
"path": "cz-conventional-changelog" | ||
} | ||
}, | ||
"nyc": { | ||
"include": [ | ||
"src/**/*.js" | ||
], | ||
"require": [ | ||
"babel-register" | ||
], | ||
"sourceMap": false, | ||
"instrument": false | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/jcoreio/graphql-sequelize-extra.git" | ||
}, | ||
"keywords": [ | ||
"es2015" | ||
], | ||
"author": "Andy Edwards", | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/jcoreio/graphql-sequelize-extra/issues" | ||
}, | ||
"homepage": "https://github.com/jcoreio/graphql-sequelize-extra#readme", | ||
"devDependencies": { | ||
"@commitlint/cli": "^5.2.5", | ||
"@commitlint/config-conventional": "^5.2.3", | ||
"@jcoreio/condition-solano": "^1.0.0", | ||
"@jcoreio/require-env": "^1.0.3", | ||
"@jedwards1211/eslint-config": "^1.0.0", | ||
"@jedwards1211/eslint-config-flow": "^1.0.0", | ||
"babel-cli": "^6.23.0", | ||
"babel-core": "^6.23.1", | ||
"babel-eslint": "^7.1.1", | ||
"babel-plugin-istanbul": "^4.0.0", | ||
"babel-plugin-transform-runtime": "^6.23.0", | ||
"babel-preset-env": "^1.6.1", | ||
"babel-preset-es2015": "^6.22.0", | ||
"babel-preset-flow": "^6.23.0", | ||
"babel-preset-stage-1": "^6.22.0", | ||
"babel-register": "^6.23.0", | ||
"babel-runtime": "^6.23.0", | ||
"chai": "^3.5.0", | ||
"codecov": "^2.3.0", | ||
"copy": "^0.3.0", | ||
"defaultenv": "^3.0.3", | ||
"es6-promisify": "^6.0.0", | ||
"eslint": "^3.15.0", | ||
"eslint-plugin-flowtype": "^2.30.0", | ||
"eslint-watch": "^3.0.0", | ||
"flow-bin": "^0.61.0", | ||
"flow-copy-source": "^1.2.1", | ||
"flow-watch": "^1.1.0", | ||
"glob": "^7.1.2", | ||
"graphql": "^0.12.3", | ||
"graphql-relay": "^0.5.4", | ||
"graphql-sequelize": "^5.6.1", | ||
"husky": "^0.13.1", | ||
"istanbul": "^0.4.5", | ||
"lodash.mapvalues": "^4.6.0", | ||
"mocha": "^3.2.0", | ||
"nyc": "^10.1.2", | ||
"pg": "^6.0.0", | ||
"rimraf": "^2.6.0", | ||
"semantic-release": "^11.0.0", | ||
"sequelize": "^4.28.6" | ||
}, | ||
"peerDependencies": { | ||
"graphql": "^0.12.3", | ||
"graphql-sequelize": "^5.6.0", | ||
"sequelize": "^4.0.0" | ||
}, | ||
"publishConfig": { | ||
"access": "restricted" | ||
}, | ||
"release": { | ||
"verifyConditions": [ | ||
"@semantic-release/npm", | ||
"@semantic-release/github", | ||
"@jcoreio/condition-solano" | ||
] | ||
} | ||
} |
@@ -16,12 +16,6 @@ // @flow | ||
type Field = { | ||
type: Object, | ||
args?: {[name: string]: any}, | ||
resolve: Function, | ||
} | ||
function associationFields( | ||
function associationFields<TSource, TContext>( | ||
model: Class<Model<any>>, | ||
options: Options, | ||
): {[name: string]: Field} { | ||
): graphql.GraphQLFieldConfigMap<TSource, TContext> { | ||
const {getType} = options | ||
@@ -31,3 +25,3 @@ const getArgs = options.getArgs || defaultArgs | ||
const result: {[name: string]: Field} = {} | ||
const result: graphql.GraphQLFieldConfigMap<TSource, TContext> = {} | ||
for (let key in model.associations) { | ||
@@ -34,0 +28,0 @@ const association = model.associations[key] |
// @flow | ||
import associationFields from './associationFields' | ||
import attributeFieldsForCreate from './attributeFieldsForCreate' | ||
import attributeFieldsForUpdate from './attributeFieldsForUpdate' | ||
import createMutation from './createMutation' | ||
import updateOneMutation from './updateOneMutation' | ||
import destroyMutation from './destroyMutation' | ||
exports.associationFields = associationFields | ||
exports.attributeFieldsForCreate = attributeFieldsForCreate | ||
exports.attributeFieldsForUpdate = attributeFieldsForUpdate | ||
exports.createMutation = createMutation | ||
exports.updateOneMutation = updateOneMutation | ||
exports.destroyMutation = destroyMutation | ||
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
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
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 8 instances in 1 package
75
13396
1
724481
41