Make absolute imports work with functions project (#168)
* Use a silly hack to make absolute imports work with Firebase tools * Use absolute import for common module in functions code
This commit is contained in:
parent
6c9df223d8
commit
c82a56af09
|
@ -19,11 +19,13 @@
|
|||
},
|
||||
"main": "lib/functions/src/index.js",
|
||||
"dependencies": {
|
||||
"@types/module-alias": "^2.0.1",
|
||||
"fetch": "1.1.0",
|
||||
"firebase-admin": "10.0.0",
|
||||
"firebase-functions": "3.16.0",
|
||||
"lodash": "4.17.21",
|
||||
"mailgun-js": "0.22.0",
|
||||
"module-alias": "2.2.2",
|
||||
"stripe": "8.194.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
import * as functions from 'firebase-functions'
|
||||
import * as admin from 'firebase-admin'
|
||||
|
||||
import { Contract } from '../../common/contract'
|
||||
import { User } from '../../common/user'
|
||||
import { removeUndefinedProps } from '../../common/util/object'
|
||||
import { Contract } from 'common/contract'
|
||||
import { User } from 'common/user'
|
||||
import { removeUndefinedProps } from 'common/util/object'
|
||||
import { redeemShares } from './redeem-shares'
|
||||
import { getNewLiquidityProvision } from '../../common/add-liquidity'
|
||||
import { getNewLiquidityProvision } from 'common/add-liquidity'
|
||||
|
||||
export const addLiquidity = functions.runWith({ minInstances: 1 }).https.onCall(
|
||||
async (
|
||||
|
|
|
@ -2,12 +2,12 @@ import * as functions from 'firebase-functions'
|
|||
import * as admin from 'firebase-admin'
|
||||
|
||||
import { getUser } from './utils'
|
||||
import { Contract } from '../../common/contract'
|
||||
import { Comment } from '../../common/comment'
|
||||
import { User } from '../../common/user'
|
||||
import { cleanUsername } from '../../common/util/clean-username'
|
||||
import { removeUndefinedProps } from '../../common/util/object'
|
||||
import { Answer } from '../../common/answer'
|
||||
import { Contract } from 'common/contract'
|
||||
import { Comment } from 'common/comment'
|
||||
import { User } from 'common/user'
|
||||
import { cleanUsername } from 'common/util/clean-username'
|
||||
import { removeUndefinedProps } from 'common/util/object'
|
||||
import { Answer } from 'common/answer'
|
||||
|
||||
export const changeUserInfo = functions
|
||||
.runWith({ minInstances: 1 })
|
||||
|
|
|
@ -1,19 +1,14 @@
|
|||
import * as functions from 'firebase-functions'
|
||||
import * as admin from 'firebase-admin'
|
||||
|
||||
import {
|
||||
Contract,
|
||||
DPM,
|
||||
FreeResponse,
|
||||
FullContract,
|
||||
} from '../../common/contract'
|
||||
import { User } from '../../common/user'
|
||||
import { getNewMultiBetInfo } from '../../common/new-bet'
|
||||
import { Answer, MAX_ANSWER_LENGTH } from '../../common/answer'
|
||||
import { Contract, DPM, FreeResponse, FullContract } from 'common/contract'
|
||||
import { User } from 'common/user'
|
||||
import { getNewMultiBetInfo } from 'common/new-bet'
|
||||
import { Answer, MAX_ANSWER_LENGTH } from 'common/answer'
|
||||
import { getContract, getValues } from './utils'
|
||||
import { sendNewAnswerEmail } from './emails'
|
||||
import { Bet } from 'common/bet'
|
||||
import { hasUserHitManaLimit } from '../../common/calculate'
|
||||
import { hasUserHitManaLimit } from 'common/calculate'
|
||||
|
||||
export const createAnswer = functions.runWith({ minInstances: 1 }).https.onCall(
|
||||
async (
|
||||
|
|
|
@ -13,10 +13,10 @@ import {
|
|||
MAX_QUESTION_LENGTH,
|
||||
MAX_TAG_LENGTH,
|
||||
outcomeType,
|
||||
} from '../../common/contract'
|
||||
import { slugify } from '../../common/util/slugify'
|
||||
import { randomString } from '../../common/util/random'
|
||||
import { getNewContract } from '../../common/new-contract'
|
||||
} from 'common/contract'
|
||||
import { slugify } from 'common/util/slugify'
|
||||
import { randomString } from 'common/util/random'
|
||||
import { getNewContract } from 'common/new-contract'
|
||||
import {
|
||||
FIXED_ANTE,
|
||||
getAnteBets,
|
||||
|
@ -24,8 +24,8 @@ import {
|
|||
getFreeAnswerAnte,
|
||||
HOUSE_LIQUIDITY_PROVIDER_ID,
|
||||
MINIMUM_ANTE,
|
||||
} from '../../common/antes'
|
||||
import { getNoneAnswer } from '../../common/answer'
|
||||
} from 'common/antes'
|
||||
import { getNoneAnswer } from 'common/answer'
|
||||
|
||||
export const createContract = functions
|
||||
.runWith({ minInstances: 1 })
|
||||
|
|
|
@ -3,10 +3,10 @@ import * as admin from 'firebase-admin'
|
|||
import * as _ from 'lodash'
|
||||
|
||||
import { getUser } from './utils'
|
||||
import { Contract } from '../../common/contract'
|
||||
import { slugify } from '../../common/util/slugify'
|
||||
import { randomString } from '../../common/util/random'
|
||||
import { Fold } from '../../common/fold'
|
||||
import { Contract } from 'common/contract'
|
||||
import { slugify } from 'common/util/slugify'
|
||||
import { randomString } from 'common/util/random'
|
||||
import { Fold } from 'common/fold'
|
||||
|
||||
export const createFold = functions.runWith({ minInstances: 1 }).https.onCall(
|
||||
async (
|
||||
|
|
|
@ -6,15 +6,12 @@ import {
|
|||
STARTING_BALANCE,
|
||||
SUS_STARTING_BALANCE,
|
||||
User,
|
||||
} from '../../common/user'
|
||||
} from 'common/user'
|
||||
import { getUser, getUserByUsername } from './utils'
|
||||
import { randomString } from '../../common/util/random'
|
||||
import {
|
||||
cleanDisplayName,
|
||||
cleanUsername,
|
||||
} from '../../common/util/clean-username'
|
||||
import { randomString } from 'common/util/random'
|
||||
import { cleanDisplayName, cleanUsername } from 'common/util/clean-username'
|
||||
import { sendWelcomeEmail } from './emails'
|
||||
import { isWhitelisted } from '../../common/envs/constants'
|
||||
import { isWhitelisted } from 'common/envs/constants'
|
||||
|
||||
export const createUser = functions
|
||||
.runWith({ minInstances: 1 })
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
import * as _ from 'lodash'
|
||||
|
||||
import { DOMAIN, PROJECT_ID } from '../../common/envs/constants'
|
||||
import { Answer } from '../../common/answer'
|
||||
import { Bet } from '../../common/bet'
|
||||
import { getProbability } from '../../common/calculate'
|
||||
import { Comment } from '../../common/comment'
|
||||
import { Contract, FreeResponseContract } from '../../common/contract'
|
||||
import { DPM_CREATOR_FEE } from '../../common/fees'
|
||||
import { PrivateUser, User } from '../../common/user'
|
||||
import { formatMoney, formatPercent } from '../../common/util/format'
|
||||
import { DOMAIN, PROJECT_ID } from 'common/envs/constants'
|
||||
import { Answer } from 'common/answer'
|
||||
import { Bet } from 'common/bet'
|
||||
import { getProbability } from 'common/calculate'
|
||||
import { Comment } from 'common/comment'
|
||||
import { Contract, FreeResponseContract } from 'common/contract'
|
||||
import { DPM_CREATOR_FEE } from 'common/fees'
|
||||
import { PrivateUser, User } from 'common/user'
|
||||
import { formatMoney, formatPercent } from 'common/util/format'
|
||||
import { sendTemplateEmail, sendTextEmail } from './send-email'
|
||||
import { getPrivateUser, getUser } from './utils'
|
||||
|
||||
|
|
|
@ -1,5 +1,19 @@
|
|||
import * as admin from 'firebase-admin'
|
||||
/* This use of module-alias hackily simulates the Typescript base URL so that
|
||||
* the Firebase deploy machinery, which just uses the compiled Javascript in the
|
||||
* lib directory, will be able to do imports from the root directory
|
||||
* (i.e. "common/foo" instead of "../../../common/foo") just like we can in
|
||||
* Typescript-land.
|
||||
*
|
||||
* Note that per the module-alias docs, this need to come before any other
|
||||
* imports in order to work.
|
||||
*
|
||||
* Suggested by https://github.com/firebase/firebase-tools/issues/986 where many
|
||||
* people complain about this problem.
|
||||
*/
|
||||
import { addPath } from 'module-alias'
|
||||
addPath('./lib')
|
||||
|
||||
import * as admin from 'firebase-admin'
|
||||
admin.initializeApp()
|
||||
|
||||
// export * from './keep-awake'
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import * as functions from 'firebase-functions'
|
||||
import * as admin from 'firebase-admin'
|
||||
|
||||
import { Contract } from '../../common/contract'
|
||||
import { Contract } from 'common/contract'
|
||||
import { getPrivateUser, getUserByUsername } from './utils'
|
||||
import { sendMarketCloseEmail } from './emails'
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ import * as admin from 'firebase-admin'
|
|||
import * as _ from 'lodash'
|
||||
|
||||
import { getContract } from './utils'
|
||||
import { Bet } from '../../common/bet'
|
||||
import { Bet } from 'common/bet'
|
||||
|
||||
const firestore = admin.firestore()
|
||||
|
||||
|
|
|
@ -3,10 +3,10 @@ import * as admin from 'firebase-admin'
|
|||
import * as _ from 'lodash'
|
||||
|
||||
import { getContract, getUser, getValues } from './utils'
|
||||
import { Comment } from '../../common/comment'
|
||||
import { Comment } from 'common/comment'
|
||||
import { sendNewCommentEmail } from './emails'
|
||||
import { Bet } from '../../common/bet'
|
||||
import { Answer } from '../../common/answer'
|
||||
import { Bet } from 'common/bet'
|
||||
import { Answer } from 'common/answer'
|
||||
|
||||
const firestore = admin.firestore()
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import * as functions from 'firebase-functions'
|
||||
import * as admin from 'firebase-admin'
|
||||
import { View } from '../../common/tracking'
|
||||
import { View } from 'common/tracking'
|
||||
|
||||
const firestore = admin.firestore()
|
||||
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
import * as functions from 'firebase-functions'
|
||||
import * as admin from 'firebase-admin'
|
||||
|
||||
import { Contract } from '../../common/contract'
|
||||
import { User } from '../../common/user'
|
||||
import { Contract } from 'common/contract'
|
||||
import { User } from 'common/user'
|
||||
import {
|
||||
getNewBinaryCpmmBetInfo,
|
||||
getNewBinaryDpmBetInfo,
|
||||
getNewMultiBetInfo,
|
||||
} from '../../common/new-bet'
|
||||
import { addObjects, removeUndefinedProps } from '../../common/util/object'
|
||||
import { Bet } from '../../common/bet'
|
||||
} from 'common/new-bet'
|
||||
import { addObjects, removeUndefinedProps } from 'common/util/object'
|
||||
import { Bet } from 'common/bet'
|
||||
import { redeemShares } from './redeem-shares'
|
||||
import { Fees } from '../../common/fees'
|
||||
import { hasUserHitManaLimit } from '../../common/calculate'
|
||||
import { Fees } from 'common/fees'
|
||||
import { hasUserHitManaLimit } from 'common/calculate'
|
||||
|
||||
export const placeBet = functions.runWith({ minInstances: 1 }).https.onCall(
|
||||
async (
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
import * as admin from 'firebase-admin'
|
||||
import * as _ from 'lodash'
|
||||
|
||||
import { Bet } from '../../common/bet'
|
||||
import { getProbability } from '../../common/calculate'
|
||||
import { Bet } from 'common/bet'
|
||||
import { getProbability } from 'common/calculate'
|
||||
|
||||
import { Binary, CPMM, FullContract } from '../../common/contract'
|
||||
import { noFees } from '../../common/fees'
|
||||
import { User } from '../../common/user'
|
||||
import { Binary, CPMM, FullContract } from 'common/contract'
|
||||
import { noFees } from 'common/fees'
|
||||
import { User } from 'common/user'
|
||||
|
||||
export const redeemShares = async (userId: string, contractId: string) => {
|
||||
return await firestore.runTransaction(async (transaction) => {
|
||||
|
|
|
@ -2,9 +2,9 @@ import * as functions from 'firebase-functions'
|
|||
import * as admin from 'firebase-admin'
|
||||
import * as _ from 'lodash'
|
||||
|
||||
import { Contract } from '../../common/contract'
|
||||
import { User } from '../../common/user'
|
||||
import { Bet } from '../../common/bet'
|
||||
import { Contract } from 'common/contract'
|
||||
import { User } from 'common/user'
|
||||
import { Bet } from 'common/bet'
|
||||
import { getUser, isProd, payUser } from './utils'
|
||||
import { sendMarketResolutionEmail } from './emails'
|
||||
import {
|
||||
|
@ -12,9 +12,9 @@ import {
|
|||
getPayouts,
|
||||
groupPayoutsByUser,
|
||||
Payout,
|
||||
} from '../../common/payouts'
|
||||
import { removeUndefinedProps } from '../../common/util/object'
|
||||
import { LiquidityProvision } from '../../common/liquidity-provision'
|
||||
} from 'common/payouts'
|
||||
import { removeUndefinedProps } from 'common/util/object'
|
||||
import { LiquidityProvision } from 'common/liquidity-provision'
|
||||
|
||||
export const resolveMarket = functions
|
||||
.runWith({ minInstances: 1 })
|
||||
|
|
|
@ -5,9 +5,9 @@ import { initAdmin } from './script-init'
|
|||
initAdmin()
|
||||
|
||||
import { getValues } from '../utils'
|
||||
import { View } from '../../../common/tracking'
|
||||
import { User } from '../../../common/user'
|
||||
import { batchedWaitAll } from '../../../common/util/promise'
|
||||
import { View } from 'common/tracking'
|
||||
import { User } from 'common/user'
|
||||
import { batchedWaitAll } from 'common/util/promise'
|
||||
|
||||
const firestore = admin.firestore()
|
||||
|
||||
|
|
|
@ -4,9 +4,9 @@ import * as _ from 'lodash'
|
|||
import { initAdmin } from './script-init'
|
||||
initAdmin()
|
||||
|
||||
import { Bet } from '../../../common/bet'
|
||||
import { getDpmProbability } from '../../../common/calculate-dpm'
|
||||
import { Binary, Contract, DPM, FullContract } from '../../../common/contract'
|
||||
import { Bet } from 'common/bet'
|
||||
import { getDpmProbability } from 'common/calculate-dpm'
|
||||
import { Binary, Contract, DPM, FullContract } from 'common/contract'
|
||||
|
||||
type DocRef = admin.firestore.DocumentReference
|
||||
const firestore = admin.firestore()
|
||||
|
|
|
@ -4,7 +4,7 @@ import * as _ from 'lodash'
|
|||
import { initAdmin } from './script-init'
|
||||
initAdmin()
|
||||
|
||||
import { PrivateUser, STARTING_BALANCE, User } from '../../../common/user'
|
||||
import { PrivateUser, STARTING_BALANCE, User } from 'common/user'
|
||||
|
||||
const firestore = admin.firestore()
|
||||
|
||||
|
|
|
@ -5,10 +5,10 @@ import * as fs from 'fs'
|
|||
import { initAdmin } from './script-init'
|
||||
initAdmin()
|
||||
|
||||
import { Bet } from '../../../common/bet'
|
||||
import { Contract } from '../../../common/contract'
|
||||
import { Bet } from 'common/bet'
|
||||
import { Contract } from 'common/contract'
|
||||
import { getValues } from '../utils'
|
||||
import { Comment } from '../../../common/comment'
|
||||
import { Comment } from 'common/comment'
|
||||
|
||||
const firestore = admin.firestore()
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ import { initAdmin } from './script-init'
|
|||
initAdmin()
|
||||
|
||||
import { getValues } from '../utils'
|
||||
import { Fold } from '../../../common/fold'
|
||||
import { Fold } from 'common/fold'
|
||||
|
||||
async function lowercaseFoldTags() {
|
||||
const firestore = admin.firestore()
|
||||
|
|
|
@ -4,7 +4,7 @@ import * as _ from 'lodash'
|
|||
import { initAdmin } from './script-init'
|
||||
initAdmin()
|
||||
|
||||
import { Contract } from '../../../common/contract'
|
||||
import { Contract } from 'common/contract'
|
||||
|
||||
const firestore = admin.firestore()
|
||||
|
||||
|
|
|
@ -4,8 +4,8 @@ import * as _ from 'lodash'
|
|||
import { initAdmin } from './script-init'
|
||||
initAdmin()
|
||||
|
||||
import { Bet } from '../../../common/bet'
|
||||
import { Contract } from '../../../common/contract'
|
||||
import { Bet } from 'common/bet'
|
||||
import { Contract } from 'common/contract'
|
||||
|
||||
type DocRef = admin.firestore.DocumentReference
|
||||
|
||||
|
|
|
@ -4,22 +4,13 @@ import * as _ from 'lodash'
|
|||
import { initAdmin } from './script-init'
|
||||
initAdmin()
|
||||
|
||||
import {
|
||||
Binary,
|
||||
Contract,
|
||||
CPMM,
|
||||
DPM,
|
||||
FullContract,
|
||||
} from '../../../common/contract'
|
||||
import { Bet } from '../../../common/bet'
|
||||
import {
|
||||
calculateDpmPayout,
|
||||
getDpmProbability,
|
||||
} from '../../../common/calculate-dpm'
|
||||
import { User } from '../../../common/user'
|
||||
import { getCpmmInitialLiquidity } from '../../../common/antes'
|
||||
import { noFees } from '../../../common/fees'
|
||||
import { addObjects } from '../../../common/util/object'
|
||||
import { Binary, Contract, CPMM, DPM, FullContract } from 'common/contract'
|
||||
import { Bet } from 'common/bet'
|
||||
import { calculateDpmPayout, getDpmProbability } from 'common/calculate-dpm'
|
||||
import { User } from 'common/user'
|
||||
import { getCpmmInitialLiquidity } from 'common/antes'
|
||||
import { noFees } from 'common/fees'
|
||||
import { addObjects } from 'common/util/object'
|
||||
|
||||
type DocRef = admin.firestore.DocumentReference
|
||||
|
||||
|
|
|
@ -4,14 +4,11 @@ import * as _ from 'lodash'
|
|||
import { initAdmin } from './script-init'
|
||||
initAdmin()
|
||||
|
||||
import { Binary, Contract, DPM, FullContract } from '../../../common/contract'
|
||||
import { Bet } from '../../../common/bet'
|
||||
import {
|
||||
calculateDpmShares,
|
||||
getDpmProbability,
|
||||
} from '../../../common/calculate-dpm'
|
||||
import { getSellBetInfo } from '../../../common/sell-bet'
|
||||
import { User } from '../../../common/user'
|
||||
import { Binary, Contract, DPM, FullContract } from 'common/contract'
|
||||
import { Bet } from 'common/bet'
|
||||
import { calculateDpmShares, getDpmProbability } from 'common/calculate-dpm'
|
||||
import { getSellBetInfo } from 'common/sell-bet'
|
||||
import { User } from 'common/user'
|
||||
|
||||
type DocRef = admin.firestore.DocumentReference
|
||||
|
||||
|
|
|
@ -4,10 +4,10 @@ import * as _ from 'lodash'
|
|||
import { initAdmin } from './script-init'
|
||||
initAdmin()
|
||||
|
||||
import { Bet } from '../../../common/bet'
|
||||
import { Contract } from '../../../common/contract'
|
||||
import { getLoanPayouts, getPayouts } from '../../../common/payouts'
|
||||
import { filterDefined } from '../../../common/util/array'
|
||||
import { Bet } from 'common/bet'
|
||||
import { Contract } from 'common/contract'
|
||||
import { getLoanPayouts, getPayouts } from 'common/payouts'
|
||||
import { filterDefined } from 'common/util/array'
|
||||
|
||||
type DocRef = admin.firestore.DocumentReference
|
||||
|
||||
|
|
|
@ -4,8 +4,8 @@ import * as _ from 'lodash'
|
|||
import { initAdmin } from './script-init'
|
||||
initAdmin()
|
||||
|
||||
import { Bet } from '../../../common/bet'
|
||||
import { Contract } from '../../../common/contract'
|
||||
import { Bet } from 'common/bet'
|
||||
import { Contract } from 'common/contract'
|
||||
|
||||
type DocRef = admin.firestore.DocumentReference
|
||||
|
||||
|
|
|
@ -4,8 +4,8 @@ import * as _ from 'lodash'
|
|||
import { initAdmin } from './script-init'
|
||||
initAdmin()
|
||||
|
||||
import { Bet } from '../../../common/bet'
|
||||
import { Contract } from '../../../common/contract'
|
||||
import { Bet } from 'common/bet'
|
||||
import { Contract } from 'common/contract'
|
||||
import { getValues } from '../utils'
|
||||
|
||||
async function removeAnswerAnte() {
|
||||
|
|
|
@ -4,7 +4,7 @@ import * as _ from 'lodash'
|
|||
import { initAdmin } from './script-init'
|
||||
initAdmin()
|
||||
|
||||
import { Contract } from '../../../common/contract'
|
||||
import { Contract } from 'common/contract'
|
||||
import { getValues } from '../utils'
|
||||
|
||||
const firestore = admin.firestore()
|
||||
|
|
|
@ -4,8 +4,8 @@ import * as _ from 'lodash'
|
|||
import { initAdmin } from './script-init'
|
||||
initAdmin()
|
||||
|
||||
import { Contract } from '../../../common/contract'
|
||||
import { parseTags } from '../../../common/util/parse'
|
||||
import { Contract } from 'common/contract'
|
||||
import { parseTags } from 'common/util/parse'
|
||||
import { getValues } from '../utils'
|
||||
|
||||
async function updateContractTags() {
|
||||
|
|
|
@ -5,9 +5,9 @@ import { initAdmin } from './script-init'
|
|||
initAdmin()
|
||||
|
||||
import { getValues } from '../utils'
|
||||
import { User } from '../../../common/user'
|
||||
import { batchedWaitAll } from '../../../common/util/promise'
|
||||
import { Contract } from '../../../common/contract'
|
||||
import { User } from 'common/user'
|
||||
import { batchedWaitAll } from 'common/util/promise'
|
||||
import { Contract } from 'common/contract'
|
||||
import { updateWordScores } from '../update-recommendations'
|
||||
import { getFeedContracts, doUserFeedUpdate } from '../update-feed'
|
||||
|
||||
|
|
|
@ -4,9 +4,9 @@ import * as _ from 'lodash'
|
|||
import { initAdmin } from './script-init'
|
||||
initAdmin()
|
||||
|
||||
import { Contract } from '../../../common/contract'
|
||||
import { Contract } from 'common/contract'
|
||||
import { getValues } from '../utils'
|
||||
import { Comment } from '../../../common/comment'
|
||||
import { Comment } from 'common/comment'
|
||||
|
||||
async function updateLastCommentTime() {
|
||||
const firestore = admin.firestore()
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
import * as admin from 'firebase-admin'
|
||||
import * as functions from 'firebase-functions'
|
||||
|
||||
import { Contract } from '../../common/contract'
|
||||
import { User } from '../../common/user'
|
||||
import { Bet } from '../../common/bet'
|
||||
import { getSellBetInfo } from '../../common/sell-bet'
|
||||
import { addObjects, removeUndefinedProps } from '../../common/util/object'
|
||||
import { Fees } from '../../common/fees'
|
||||
import { Contract } from 'common/contract'
|
||||
import { User } from 'common/user'
|
||||
import { Bet } from 'common/bet'
|
||||
import { getSellBetInfo } from 'common/sell-bet'
|
||||
import { addObjects, removeUndefinedProps } from 'common/util/object'
|
||||
import { Fees } from 'common/fees'
|
||||
|
||||
export const sellBet = functions.runWith({ minInstances: 1 }).https.onCall(
|
||||
async (
|
||||
|
|
|
@ -2,12 +2,12 @@ import * as _ from 'lodash'
|
|||
import * as admin from 'firebase-admin'
|
||||
import * as functions from 'firebase-functions'
|
||||
|
||||
import { Binary, CPMM, FullContract } from '../../common/contract'
|
||||
import { User } from '../../common/user'
|
||||
import { getCpmmSellBetInfo } from '../../common/sell-bet'
|
||||
import { addObjects, removeUndefinedProps } from '../../common/util/object'
|
||||
import { Binary, CPMM, FullContract } from 'common/contract'
|
||||
import { User } from 'common/user'
|
||||
import { getCpmmSellBetInfo } from 'common/sell-bet'
|
||||
import { addObjects, removeUndefinedProps } from 'common/util/object'
|
||||
import { getValues } from './utils'
|
||||
import { Bet } from '../../common/bet'
|
||||
import { Bet } from 'common/bet'
|
||||
|
||||
export const sellShares = functions.runWith({ minInstances: 1 }).https.onCall(
|
||||
async (
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import * as functions from 'firebase-functions'
|
||||
import * as admin from 'firebase-admin'
|
||||
|
||||
import { User } from '../../common/user'
|
||||
import { Txn } from '../../common/txn'
|
||||
import { removeUndefinedProps } from '../../common/util/object'
|
||||
import { User } from 'common/user'
|
||||
import { Txn } from 'common/txn'
|
||||
import { removeUndefinedProps } from 'common/util/object'
|
||||
|
||||
export const transact = functions
|
||||
.runWith({ minInstances: 1 })
|
||||
|
|
|
@ -2,7 +2,7 @@ import * as functions from 'firebase-functions'
|
|||
import * as admin from 'firebase-admin'
|
||||
import * as _ from 'lodash'
|
||||
import { getUser } from './utils'
|
||||
import { PrivateUser } from '../../common/user'
|
||||
import { PrivateUser } from 'common/user'
|
||||
|
||||
export const unsubscribe = functions
|
||||
.runWith({ minInstances: 1 })
|
||||
|
|
|
@ -3,9 +3,9 @@ import * as admin from 'firebase-admin'
|
|||
import * as _ from 'lodash'
|
||||
|
||||
import { getValues } from './utils'
|
||||
import { Contract } from '../../common/contract'
|
||||
import { Bet } from '../../common/bet'
|
||||
import { batchedWaitAll } from '../../common/util/promise'
|
||||
import { Contract } from 'common/contract'
|
||||
import { Bet } from 'common/bet'
|
||||
import { batchedWaitAll } from 'common/util/promise'
|
||||
|
||||
const firestore = admin.firestore()
|
||||
|
||||
|
|
|
@ -3,21 +3,21 @@ import * as functions from 'firebase-functions'
|
|||
import * as admin from 'firebase-admin'
|
||||
|
||||
import { getValue, getValues } from './utils'
|
||||
import { Contract } from '../../common/contract'
|
||||
import { logInterpolation } from '../../common/util/math'
|
||||
import { DAY_MS } from '../../common/util/time'
|
||||
import { Contract } from 'common/contract'
|
||||
import { logInterpolation } from 'common/util/math'
|
||||
import { DAY_MS } from 'common/util/time'
|
||||
import {
|
||||
getProbability,
|
||||
getOutcomeProbability,
|
||||
getTopAnswer,
|
||||
} from '../../common/calculate'
|
||||
import { Bet } from '../../common/bet'
|
||||
import { Comment } from '../../common/comment'
|
||||
import { User } from '../../common/user'
|
||||
} from 'common/calculate'
|
||||
import { Bet } from 'common/bet'
|
||||
import { Comment } from 'common/comment'
|
||||
import { User } from 'common/user'
|
||||
import {
|
||||
getContractScore,
|
||||
MAX_FEED_CONTRACTS,
|
||||
} from '../../common/recommended-contracts'
|
||||
} from 'common/recommended-contracts'
|
||||
import { callCloudFunction } from './call-cloud-function'
|
||||
|
||||
const firestore = admin.firestore()
|
||||
|
|
|
@ -3,12 +3,12 @@ import * as admin from 'firebase-admin'
|
|||
import * as _ from 'lodash'
|
||||
|
||||
import { getValue, getValues } from './utils'
|
||||
import { Contract } from '../../common/contract'
|
||||
import { Bet } from '../../common/bet'
|
||||
import { User } from '../../common/user'
|
||||
import { ClickEvent } from '../../common/tracking'
|
||||
import { getWordScores } from '../../common/recommended-contracts'
|
||||
import { batchedWaitAll } from '../../common/util/promise'
|
||||
import { Contract } from 'common/contract'
|
||||
import { Bet } from 'common/bet'
|
||||
import { User } from 'common/user'
|
||||
import { ClickEvent } from 'common/tracking'
|
||||
import { getWordScores } from 'common/recommended-contracts'
|
||||
import { batchedWaitAll } from 'common/util/promise'
|
||||
import { callCloudFunction } from './call-cloud-function'
|
||||
|
||||
const firestore = admin.firestore()
|
||||
|
|
|
@ -3,11 +3,11 @@ import * as admin from 'firebase-admin'
|
|||
import * as _ from 'lodash'
|
||||
|
||||
import { getValues } from './utils'
|
||||
import { Contract } from '../../common/contract'
|
||||
import { Bet } from '../../common/bet'
|
||||
import { User } from '../../common/user'
|
||||
import { batchedWaitAll } from '../../common/util/promise'
|
||||
import { calculatePayout } from '../../common/calculate'
|
||||
import { Contract } from 'common/contract'
|
||||
import { Bet } from 'common/bet'
|
||||
import { User } from 'common/user'
|
||||
import { batchedWaitAll } from 'common/util/promise'
|
||||
import { calculatePayout } from 'common/calculate'
|
||||
|
||||
const firestore = admin.firestore()
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import * as admin from 'firebase-admin'
|
||||
|
||||
import { Contract } from '../../common/contract'
|
||||
import { PrivateUser, User } from '../../common/user'
|
||||
import { Contract } from 'common/contract'
|
||||
import { PrivateUser, User } from 'common/user'
|
||||
|
||||
export const isProd =
|
||||
admin.instanceId().app.options.projectId === 'mantic-markets'
|
||||
|
|
10
yarn.lock
10
yarn.lock
|
@ -1140,6 +1140,11 @@
|
|||
resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-3.0.5.tgz#1001cc5e6a3704b83c236027e77f2f58ea010f40"
|
||||
integrity sha512-Klz949h02Gz2uZCMGwDUSDS1YBlTdDDgbWHi+81l29tQALUtvz4rAYi5uoVhE5Lagoq6DeqAUlbrHvW/mXDgdQ==
|
||||
|
||||
"@types/module-alias@^2.0.1":
|
||||
version "2.0.1"
|
||||
resolved "https://registry.yarnpkg.com/@types/module-alias/-/module-alias-2.0.1.tgz#e5893236ce922152d57c5f3f978f764f4deeb45f"
|
||||
integrity sha512-DN/CCT1HQG6HquBNJdLkvV+4v5l/oEuwOHUPLxI+Eub0NED+lk0YUfba04WGH90EINiUrNgClkNnwGmbICeWMQ==
|
||||
|
||||
"@types/node@*", "@types/node@>=12.12.47", "@types/node@>=13.7.0", "@types/node@>=8.1.0":
|
||||
version "17.0.14"
|
||||
resolved "https://registry.yarnpkg.com/@types/node/-/node-17.0.14.tgz#33b9b94f789a8fedd30a68efdbca4dbb06b61f20"
|
||||
|
@ -3916,6 +3921,11 @@ mkdirp@0.3.0:
|
|||
resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.3.0.tgz#1bbf5ab1ba827af23575143490426455f481fe1e"
|
||||
integrity sha1-G79asbqCevI1dRQ0kEJkVfSB/h4=
|
||||
|
||||
module-alias@2.2.2:
|
||||
version "2.2.2"
|
||||
resolved "https://registry.yarnpkg.com/module-alias/-/module-alias-2.2.2.tgz#151cdcecc24e25739ff0aa6e51e1c5716974c0e0"
|
||||
integrity sha512-A/78XjoX2EmNvppVWEhM2oGk3x4lLxnkEA4jTbaK97QKSDjkIoOsKQlfylt/d3kKKi596Qy3NP5XrXJ6fZIC9Q==
|
||||
|
||||
mri@^1.1.5:
|
||||
version "1.2.0"
|
||||
resolved "https://registry.yarnpkg.com/mri/-/mri-1.2.0.tgz#6721480fec2a11a4889861115a48b6cbe7cc8f0b"
|
||||
|
|
Loading…
Reference in New Issue
Block a user