{"id":20974703,"url":"https://github.com/thatconference/that-api","last_synced_at":"2025-05-14T13:32:00.617Z","repository":{"id":36784621,"uuid":"229796604","full_name":"ThatConference/that-api","owner":"ThatConference","description":"Shared component library for the api microservices.","archived":false,"fork":false,"pushed_at":"2024-07-24T22:53:49.000Z","size":2505,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-02T18:50:16.444Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ThatConference.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-12-23T17:32:54.000Z","updated_at":"2024-07-24T22:53:52.000Z","dependencies_parsed_at":"2023-11-13T20:29:20.843Z","dependency_job_id":"3bcb8861-d40e-4d8a-b531-4647ac8c6b09","html_url":"https://github.com/ThatConference/that-api","commit_stats":null,"previous_names":[],"tags_count":63,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ThatConference%2Fthat-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ThatConference%2Fthat-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ThatConference%2Fthat-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ThatConference%2Fthat-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ThatConference","download_url":"https://codeload.github.com/ThatConference/that-api/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254150543,"owners_count":22022976,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":[],"created_at":"2024-11-19T04:32:25.069Z","updated_at":"2025-05-14T13:31:59.520Z","avatar_url":"https://github.com/ThatConference.png","language":"JavaScript","readme":"# that-api\n\n\u003e **Warning**: This is v4 of `that-api`. It's intended use is with Apollo server version 4. It is not compatible with Apollo server v2 or v3. V2 of this library is [here](https://github.com/ThatConference/that-api/tree/v2) and v3 is [here](https://github.com/ThatConference/that-api/tree/v3) ⚠\n\nShared component library for the api microservices.\n\nAvailable as an npm package: `@thatconference/api`\n\n## Development guidelines\n\n- After initial clone of repository run:\n  - npm i\n  - npx husky install\n\n`husky install` is put under npm:prepare by default, though it causes many issues with this babel generated product when publishing, etc. For now it has to be manual. Putting `husky install` under npm:postinstall, doesn't work as it will try to run when the package is installed in a project.\n\nModule `graphql` is now defined as a peerDependency and not installed 'dependency' of this module. Due to this the **Basic local testing** below isn't currently working. \n\n`graphql`\n\n## Basic local testing\n\nUse npm linking to test locally with this package.\n\nStarting with that-api directory\n\n```sh\ncd that-api\nnpm run validate\nnpm run build\ncd __build__\nnpm link\ncd ..\nnpm run dev\n```\n\nNow at the api project e.g. that-api-members\n\n```sh\ncd that-api-members\nnpm run validate\nnpm link @thatconference/api\nnpm run validate\nnpm run start:watch\n```\n\nAt this point the that-api-members project is running using the linked that-api package, not the one downloaded into its node_modules folder.\n\nSo to undo this. I am not 100% sure this is correct, but it seems to work.\n\nUnlink the the package from that-api-members.\n\n```sh\n^c\ncd ~/tc/that-api-members\nnpm unlink @thatconference/api\nnpm i @thatconference/api\n```\n\nStop the running code and unlink to remove the link from npm which removes it from global location `{prefix}/lib/node_modules/\u003cpackage\u003e`\n\n```sh\n^c\ncd ~/tc/that-api/\nnpm unlink\ncd ..\n```\n\nWhen you unlink a package it removes it from packages.json, so we need to then add it back. This is why we removed the global link first so we could install and get the package, not the link.\n\n## Publishing new versions\n\n1. ENSURE `package.json` version is updated to new semver value!\n1. Create a release in GitHub using `v` + semver value as tag (e.g. `v1.7.0`)\n   - **Add release notes and changes made to this version**\n1. From local command line at same tag point run `$ npm run npm:publish`\n   - version is published to npmjs.com\n\n## Contains shared stuff for API's\n\n### Data Sources\n\n- assets\n- events\n- favorites\n- history\n- member\n- product\n- slug\n\n### Utility\n\n- firestoreDateForge\n- getValueAtPath\n\n### API Constants\n\nShard constants used across the api. The constants are in JavaScript object form.\n\n### GraphQL\n\n#### Directives\n\n- auth\n- lowerCase\n- upperCase\n\n**v3** requires a different way to map directives to your schema. The directive returns a `transformer` function which you pass the schema into and get an updated schema back.\n\n```js\nconst schema = authDirectiveTransformer(\n   buildSubgraphSchema([{typeDefs, resolvers}]);\n)\n```\n\nFor multiple directives use a reduce like so\n\n```js\nlet schema = buildSubgraphSchema([{ typeDefs, resolvers }]);\nconst directiveTransformers = [authDirectiveTransformer, lowerCaseDirectiveTransformer];\n\nschema = directiveTransformers.reduce((curSchema, transformer) =\u003e transformer(schema), schema)\n```\n\n**GraphQl schema** for directives\n\n```graphql\ndirective @auth(requires: String!) on OBJECT | FIELD_DEFINITION\ndirective @lowerCase on FIELD_DEFINITION\ndirective @upperCase on FIELD_DEFINITION\n```\n\n#### Events\n\n- lifecycle (_currently removed w/ InFluxdb_)\n\n#### Middleware\n\n- requestLogger (_currently removed w/ InFluxdb_)\n\n#### Scalars\n\n- date\n- slug\n\n#### Mentions\n\n- parseToSlug\n- parseToToken\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthatconference%2Fthat-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthatconference%2Fthat-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthatconference%2Fthat-api/lists"}