Merge remote-tracking branch 'upstream/main' into automated-market-resolution
This commit is contained in:
commit
bef543a7c1
|
@ -2,7 +2,9 @@
|
|||
"name": "common",
|
||||
"version": "1.0.0",
|
||||
"private": true,
|
||||
"scripts": {},
|
||||
"scripts": {
|
||||
"verify": "(cd .. && yarn verify)"
|
||||
},
|
||||
"sideEffects": false,
|
||||
"dependencies": {
|
||||
"lodash": "4.17.21"
|
||||
|
|
|
@ -15,7 +15,8 @@
|
|||
"db:update-local-from-remote": "yarn db:backup-remote && gsutil rsync -r gs://$npm_package_config_firestore/firestore_export ./firestore_export",
|
||||
"db:backup-local": "firebase emulators:export --force ./firestore_export",
|
||||
"db:rename-remote-backup-folder": "gsutil mv gs://$npm_package_config_firestore/firestore_export gs://$npm_package_config_firestore/firestore_export_$(date +%d-%m-%Y-%H-%M)",
|
||||
"db:backup-remote": "yarn db:rename-remote-backup-folder && gcloud firestore export gs://$npm_package_config_firestore/firestore_export/"
|
||||
"db:backup-remote": "yarn db:rename-remote-backup-folder && gcloud firestore export gs://$npm_package_config_firestore/firestore_export/",
|
||||
"verify": "(cd .. && yarn verify)"
|
||||
},
|
||||
"main": "lib/functions/src/index.js",
|
||||
"dependencies": {
|
||||
|
|
|
@ -137,11 +137,11 @@ export const validate = <T extends z.ZodTypeAny>(schema: T, val: unknown) => {
|
|||
|
||||
export const newEndpoint = (methods: [string], fn: Handler) =>
|
||||
functions.runWith({ minInstances: 1 }).https.onRequest(async (req, res) => {
|
||||
await applyCors(req, res, {
|
||||
origin: [CORS_ORIGIN_MANIFOLD, CORS_ORIGIN_LOCALHOST],
|
||||
methods: methods,
|
||||
})
|
||||
try {
|
||||
await applyCors(req, res, {
|
||||
origin: [CORS_ORIGIN_MANIFOLD, CORS_ORIGIN_LOCALHOST],
|
||||
methods: methods,
|
||||
})
|
||||
if (!methods.includes(req.method)) {
|
||||
const allowed = methods.join(', ')
|
||||
throw new APIError(405, `This endpoint supports only ${allowed}.`)
|
||||
|
|
11
functions/src/health.ts
Normal file
11
functions/src/health.ts
Normal file
|
@ -0,0 +1,11 @@
|
|||
import { newEndpoint } from './api'
|
||||
|
||||
export const health = newEndpoint(['GET'], async (_req, [user, _]) => {
|
||||
return {
|
||||
message: 'Server is working.',
|
||||
user: {
|
||||
id: user.id,
|
||||
username: user.username,
|
||||
},
|
||||
}
|
||||
})
|
|
@ -3,6 +3,7 @@ import * as admin from 'firebase-admin'
|
|||
admin.initializeApp()
|
||||
|
||||
// export * from './keep-awake'
|
||||
export * from './health'
|
||||
export * from './transact'
|
||||
export * from './place-bet'
|
||||
export * from './resolve-market'
|
||||
|
|
|
@ -7,7 +7,9 @@
|
|||
"functions",
|
||||
"web"
|
||||
],
|
||||
"scripts": {},
|
||||
"scripts": {
|
||||
"verify": "(cd web && npx prettier --check .; yarn lint --max-warnings 0; tsc --pretty --project tsconfig.json --noEmit); (cd common && npx eslint . --max-warnings 0); (cd functions && npx eslint . --max-warnings 0; tsc --pretty --project tsconfig.json --noEmit)"
|
||||
},
|
||||
"dependencies": {},
|
||||
"devDependencies": {
|
||||
"@typescript-eslint/eslint-plugin": "5.25.0",
|
||||
|
|
|
@ -13,7 +13,8 @@
|
|||
"start": "next start",
|
||||
"lint": "next lint",
|
||||
"format": "npx prettier --write .",
|
||||
"postbuild": "next-sitemap"
|
||||
"postbuild": "next-sitemap",
|
||||
"verify": "(cd .. && yarn verify)"
|
||||
},
|
||||
"dependencies": {
|
||||
"@headlessui/react": "1.6.1",
|
||||
|
|
Loading…
Reference in New Issue
Block a user