Revert "Make absolute imports work with functions project (#168)"
This reverts commit c82a56af09
.
This commit is contained in:
parent
92aa56ba20
commit
ab8d541f8d
|
@ -1,11 +1,11 @@
|
||||||
import * as functions from 'firebase-functions'
|
import * as functions from 'firebase-functions'
|
||||||
import * as admin from 'firebase-admin'
|
import * as admin from 'firebase-admin'
|
||||||
|
|
||||||
import { Contract } from 'common/contract'
|
import { Contract } from '../../common/contract'
|
||||||
import { User } from 'common/user'
|
import { User } from '../../common/user'
|
||||||
import { removeUndefinedProps } from 'common/util/object'
|
import { removeUndefinedProps } from '../../common/util/object'
|
||||||
import { redeemShares } from './redeem-shares'
|
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(
|
export const addLiquidity = functions.runWith({ minInstances: 1 }).https.onCall(
|
||||||
async (
|
async (
|
||||||
|
|
|
@ -2,12 +2,12 @@ import * as functions from 'firebase-functions'
|
||||||
import * as admin from 'firebase-admin'
|
import * as admin from 'firebase-admin'
|
||||||
|
|
||||||
import { getUser } from './utils'
|
import { getUser } from './utils'
|
||||||
import { Contract } from 'common/contract'
|
import { Contract } from '../../common/contract'
|
||||||
import { Comment } from 'common/comment'
|
import { Comment } from '../../common/comment'
|
||||||
import { User } from 'common/user'
|
import { User } from '../../common/user'
|
||||||
import { cleanUsername } from 'common/util/clean-username'
|
import { cleanUsername } from '../../common/util/clean-username'
|
||||||
import { removeUndefinedProps } from 'common/util/object'
|
import { removeUndefinedProps } from '../../common/util/object'
|
||||||
import { Answer } from 'common/answer'
|
import { Answer } from '../../common/answer'
|
||||||
|
|
||||||
export const changeUserInfo = functions
|
export const changeUserInfo = functions
|
||||||
.runWith({ minInstances: 1 })
|
.runWith({ minInstances: 1 })
|
||||||
|
|
|
@ -1,10 +1,15 @@
|
||||||
import * as functions from 'firebase-functions'
|
import * as functions from 'firebase-functions'
|
||||||
import * as admin from 'firebase-admin'
|
import * as admin from 'firebase-admin'
|
||||||
|
|
||||||
import { Contract, DPM, FreeResponse, FullContract } from 'common/contract'
|
import {
|
||||||
import { User } from 'common/user'
|
Contract,
|
||||||
import { getNewMultiBetInfo } from 'common/new-bet'
|
DPM,
|
||||||
import { Answer, MAX_ANSWER_LENGTH } from 'common/answer'
|
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 { getContract, getValues } from './utils'
|
||||||
import { sendNewAnswerEmail } from './emails'
|
import { sendNewAnswerEmail } from './emails'
|
||||||
import { Bet } from '../../common/bet'
|
import { Bet } from '../../common/bet'
|
||||||
|
|
|
@ -14,10 +14,10 @@ import {
|
||||||
MAX_QUESTION_LENGTH,
|
MAX_QUESTION_LENGTH,
|
||||||
MAX_TAG_LENGTH,
|
MAX_TAG_LENGTH,
|
||||||
outcomeType,
|
outcomeType,
|
||||||
} from 'common/contract'
|
} from '../../common/contract'
|
||||||
import { slugify } from 'common/util/slugify'
|
import { slugify } from '../../common/util/slugify'
|
||||||
import { randomString } from 'common/util/random'
|
import { randomString } from '../../common/util/random'
|
||||||
import { getNewContract } from 'common/new-contract'
|
import { getNewContract } from '../../common/new-contract'
|
||||||
import {
|
import {
|
||||||
FIXED_ANTE,
|
FIXED_ANTE,
|
||||||
getAnteBets,
|
getAnteBets,
|
||||||
|
@ -25,8 +25,8 @@ import {
|
||||||
getFreeAnswerAnte,
|
getFreeAnswerAnte,
|
||||||
HOUSE_LIQUIDITY_PROVIDER_ID,
|
HOUSE_LIQUIDITY_PROVIDER_ID,
|
||||||
MINIMUM_ANTE,
|
MINIMUM_ANTE,
|
||||||
} from 'common/antes'
|
} from '../../common/antes'
|
||||||
import { getNoneAnswer } from 'common/answer'
|
import { getNoneAnswer } from '../../common/answer'
|
||||||
|
|
||||||
export const createContract = functions
|
export const createContract = functions
|
||||||
.runWith({ minInstances: 1 })
|
.runWith({ minInstances: 1 })
|
||||||
|
|
|
@ -3,10 +3,10 @@ import * as admin from 'firebase-admin'
|
||||||
import * as _ from 'lodash'
|
import * as _ from 'lodash'
|
||||||
|
|
||||||
import { getUser } from './utils'
|
import { getUser } from './utils'
|
||||||
import { Contract } from 'common/contract'
|
import { Contract } from '../../common/contract'
|
||||||
import { slugify } from 'common/util/slugify'
|
import { slugify } from '../../common/util/slugify'
|
||||||
import { randomString } from 'common/util/random'
|
import { randomString } from '../../common/util/random'
|
||||||
import { Fold } from 'common/fold'
|
import { Fold } from '../../common/fold'
|
||||||
|
|
||||||
export const createFold = functions.runWith({ minInstances: 1 }).https.onCall(
|
export const createFold = functions.runWith({ minInstances: 1 }).https.onCall(
|
||||||
async (
|
async (
|
||||||
|
|
|
@ -6,12 +6,15 @@ import {
|
||||||
STARTING_BALANCE,
|
STARTING_BALANCE,
|
||||||
SUS_STARTING_BALANCE,
|
SUS_STARTING_BALANCE,
|
||||||
User,
|
User,
|
||||||
} from 'common/user'
|
} from '../../common/user'
|
||||||
import { getUser, getUserByUsername } from './utils'
|
import { getUser, getUserByUsername } from './utils'
|
||||||
import { randomString } from 'common/util/random'
|
import { randomString } from '../../common/util/random'
|
||||||
import { cleanDisplayName, cleanUsername } from 'common/util/clean-username'
|
import {
|
||||||
|
cleanDisplayName,
|
||||||
|
cleanUsername,
|
||||||
|
} from '../../common/util/clean-username'
|
||||||
import { sendWelcomeEmail } from './emails'
|
import { sendWelcomeEmail } from './emails'
|
||||||
import { isWhitelisted } from 'common/envs/constants'
|
import { isWhitelisted } from '../../common/envs/constants'
|
||||||
|
|
||||||
export const createUser = functions
|
export const createUser = functions
|
||||||
.runWith({ minInstances: 1 })
|
.runWith({ minInstances: 1 })
|
||||||
|
|
|
@ -1,15 +1,14 @@
|
||||||
import * as _ from 'lodash'
|
import * as _ from 'lodash'
|
||||||
|
|
||||||
import { DOMAIN, PROJECT_ID } from 'common/envs/constants'
|
import { DOMAIN, PROJECT_ID } from '../../common/envs/constants'
|
||||||
import { Answer } from 'common/answer'
|
import { Answer } from '../../common/answer'
|
||||||
import { Bet } from 'common/bet'
|
import { Bet } from '../../common/bet'
|
||||||
import { getProbability } from 'common/calculate'
|
import { getProbability } from '../../common/calculate'
|
||||||
import { Comment } from 'common/comment'
|
import { Comment } from '../../common/comment'
|
||||||
import { Contract, FreeResponseContract } from 'common/contract'
|
import { Contract, FreeResponseContract } from '../../common/contract'
|
||||||
import { DPM_CREATOR_FEE } from 'common/fees'
|
import { DPM_CREATOR_FEE } from '../../common/fees'
|
||||||
import { PrivateUser, User } from 'common/user'
|
import { PrivateUser, User } from '../../common/user'
|
||||||
import { formatMoney, formatPercent } from 'common/util/format'
|
import { formatMoney, formatPercent } from '../../common/util/format'
|
||||||
|
|
||||||
import { sendTemplateEmail } from './send-email'
|
import { sendTemplateEmail } from './send-email'
|
||||||
import { getPrivateUser, getUser } from './utils'
|
import { getPrivateUser, getUser } from './utils'
|
||||||
|
|
||||||
|
|
|
@ -1,19 +1,5 @@
|
||||||
/* 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'
|
import * as admin from 'firebase-admin'
|
||||||
|
|
||||||
admin.initializeApp()
|
admin.initializeApp()
|
||||||
|
|
||||||
// export * from './keep-awake'
|
// export * from './keep-awake'
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import * as functions from 'firebase-functions'
|
import * as functions from 'firebase-functions'
|
||||||
import * as admin from 'firebase-admin'
|
import * as admin from 'firebase-admin'
|
||||||
|
|
||||||
import { Contract } from 'common/contract'
|
import { Contract } from '../../common/contract'
|
||||||
import { getPrivateUser, getUserByUsername } from './utils'
|
import { getPrivateUser, getUserByUsername } from './utils'
|
||||||
import { sendMarketCloseEmail } from './emails'
|
import { sendMarketCloseEmail } from './emails'
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ import * as admin from 'firebase-admin'
|
||||||
import * as _ from 'lodash'
|
import * as _ from 'lodash'
|
||||||
|
|
||||||
import { getContract } from './utils'
|
import { getContract } from './utils'
|
||||||
import { Bet } from 'common/bet'
|
import { Bet } from '../../common/bet'
|
||||||
|
|
||||||
const firestore = admin.firestore()
|
const firestore = admin.firestore()
|
||||||
|
|
||||||
|
|
|
@ -3,10 +3,10 @@ import * as admin from 'firebase-admin'
|
||||||
import * as _ from 'lodash'
|
import * as _ from 'lodash'
|
||||||
|
|
||||||
import { getContract, getUser, getValues } from './utils'
|
import { getContract, getUser, getValues } from './utils'
|
||||||
import { Comment } from 'common/comment'
|
import { Comment } from '../../common/comment'
|
||||||
import { sendNewCommentEmail } from './emails'
|
import { sendNewCommentEmail } from './emails'
|
||||||
import { Bet } from 'common/bet'
|
import { Bet } from '../../common/bet'
|
||||||
import { Answer } from 'common/answer'
|
import { Answer } from '../../common/answer'
|
||||||
|
|
||||||
const firestore = admin.firestore()
|
const firestore = admin.firestore()
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import * as functions from 'firebase-functions'
|
import * as functions from 'firebase-functions'
|
||||||
import * as admin from 'firebase-admin'
|
import * as admin from 'firebase-admin'
|
||||||
import { View } from 'common/tracking'
|
import { View } from '../../common/tracking'
|
||||||
|
|
||||||
const firestore = admin.firestore()
|
const firestore = admin.firestore()
|
||||||
|
|
||||||
|
|
|
@ -1,18 +1,18 @@
|
||||||
import * as functions from 'firebase-functions'
|
import * as functions from 'firebase-functions'
|
||||||
import * as admin from 'firebase-admin'
|
import * as admin from 'firebase-admin'
|
||||||
|
|
||||||
import { Contract } from 'common/contract'
|
import { Contract } from '../../common/contract'
|
||||||
import { User } from 'common/user'
|
import { User } from '../../common/user'
|
||||||
import {
|
import {
|
||||||
getNewBinaryCpmmBetInfo,
|
getNewBinaryCpmmBetInfo,
|
||||||
getNewBinaryDpmBetInfo,
|
getNewBinaryDpmBetInfo,
|
||||||
getNewMultiBetInfo,
|
getNewMultiBetInfo,
|
||||||
} from 'common/new-bet'
|
} from '../../common/new-bet'
|
||||||
import { addObjects, removeUndefinedProps } from 'common/util/object'
|
import { addObjects, removeUndefinedProps } from '../../common/util/object'
|
||||||
import { Bet } from 'common/bet'
|
import { Bet } from '../../common/bet'
|
||||||
import { redeemShares } from './redeem-shares'
|
import { redeemShares } from './redeem-shares'
|
||||||
import { Fees } from 'common/fees'
|
import { Fees } from '../../common/fees'
|
||||||
import { hasUserHitManaLimit } from 'common/calculate'
|
import { hasUserHitManaLimit } from '../../common/calculate'
|
||||||
|
|
||||||
export const placeBet = functions.runWith({ minInstances: 1 }).https.onCall(
|
export const placeBet = functions.runWith({ minInstances: 1 }).https.onCall(
|
||||||
async (
|
async (
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
import * as admin from 'firebase-admin'
|
import * as admin from 'firebase-admin'
|
||||||
import * as _ from 'lodash'
|
import * as _ from 'lodash'
|
||||||
|
|
||||||
import { Bet } from 'common/bet'
|
import { Bet } from '../../common/bet'
|
||||||
import { getProbability } from 'common/calculate'
|
import { getProbability } from '../../common/calculate'
|
||||||
|
|
||||||
import { Binary, CPMM, FullContract } from 'common/contract'
|
import { Binary, CPMM, FullContract } from '../../common/contract'
|
||||||
import { noFees } from 'common/fees'
|
import { noFees } from '../../common/fees'
|
||||||
import { User } from 'common/user'
|
import { User } from '../../common/user'
|
||||||
|
|
||||||
export const redeemShares = async (userId: string, contractId: string) => {
|
export const redeemShares = async (userId: string, contractId: string) => {
|
||||||
return await firestore.runTransaction(async (transaction) => {
|
return await firestore.runTransaction(async (transaction) => {
|
||||||
|
|
|
@ -2,9 +2,9 @@ import * as functions from 'firebase-functions'
|
||||||
import * as admin from 'firebase-admin'
|
import * as admin from 'firebase-admin'
|
||||||
import * as _ from 'lodash'
|
import * as _ from 'lodash'
|
||||||
|
|
||||||
import { Contract } from 'common/contract'
|
import { Contract } from '../../common/contract'
|
||||||
import { User } from 'common/user'
|
import { User } from '../../common/user'
|
||||||
import { Bet } from 'common/bet'
|
import { Bet } from '../../common/bet'
|
||||||
import { getUser, isProd, payUser } from './utils'
|
import { getUser, isProd, payUser } from './utils'
|
||||||
import { sendMarketResolutionEmail } from './emails'
|
import { sendMarketResolutionEmail } from './emails'
|
||||||
import {
|
import {
|
||||||
|
@ -12,9 +12,9 @@ import {
|
||||||
getPayouts,
|
getPayouts,
|
||||||
groupPayoutsByUser,
|
groupPayoutsByUser,
|
||||||
Payout,
|
Payout,
|
||||||
} from 'common/payouts'
|
} from '../../common/payouts'
|
||||||
import { removeUndefinedProps } from 'common/util/object'
|
import { removeUndefinedProps } from '../../common/util/object'
|
||||||
import { LiquidityProvision } from 'common/liquidity-provision'
|
import { LiquidityProvision } from '../../common/liquidity-provision'
|
||||||
|
|
||||||
export const resolveMarket = functions
|
export const resolveMarket = functions
|
||||||
.runWith({ minInstances: 1 })
|
.runWith({ minInstances: 1 })
|
||||||
|
|
|
@ -5,9 +5,9 @@ import { initAdmin } from './script-init'
|
||||||
initAdmin()
|
initAdmin()
|
||||||
|
|
||||||
import { getValues } from '../utils'
|
import { getValues } from '../utils'
|
||||||
import { View } from 'common/tracking'
|
import { View } from '../../../common/tracking'
|
||||||
import { User } from 'common/user'
|
import { User } from '../../../common/user'
|
||||||
import { batchedWaitAll } from 'common/util/promise'
|
import { batchedWaitAll } from '../../../common/util/promise'
|
||||||
|
|
||||||
const firestore = admin.firestore()
|
const firestore = admin.firestore()
|
||||||
|
|
||||||
|
|
|
@ -4,9 +4,9 @@ import * as _ from 'lodash'
|
||||||
import { initAdmin } from './script-init'
|
import { initAdmin } from './script-init'
|
||||||
initAdmin()
|
initAdmin()
|
||||||
|
|
||||||
import { Bet } from 'common/bet'
|
import { Bet } from '../../../common/bet'
|
||||||
import { getDpmProbability } from 'common/calculate-dpm'
|
import { getDpmProbability } from '../../../common/calculate-dpm'
|
||||||
import { Binary, Contract, DPM, FullContract } from 'common/contract'
|
import { Binary, Contract, DPM, FullContract } from '../../../common/contract'
|
||||||
|
|
||||||
type DocRef = admin.firestore.DocumentReference
|
type DocRef = admin.firestore.DocumentReference
|
||||||
const firestore = admin.firestore()
|
const firestore = admin.firestore()
|
||||||
|
|
|
@ -4,7 +4,7 @@ import * as _ from 'lodash'
|
||||||
import { initAdmin } from './script-init'
|
import { initAdmin } from './script-init'
|
||||||
initAdmin()
|
initAdmin()
|
||||||
|
|
||||||
import { PrivateUser, STARTING_BALANCE, User } from 'common/user'
|
import { PrivateUser, STARTING_BALANCE, User } from '../../../common/user'
|
||||||
|
|
||||||
const firestore = admin.firestore()
|
const firestore = admin.firestore()
|
||||||
|
|
||||||
|
|
|
@ -5,10 +5,10 @@ import * as fs from 'fs'
|
||||||
import { initAdmin } from './script-init'
|
import { initAdmin } from './script-init'
|
||||||
initAdmin()
|
initAdmin()
|
||||||
|
|
||||||
import { Bet } from 'common/bet'
|
import { Bet } from '../../../common/bet'
|
||||||
import { Contract } from 'common/contract'
|
import { Contract } from '../../../common/contract'
|
||||||
import { getValues } from '../utils'
|
import { getValues } from '../utils'
|
||||||
import { Comment } from 'common/comment'
|
import { Comment } from '../../../common/comment'
|
||||||
|
|
||||||
const firestore = admin.firestore()
|
const firestore = admin.firestore()
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ import { initAdmin } from './script-init'
|
||||||
initAdmin()
|
initAdmin()
|
||||||
|
|
||||||
import { getValues } from '../utils'
|
import { getValues } from '../utils'
|
||||||
import { Fold } from 'common/fold'
|
import { Fold } from '../../../common/fold'
|
||||||
|
|
||||||
async function lowercaseFoldTags() {
|
async function lowercaseFoldTags() {
|
||||||
const firestore = admin.firestore()
|
const firestore = admin.firestore()
|
||||||
|
|
|
@ -4,7 +4,7 @@ import * as _ from 'lodash'
|
||||||
import { initAdmin } from './script-init'
|
import { initAdmin } from './script-init'
|
||||||
initAdmin()
|
initAdmin()
|
||||||
|
|
||||||
import { Contract } from 'common/contract'
|
import { Contract } from '../../../common/contract'
|
||||||
|
|
||||||
const firestore = admin.firestore()
|
const firestore = admin.firestore()
|
||||||
|
|
||||||
|
|
|
@ -4,8 +4,8 @@ import * as _ from 'lodash'
|
||||||
import { initAdmin } from './script-init'
|
import { initAdmin } from './script-init'
|
||||||
initAdmin()
|
initAdmin()
|
||||||
|
|
||||||
import { Bet } from 'common/bet'
|
import { Bet } from '../../../common/bet'
|
||||||
import { Contract } from 'common/contract'
|
import { Contract } from '../../../common/contract'
|
||||||
|
|
||||||
type DocRef = admin.firestore.DocumentReference
|
type DocRef = admin.firestore.DocumentReference
|
||||||
|
|
||||||
|
|
|
@ -4,13 +4,22 @@ import * as _ from 'lodash'
|
||||||
import { initAdmin } from './script-init'
|
import { initAdmin } from './script-init'
|
||||||
initAdmin()
|
initAdmin()
|
||||||
|
|
||||||
import { Binary, Contract, CPMM, DPM, FullContract } from 'common/contract'
|
import {
|
||||||
import { Bet } from 'common/bet'
|
Binary,
|
||||||
import { calculateDpmPayout, getDpmProbability } from 'common/calculate-dpm'
|
Contract,
|
||||||
import { User } from 'common/user'
|
CPMM,
|
||||||
import { getCpmmInitialLiquidity } from 'common/antes'
|
DPM,
|
||||||
import { noFees } from 'common/fees'
|
FullContract,
|
||||||
import { addObjects } from 'common/util/object'
|
} 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
|
type DocRef = admin.firestore.DocumentReference
|
||||||
|
|
||||||
|
|
|
@ -4,11 +4,14 @@ import * as _ from 'lodash'
|
||||||
import { initAdmin } from './script-init'
|
import { initAdmin } from './script-init'
|
||||||
initAdmin()
|
initAdmin()
|
||||||
|
|
||||||
import { Binary, Contract, DPM, FullContract } from 'common/contract'
|
import { Binary, Contract, DPM, FullContract } from '../../../common/contract'
|
||||||
import { Bet } from 'common/bet'
|
import { Bet } from '../../../common/bet'
|
||||||
import { calculateDpmShares, getDpmProbability } from 'common/calculate-dpm'
|
import {
|
||||||
import { getSellBetInfo } from 'common/sell-bet'
|
calculateDpmShares,
|
||||||
import { User } from 'common/user'
|
getDpmProbability,
|
||||||
|
} from '../../../common/calculate-dpm'
|
||||||
|
import { getSellBetInfo } from '../../../common/sell-bet'
|
||||||
|
import { User } from '../../../common/user'
|
||||||
|
|
||||||
type DocRef = admin.firestore.DocumentReference
|
type DocRef = admin.firestore.DocumentReference
|
||||||
|
|
||||||
|
|
|
@ -4,10 +4,10 @@ import * as _ from 'lodash'
|
||||||
import { initAdmin } from './script-init'
|
import { initAdmin } from './script-init'
|
||||||
initAdmin()
|
initAdmin()
|
||||||
|
|
||||||
import { Bet } from 'common/bet'
|
import { Bet } from '../../../common/bet'
|
||||||
import { Contract } from 'common/contract'
|
import { Contract } from '../../../common/contract'
|
||||||
import { getLoanPayouts, getPayouts } from 'common/payouts'
|
import { getLoanPayouts, getPayouts } from '../../../common/payouts'
|
||||||
import { filterDefined } from 'common/util/array'
|
import { filterDefined } from '../../../common/util/array'
|
||||||
|
|
||||||
type DocRef = admin.firestore.DocumentReference
|
type DocRef = admin.firestore.DocumentReference
|
||||||
|
|
||||||
|
|
|
@ -4,8 +4,8 @@ import * as _ from 'lodash'
|
||||||
import { initAdmin } from './script-init'
|
import { initAdmin } from './script-init'
|
||||||
initAdmin()
|
initAdmin()
|
||||||
|
|
||||||
import { Bet } from 'common/bet'
|
import { Bet } from '../../../common/bet'
|
||||||
import { Contract } from 'common/contract'
|
import { Contract } from '../../../common/contract'
|
||||||
|
|
||||||
type DocRef = admin.firestore.DocumentReference
|
type DocRef = admin.firestore.DocumentReference
|
||||||
|
|
||||||
|
|
|
@ -4,8 +4,8 @@ import * as _ from 'lodash'
|
||||||
import { initAdmin } from './script-init'
|
import { initAdmin } from './script-init'
|
||||||
initAdmin()
|
initAdmin()
|
||||||
|
|
||||||
import { Bet } from 'common/bet'
|
import { Bet } from '../../../common/bet'
|
||||||
import { Contract } from 'common/contract'
|
import { Contract } from '../../../common/contract'
|
||||||
import { getValues } from '../utils'
|
import { getValues } from '../utils'
|
||||||
|
|
||||||
async function removeAnswerAnte() {
|
async function removeAnswerAnte() {
|
||||||
|
|
|
@ -4,7 +4,7 @@ import * as _ from 'lodash'
|
||||||
import { initAdmin } from './script-init'
|
import { initAdmin } from './script-init'
|
||||||
initAdmin()
|
initAdmin()
|
||||||
|
|
||||||
import { Contract } from 'common/contract'
|
import { Contract } from '../../../common/contract'
|
||||||
import { getValues } from '../utils'
|
import { getValues } from '../utils'
|
||||||
|
|
||||||
const firestore = admin.firestore()
|
const firestore = admin.firestore()
|
||||||
|
|
|
@ -4,8 +4,8 @@ import * as _ from 'lodash'
|
||||||
import { initAdmin } from './script-init'
|
import { initAdmin } from './script-init'
|
||||||
initAdmin()
|
initAdmin()
|
||||||
|
|
||||||
import { Contract } from 'common/contract'
|
import { Contract } from '../../../common/contract'
|
||||||
import { parseTags } from 'common/util/parse'
|
import { parseTags } from '../../../common/util/parse'
|
||||||
import { getValues } from '../utils'
|
import { getValues } from '../utils'
|
||||||
|
|
||||||
async function updateContractTags() {
|
async function updateContractTags() {
|
||||||
|
|
|
@ -5,9 +5,9 @@ import { initAdmin } from './script-init'
|
||||||
initAdmin()
|
initAdmin()
|
||||||
|
|
||||||
import { getValues } from '../utils'
|
import { getValues } from '../utils'
|
||||||
import { User } from 'common/user'
|
import { User } from '../../../common/user'
|
||||||
import { batchedWaitAll } from 'common/util/promise'
|
import { batchedWaitAll } from '../../../common/util/promise'
|
||||||
import { Contract } from 'common/contract'
|
import { Contract } from '../../../common/contract'
|
||||||
import { updateWordScores } from '../update-recommendations'
|
import { updateWordScores } from '../update-recommendations'
|
||||||
import { computeFeed } from '../update-feed'
|
import { computeFeed } from '../update-feed'
|
||||||
import { getFeedContracts, getTaggedContracts } from '../get-feed-data'
|
import { getFeedContracts, getTaggedContracts } from '../get-feed-data'
|
||||||
|
|
|
@ -4,9 +4,9 @@ import * as _ from 'lodash'
|
||||||
import { initAdmin } from './script-init'
|
import { initAdmin } from './script-init'
|
||||||
initAdmin()
|
initAdmin()
|
||||||
|
|
||||||
import { Contract } from 'common/contract'
|
import { Contract } from '../../../common/contract'
|
||||||
import { getValues } from '../utils'
|
import { getValues } from '../utils'
|
||||||
import { Comment } from 'common/comment'
|
import { Comment } from '../../../common/comment'
|
||||||
|
|
||||||
async function updateLastCommentTime() {
|
async function updateLastCommentTime() {
|
||||||
const firestore = admin.firestore()
|
const firestore = admin.firestore()
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
import * as admin from 'firebase-admin'
|
import * as admin from 'firebase-admin'
|
||||||
import * as functions from 'firebase-functions'
|
import * as functions from 'firebase-functions'
|
||||||
|
|
||||||
import { Contract } from 'common/contract'
|
import { Contract } from '../../common/contract'
|
||||||
import { User } from 'common/user'
|
import { User } from '../../common/user'
|
||||||
import { Bet } from 'common/bet'
|
import { Bet } from '../../common/bet'
|
||||||
import { getSellBetInfo } from 'common/sell-bet'
|
import { getSellBetInfo } from '../../common/sell-bet'
|
||||||
import { addObjects, removeUndefinedProps } from 'common/util/object'
|
import { addObjects, removeUndefinedProps } from '../../common/util/object'
|
||||||
import { Fees } from 'common/fees'
|
import { Fees } from '../../common/fees'
|
||||||
|
|
||||||
export const sellBet = functions.runWith({ minInstances: 1 }).https.onCall(
|
export const sellBet = functions.runWith({ minInstances: 1 }).https.onCall(
|
||||||
async (
|
async (
|
||||||
|
|
|
@ -2,12 +2,12 @@ import * as _ from 'lodash'
|
||||||
import * as admin from 'firebase-admin'
|
import * as admin from 'firebase-admin'
|
||||||
import * as functions from 'firebase-functions'
|
import * as functions from 'firebase-functions'
|
||||||
|
|
||||||
import { Binary, CPMM, FullContract } from 'common/contract'
|
import { Binary, CPMM, FullContract } from '../../common/contract'
|
||||||
import { User } from 'common/user'
|
import { User } from '../../common/user'
|
||||||
import { getCpmmSellBetInfo } from 'common/sell-bet'
|
import { getCpmmSellBetInfo } from '../../common/sell-bet'
|
||||||
import { addObjects, removeUndefinedProps } from 'common/util/object'
|
import { addObjects, removeUndefinedProps } from '../../common/util/object'
|
||||||
import { getValues } from './utils'
|
import { getValues } from './utils'
|
||||||
import { Bet } from 'common/bet'
|
import { Bet } from '../../common/bet'
|
||||||
|
|
||||||
export const sellShares = functions.runWith({ minInstances: 1 }).https.onCall(
|
export const sellShares = functions.runWith({ minInstances: 1 }).https.onCall(
|
||||||
async (
|
async (
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
import * as functions from 'firebase-functions'
|
import * as functions from 'firebase-functions'
|
||||||
import * as admin from 'firebase-admin'
|
import * as admin from 'firebase-admin'
|
||||||
|
|
||||||
import { User } from 'common/user'
|
import { User } from '../../common/user'
|
||||||
import { Txn } from 'common/txn'
|
import { Txn } from '../../common/txn'
|
||||||
import { removeUndefinedProps } from 'common/util/object'
|
import { removeUndefinedProps } from '../../common/util/object'
|
||||||
|
|
||||||
export const transact = functions
|
export const transact = functions
|
||||||
.runWith({ minInstances: 1 })
|
.runWith({ minInstances: 1 })
|
||||||
|
|
|
@ -2,7 +2,7 @@ import * as functions from 'firebase-functions'
|
||||||
import * as admin from 'firebase-admin'
|
import * as admin from 'firebase-admin'
|
||||||
import * as _ from 'lodash'
|
import * as _ from 'lodash'
|
||||||
import { getUser } from './utils'
|
import { getUser } from './utils'
|
||||||
import { PrivateUser } from 'common/user'
|
import { PrivateUser } from '../../common/user'
|
||||||
|
|
||||||
export const unsubscribe = functions
|
export const unsubscribe = functions
|
||||||
.runWith({ minInstances: 1 })
|
.runWith({ minInstances: 1 })
|
||||||
|
|
|
@ -3,9 +3,9 @@ import * as admin from 'firebase-admin'
|
||||||
import * as _ from 'lodash'
|
import * as _ from 'lodash'
|
||||||
|
|
||||||
import { getValues } from './utils'
|
import { getValues } from './utils'
|
||||||
import { Contract } from 'common/contract'
|
import { Contract } from '../../common/contract'
|
||||||
import { Bet } from 'common/bet'
|
import { Bet } from '../../common/bet'
|
||||||
import { batchedWaitAll } from 'common/util/promise'
|
import { batchedWaitAll } from '../../common/util/promise'
|
||||||
|
|
||||||
const firestore = admin.firestore()
|
const firestore = admin.firestore()
|
||||||
|
|
||||||
|
|
|
@ -3,9 +3,9 @@ import * as functions from 'firebase-functions'
|
||||||
import * as admin from 'firebase-admin'
|
import * as admin from 'firebase-admin'
|
||||||
|
|
||||||
import { getValue, getValues } from './utils'
|
import { getValue, getValues } from './utils'
|
||||||
import { Contract } from 'common/contract'
|
import { Contract } from '../../common/contract'
|
||||||
import { logInterpolation } from 'common/util/math'
|
import { logInterpolation } from '../../common/util/math'
|
||||||
import { DAY_MS } from 'common/util/time'
|
import { DAY_MS } from '../../common/util/time'
|
||||||
import {
|
import {
|
||||||
getProbability,
|
getProbability,
|
||||||
getOutcomeProbability,
|
getOutcomeProbability,
|
||||||
|
@ -15,7 +15,7 @@ import { User } from '../../common/user'
|
||||||
import {
|
import {
|
||||||
getContractScore,
|
getContractScore,
|
||||||
MAX_FEED_CONTRACTS,
|
MAX_FEED_CONTRACTS,
|
||||||
} from 'common/recommended-contracts'
|
} from '../../common/recommended-contracts'
|
||||||
import { callCloudFunction } from './call-cloud-function'
|
import { callCloudFunction } from './call-cloud-function'
|
||||||
import {
|
import {
|
||||||
getFeedContracts,
|
getFeedContracts,
|
||||||
|
|
|
@ -3,12 +3,12 @@ import * as admin from 'firebase-admin'
|
||||||
import * as _ from 'lodash'
|
import * as _ from 'lodash'
|
||||||
|
|
||||||
import { getValue, getValues } from './utils'
|
import { getValue, getValues } from './utils'
|
||||||
import { Contract } from 'common/contract'
|
import { Contract } from '../../common/contract'
|
||||||
import { Bet } from 'common/bet'
|
import { Bet } from '../../common/bet'
|
||||||
import { User } from 'common/user'
|
import { User } from '../../common/user'
|
||||||
import { ClickEvent } from 'common/tracking'
|
import { ClickEvent } from '../../common/tracking'
|
||||||
import { getWordScores } from 'common/recommended-contracts'
|
import { getWordScores } from '../../common/recommended-contracts'
|
||||||
import { batchedWaitAll } from 'common/util/promise'
|
import { batchedWaitAll } from '../../common/util/promise'
|
||||||
import { callCloudFunction } from './call-cloud-function'
|
import { callCloudFunction } from './call-cloud-function'
|
||||||
|
|
||||||
const firestore = admin.firestore()
|
const firestore = admin.firestore()
|
||||||
|
|
|
@ -3,11 +3,11 @@ import * as admin from 'firebase-admin'
|
||||||
import * as _ from 'lodash'
|
import * as _ from 'lodash'
|
||||||
|
|
||||||
import { getValues } from './utils'
|
import { getValues } from './utils'
|
||||||
import { Contract } from 'common/contract'
|
import { Contract } from '../../common/contract'
|
||||||
import { Bet } from 'common/bet'
|
import { Bet } from '../../common/bet'
|
||||||
import { User } from 'common/user'
|
import { User } from '../../common/user'
|
||||||
import { batchedWaitAll } from 'common/util/promise'
|
import { batchedWaitAll } from '../../common/util/promise'
|
||||||
import { calculatePayout } from 'common/calculate'
|
import { calculatePayout } from '../../common/calculate'
|
||||||
|
|
||||||
const firestore = admin.firestore()
|
const firestore = admin.firestore()
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import * as admin from 'firebase-admin'
|
import * as admin from 'firebase-admin'
|
||||||
|
|
||||||
import { Contract } from 'common/contract'
|
import { Contract } from '../../common/contract'
|
||||||
import { PrivateUser, User } from 'common/user'
|
import { PrivateUser, User } from '../../common/user'
|
||||||
|
|
||||||
export const isProd =
|
export const isProd =
|
||||||
admin.instanceId().app.options.projectId === 'mantic-markets'
|
admin.instanceId().app.options.projectId === 'mantic-markets'
|
||||||
|
|
Loading…
Reference in New Issue
Block a user