{"id":22663172,"url":"https://github.com/puti94/graphql-adapter","last_synced_at":"2026-01-23T10:17:39.578Z","repository":{"id":57253316,"uuid":"264392424","full_name":"puti94/graphql-adapter","owner":"puti94","description":"一个基于 sequelize ORM框架自动生成 graphql schema 的库","archived":false,"fork":false,"pushed_at":"2020-07-27T13:59:31.000Z","size":1281,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-11T15:14:49.710Z","etag":null,"topics":["graphql","sequelize","typescript"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/puti94.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-05-16T08:28:15.000Z","updated_at":"2022-06-17T09:32:52.000Z","dependencies_parsed_at":"2022-08-31T22:20:13.294Z","dependency_job_id":null,"html_url":"https://github.com/puti94/graphql-adapter","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/puti94/graphql-adapter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/puti94%2Fgraphql-adapter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/puti94%2Fgraphql-adapter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/puti94%2Fgraphql-adapter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/puti94%2Fgraphql-adapter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/puti94","download_url":"https://codeload.github.com/puti94/graphql-adapter/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/puti94%2Fgraphql-adapter/sbom","scorecard":{"id":750414,"data":{"date":"2025-08-11","repo":{"name":"github.com/puti94/graphql-adapter","commit":"d7fd3223438839e25b69e8caa79f55a0cd52447a"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-22T20:10:11.485Z","repository_id":57253316,"created_at":"2025-08-22T20:10:11.486Z","updated_at":"2025-08-22T20:10:11.486Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28687439,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-23T05:48:07.525Z","status":"ssl_error","status_checked_at":"2026-01-23T05:48:07.129Z","response_time":59,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["graphql","sequelize","typescript"],"created_at":"2024-12-09T12:17:35.099Z","updated_at":"2026-01-23T10:17:39.557Z","avatar_url":"https://github.com/puti94.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# graphql-adapter \n# graphql schema 自动生成器\n\n## 安装\n```bash\n$ yarn add graphql-adapter // or npm i graphql-adapter --save\n```\n\n## 原理\n根据`orm`([sequelize](https://github.com/sequelize/sequelize))框架自动解析框架`model`的属性，添加基于`model`crud的graphql接口\n## 简单用法\n```js\nconst http = require(\"http\");\nconst {ApolloServer, PubSub} = require(\"apollo-server-express\");\nconst express = require(\"express\");\nconst {generateSchema} = require(\"../dist\");\nconst {Sequelize, DataTypes} = require(\"sequelize\");\nconst sequelize = new Sequelize({dialect: \"mysql\"});\nconst models = {\n  user: sequelize.define(\"user\", {name: DataTypes.STRING})\n};\nconst server = new ApolloServer({\n  schema: generateSchema(models, {pubSub: new PubSub()}),\n});\nconst app = express();\nserver.applyMiddleware({app});\nconst httpServer = http.createServer(app);\nserver.installSubscriptionHandlers(httpServer);\nconst PORT = 8082;\nhttpServer.listen(PORT, () =\u003e {\n  console.log(`🚀 Server ready at http://localhost:${PORT}${server.graphqlPath}`);\n  console.log(`🚀 Subscriptions ready at ws://localhost:${PORT}${server.subscriptionsPath}`);\n});\n\n```\n## 高级用法\n```js\nconst http = require(\"http\");\nconst {ApolloServer, PubSub} = require(\"apollo-server-express\");\nconst express = require(\"express\");\nconst {generateSchema} = require(\"../dist\");\nconst {sequelize, models} = require(\"./db\");\nsequelize.sync();\nconst server = new ApolloServer({\n  schema: generateSchema(models, {\n    pubSub: new PubSub(),\n    handlerFindOptions: ((action, options, fields) =\u003e {\n      console.log(\"action\", action, options, fields);\n      return options;\n    }),\n    handlerAggregateOptions: ((action, options) =\u003e {\n      console.log(\"action\", action, options);\n      return options;\n    }),\n    filterSubscription: (response) =\u003e {\n      console.log(\"Subscription\", response);\n      return true;\n    },\n    created: {\n      filter: (response) =\u003e {\n        console.log(\"created.filter\", response);\n        return true;\n      }\n    },\n    configMap: {\n      User: {\n        created: {\n          filter: (response) =\u003e {\n            console.log(\"User.created.filter\", response);\n            return true;\n          }\n        },\n      }\n    }\n  }),\n  tracing: true,\n});\nconst app = express();\nserver.applyMiddleware({app});\nconst httpServer = http.createServer(app);\nserver.installSubscriptionHandlers(httpServer);\nconst PORT = 8082;\nhttpServer.listen(PORT, () =\u003e {\n  console.log(`🚀 Server ready at http://localhost:${PORT}${server.graphqlPath}`);\n  console.log(`🚀 Subscriptions ready at ws://localhost:${PORT}${server.subscriptionsPath}`);\n});\n\n```\n## 实现接口\n### query(查询)\n- one(查找单个)\n- list(查找列表)\n- listPage(查找列表带总量)\n- aggregation(聚合接口 min | max | sum | count)    \n\n![image text](./img/query.png)\n### mutation(异变)\n- create(新建)\n- remove(删除)\n- update(更新)    \n\n![image text](./img/mutation.png)\n### subscription(监听)\n- created(新建事件)\n- removed(删除事件)\n- updated(更新事件)     \n\n![image text](./img/subscription.png)\n\n## 参考项目\n- [graphql-sequelize](https://github.com/mickhansen/graphql-sequelize)    \n- [graphql-sequelize-generator](https://github.com/teamstarter/graphql-sequelize-generator)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fputi94%2Fgraphql-adapter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fputi94%2Fgraphql-adapter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fputi94%2Fgraphql-adapter/lists"}