-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement quickadds query endpoint (#2747)
* Forward graphql requests to netlify function * Trigger Build * update lockfile * Avoid having to introspect schema for every request * Allow anonymous read only queries * Allow anonymous read only queries * Trigger Build * Add quickadds resolver * Split resolvers into separate files * Separate auth in its own file * Add jest and tests * Add script to boot local api server for development purposes * Add quickadd insert field * Add github workflows * Trigger build remove Trigger build Trigger build fsdfsf Trigger build Trigger build bigint patch use require * Update codegen tool config * Reuse mongodb client from context * Update codege * Strongly typed environment config * Increase function timeout * Update bson version * Make environment variables available to gatsby functions * Fix ts error * Trigger build * Make errors more verbose * Add missing variables * Disable env validation * Use graphql-http to prevent event emitter leaks * Enable env validation * New bson version exports ObjectId instead of ObjectID * Update lockfile * Trigger build * Remove unused query * bue * Add support for filters, sorting and pagination * Remove unused package * Remove unused file * allow api tests to be cancelled * Delete old test file * Run api tests when pushing staging * update test utils * Trigger build * Force exit to let tests exit * remove old api endpoint * Update client side queries * Udpate docs * Use vars for api and group ids * convert to import jic * Trigger build * Trigger build * Update workflows * Trigger build * Add missing variables * Fix error when object id is already serialized * Update workflow file * Improve error message * update readme * Remove unused vars * Remove unused packages * Log errors to rollbar * Trigger build * Add rollbar token variable * Trigger build * fix variable name * Trigger build * Add comment
- Loading branch information
1 parent
b1238bd
commit 03afdc3
Showing
42 changed files
with
32,358 additions
and
13,093 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
name: Run API tests | ||
on: | ||
workflow_call: | ||
inputs: | ||
environment: | ||
description: The Github environment to load secrets from | ||
type: string | ||
required: true | ||
sha: | ||
description: The commit SHA to run the tests against | ||
type: string | ||
required: true | ||
runner-label: | ||
description: The label of the runner to use | ||
type: string | ||
cache-modifier: | ||
description: A modifier for the cache key used to bypass existing cache | ||
type: string | ||
required: false | ||
default: "" | ||
|
||
jobs: | ||
test: | ||
name: Run tests | ||
environment: ${{ inputs.environment }} | ||
runs-on: | ||
labels: ${{ inputs.runner-label || 'ubuntu-latest' }} | ||
defaults: | ||
run: | ||
shell: bash | ||
working-directory: site/gatsby-site | ||
steps: | ||
|
||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ inputs.sha }} | ||
|
||
- name: Read node modules from cache | ||
id: cache-nodemodules | ||
uses: actions/cache/restore@v4 | ||
env: | ||
cache-name: cache-install-folder | ||
with: | ||
path: | | ||
site/gatsby-site/node_modules | ||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}-${{ inputs.cache-modifier }} | ||
|
||
- name: Install NPM dependencies | ||
if: steps.cache-nodemodules.outputs.cache-hit != 'true' | ||
run: npm ci | ||
working-directory: site/gatsby-site | ||
|
||
- name: Extract branch name | ||
shell: bash | ||
run: echo "branch=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_ENV | ||
id: extract_branch | ||
|
||
- name: Jest run | ||
run: npm run test:api:ci | ||
env: | ||
REALM_APP_ID: ${{ vars.GATSBY_REALM_APP_ID }} | ||
REALM_API_APP_ID: ${{ vars.REALM_API_APP_ID }} | ||
REALM_API_GROUP_ID: ${{ vars.REALM_API_GROUP_ID }} | ||
REALM_API_PUBLIC_KEY: ${{ secrets.REALM_API_PUBLIC_KEY }} | ||
REALM_API_PRIVATE_KEY: ${{ secrets.REALM_API_PRIVATE_KEY }} | ||
REALM_GRAPHQL_API_KEY: ${{ secrets.REALM_GRAPHQL_API_KEY }} | ||
MONGODB_CONNECTION_STRING: ${{ secrets.MONGODB_CONNECTION_STRING }} | ||
E2E_ADMIN_USERNAME: ${{ secrets.E2E_ADMIN_USERNAME }} | ||
E2E_ADMIN_PASSWORD: ${{ secrets.E2E_ADMIN_PASSWORD }} | ||
ROLLBAR_POST_SERVER_ITEM_ACCESS_TOKEN: ${{ secrets.GATSBY_ROLLBAR_TOKEN }} | ||
|
||
- name: Upload coverage reports to Codecov | ||
uses: codecov/codecov-action@v4 | ||
env: | ||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
|
||
import type { CodegenConfig } from '@graphql-codegen/cli'; | ||
|
||
const config: CodegenConfig = { | ||
overwrite: true, | ||
schema: ["./server/schema.ts"], | ||
require: ['ts-node/register'], | ||
generates: { | ||
"server/generated/graphql.ts": { | ||
plugins: ["typescript", "typescript-resolvers", "typescript-mongodb"] | ||
} | ||
} | ||
}; | ||
|
||
export default config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"extends": "../tsconfig.json", | ||
"compilerOptions": { | ||
"noEmit": true, | ||
// be explicit about types included | ||
// to avoid clashing with Jest types | ||
"types": [ | ||
"cypress" | ||
] | ||
}, | ||
"include": [ | ||
"../node_modules/cypress", | ||
"./**/*.ts" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { MongoMemoryServer } from 'mongodb-memory-server'; | ||
|
||
export = async function globalSetup() { | ||
|
||
const instance = await MongoMemoryServer.create(); | ||
const uri = instance.getUri(); | ||
|
||
(global as any).__MONGOINSTANCE = instance; | ||
|
||
process.env.MONGODB_CONNECTION_STRING = uri.slice(0, uri.lastIndexOf('/')); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { MongoMemoryServer } from 'mongodb-memory-server'; | ||
|
||
export = async function globalTeardown() { | ||
const instance: MongoMemoryServer = (global as any).__MONGOINSTANCE; | ||
await instance.stop(); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/** | ||
* For a detailed explanation regarding each configuration property, visit: | ||
* https://jestjs.io/docs/configuration | ||
*/ | ||
|
||
import type { Config } from 'jest'; | ||
|
||
const config: Config = { | ||
preset: "ts-jest", | ||
clearMocks: true, | ||
collectCoverage: true, | ||
coverageDirectory: "coverage", | ||
coverageProvider: "v8", | ||
testEnvironment: "node", | ||
globalSetup: "./globalSetup.ts", | ||
globalTeardown: "./globalTeardown.ts", | ||
verbose: true, | ||
}; | ||
|
||
export default config; |
Oops, something went wrong.