From ab8d541f8da5010ac12335c23978e00f9c094715 Mon Sep 17 00:00:00 2001 From: James Grugett Date: Sun, 15 May 2022 13:39:42 -0400 Subject: [PATCH] Revert "Make absolute imports work with functions project (#168)" This reverts commit c82a56af092f904abe2b2bbdb357b5bf86a69d2e. --- functions/src/add-liquidity.ts | 8 +++---- functions/src/change-user-info.ts | 12 +++++----- functions/src/create-answer.ts | 13 +++++++---- functions/src/create-contract.ts | 12 +++++----- functions/src/create-fold.ts | 8 +++---- functions/src/create-user.ts | 11 +++++---- functions/src/emails.ts | 19 ++++++++------- functions/src/index.ts | 16 +------------ functions/src/market-close-emails.ts | 2 +- functions/src/on-create-bet.ts | 2 +- functions/src/on-create-comment.ts | 6 ++--- functions/src/on-view.ts | 2 +- functions/src/place-bet.ts | 14 +++++------ functions/src/redeem-shares.ts | 10 ++++---- functions/src/resolve-market.ts | 12 +++++----- functions/src/scripts/cache-views.ts | 6 ++--- .../src/scripts/correct-bet-probability.ts | 6 ++--- functions/src/scripts/create-private-users.ts | 2 +- functions/src/scripts/get-json-dump.ts | 6 ++--- functions/src/scripts/lowercase-fold-tags.ts | 2 +- .../src/scripts/make-contracts-public.ts | 2 +- functions/src/scripts/migrate-contract.ts | 4 ++-- functions/src/scripts/migrate-to-cfmm.ts | 23 +++++++++++++------ functions/src/scripts/migrate-to-dpm-2.ts | 13 +++++++---- .../src/scripts/pay-out-contract-again.ts | 8 +++---- .../scripts/recalculate-contract-totals.ts | 4 ++-- functions/src/scripts/remove-answer-ante.ts | 4 ++-- .../src/scripts/rename-user-contracts.ts | 2 +- functions/src/scripts/update-contract-tags.ts | 4 ++-- functions/src/scripts/update-feed.ts | 6 ++--- .../src/scripts/update-last-comment-time.ts | 4 ++-- functions/src/sell-bet.ts | 12 +++++----- functions/src/sell-shares.ts | 10 ++++---- functions/src/transact.ts | 6 ++--- functions/src/unsubscribe.ts | 2 +- functions/src/update-contract-metrics.ts | 6 ++--- functions/src/update-feed.ts | 8 +++---- functions/src/update-recommendations.ts | 12 +++++----- functions/src/update-user-metrics.ts | 10 ++++---- functions/src/utils.ts | 4 ++-- 40 files changed, 159 insertions(+), 154 deletions(-) diff --git a/functions/src/add-liquidity.ts b/functions/src/add-liquidity.ts index 0fdf97c9..34d3f7c6 100644 --- a/functions/src/add-liquidity.ts +++ b/functions/src/add-liquidity.ts @@ -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 ( diff --git a/functions/src/change-user-info.ts b/functions/src/change-user-info.ts index f85d45b3..ab15eb70 100644 --- a/functions/src/change-user-info.ts +++ b/functions/src/change-user-info.ts @@ -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 }) diff --git a/functions/src/create-answer.ts b/functions/src/create-answer.ts index 45f42291..aa18351d 100644 --- a/functions/src/create-answer.ts +++ b/functions/src/create-answer.ts @@ -1,10 +1,15 @@ 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' diff --git a/functions/src/create-contract.ts b/functions/src/create-contract.ts index 5fa0c036..2ebe6e6c 100644 --- a/functions/src/create-contract.ts +++ b/functions/src/create-contract.ts @@ -14,10 +14,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, @@ -25,8 +25,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 }) diff --git a/functions/src/create-fold.ts b/functions/src/create-fold.ts index 5cf40b22..36d1d269 100644 --- a/functions/src/create-fold.ts +++ b/functions/src/create-fold.ts @@ -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 ( diff --git a/functions/src/create-user.ts b/functions/src/create-user.ts index dd2b5275..f73b868b 100644 --- a/functions/src/create-user.ts +++ b/functions/src/create-user.ts @@ -6,12 +6,15 @@ 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 }) diff --git a/functions/src/emails.ts b/functions/src/emails.ts index 2b13495a..84a5e3cb 100644 --- a/functions/src/emails.ts +++ b/functions/src/emails.ts @@ -1,15 +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 } from './send-email' import { getPrivateUser, getUser } from './utils' diff --git a/functions/src/index.ts b/functions/src/index.ts index 0ef5ab61..3c0dc8f8 100644 --- a/functions/src/index.ts +++ b/functions/src/index.ts @@ -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' + admin.initializeApp() // export * from './keep-awake' diff --git a/functions/src/market-close-emails.ts b/functions/src/market-close-emails.ts index 3adc5b6d..bb144600 100644 --- a/functions/src/market-close-emails.ts +++ b/functions/src/market-close-emails.ts @@ -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' diff --git a/functions/src/on-create-bet.ts b/functions/src/on-create-bet.ts index e3cf0ece..deaa4c4a 100644 --- a/functions/src/on-create-bet.ts +++ b/functions/src/on-create-bet.ts @@ -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() diff --git a/functions/src/on-create-comment.ts b/functions/src/on-create-comment.ts index 654f9055..18fc6757 100644 --- a/functions/src/on-create-comment.ts +++ b/functions/src/on-create-comment.ts @@ -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() diff --git a/functions/src/on-view.ts b/functions/src/on-view.ts index 6e08ae76..d2f746d5 100644 --- a/functions/src/on-view.ts +++ b/functions/src/on-view.ts @@ -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() diff --git a/functions/src/place-bet.ts b/functions/src/place-bet.ts index e0ff3e64..e1ba9fc2 100644 --- a/functions/src/place-bet.ts +++ b/functions/src/place-bet.ts @@ -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 ( diff --git a/functions/src/redeem-shares.ts b/functions/src/redeem-shares.ts index a43aa509..08d87a8b 100644 --- a/functions/src/redeem-shares.ts +++ b/functions/src/redeem-shares.ts @@ -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) => { diff --git a/functions/src/resolve-market.ts b/functions/src/resolve-market.ts index ac9eb7a0..0ef416a7 100644 --- a/functions/src/resolve-market.ts +++ b/functions/src/resolve-market.ts @@ -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 }) diff --git a/functions/src/scripts/cache-views.ts b/functions/src/scripts/cache-views.ts index c7ed661f..c7145a1e 100644 --- a/functions/src/scripts/cache-views.ts +++ b/functions/src/scripts/cache-views.ts @@ -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() diff --git a/functions/src/scripts/correct-bet-probability.ts b/functions/src/scripts/correct-bet-probability.ts index e65b4ddf..3b57dbeb 100644 --- a/functions/src/scripts/correct-bet-probability.ts +++ b/functions/src/scripts/correct-bet-probability.ts @@ -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() diff --git a/functions/src/scripts/create-private-users.ts b/functions/src/scripts/create-private-users.ts index a83bb53e..8051a447 100644 --- a/functions/src/scripts/create-private-users.ts +++ b/functions/src/scripts/create-private-users.ts @@ -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() diff --git a/functions/src/scripts/get-json-dump.ts b/functions/src/scripts/get-json-dump.ts index 3027ce45..b9909132 100644 --- a/functions/src/scripts/get-json-dump.ts +++ b/functions/src/scripts/get-json-dump.ts @@ -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() diff --git a/functions/src/scripts/lowercase-fold-tags.ts b/functions/src/scripts/lowercase-fold-tags.ts index f5d01bfe..80b79a33 100644 --- a/functions/src/scripts/lowercase-fold-tags.ts +++ b/functions/src/scripts/lowercase-fold-tags.ts @@ -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() diff --git a/functions/src/scripts/make-contracts-public.ts b/functions/src/scripts/make-contracts-public.ts index 5d958f13..19d2e196 100644 --- a/functions/src/scripts/make-contracts-public.ts +++ b/functions/src/scripts/make-contracts-public.ts @@ -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() diff --git a/functions/src/scripts/migrate-contract.ts b/functions/src/scripts/migrate-contract.ts index 7127f371..718cf62e 100644 --- a/functions/src/scripts/migrate-contract.ts +++ b/functions/src/scripts/migrate-contract.ts @@ -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 diff --git a/functions/src/scripts/migrate-to-cfmm.ts b/functions/src/scripts/migrate-to-cfmm.ts index 9dd8c63e..874011ca 100644 --- a/functions/src/scripts/migrate-to-cfmm.ts +++ b/functions/src/scripts/migrate-to-cfmm.ts @@ -4,13 +4,22 @@ 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 diff --git a/functions/src/scripts/migrate-to-dpm-2.ts b/functions/src/scripts/migrate-to-dpm-2.ts index 81e99d98..2c6f066f 100644 --- a/functions/src/scripts/migrate-to-dpm-2.ts +++ b/functions/src/scripts/migrate-to-dpm-2.ts @@ -4,11 +4,14 @@ 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 diff --git a/functions/src/scripts/pay-out-contract-again.ts b/functions/src/scripts/pay-out-contract-again.ts index 68f982cd..916b9efb 100644 --- a/functions/src/scripts/pay-out-contract-again.ts +++ b/functions/src/scripts/pay-out-contract-again.ts @@ -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 diff --git a/functions/src/scripts/recalculate-contract-totals.ts b/functions/src/scripts/recalculate-contract-totals.ts index 91165781..39942542 100644 --- a/functions/src/scripts/recalculate-contract-totals.ts +++ b/functions/src/scripts/recalculate-contract-totals.ts @@ -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 diff --git a/functions/src/scripts/remove-answer-ante.ts b/functions/src/scripts/remove-answer-ante.ts index 8b026174..eb49af6c 100644 --- a/functions/src/scripts/remove-answer-ante.ts +++ b/functions/src/scripts/remove-answer-ante.ts @@ -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() { diff --git a/functions/src/scripts/rename-user-contracts.ts b/functions/src/scripts/rename-user-contracts.ts index bcb4fea6..9b0f569b 100644 --- a/functions/src/scripts/rename-user-contracts.ts +++ b/functions/src/scripts/rename-user-contracts.ts @@ -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() diff --git a/functions/src/scripts/update-contract-tags.ts b/functions/src/scripts/update-contract-tags.ts index 7e671c9f..1dda5615 100644 --- a/functions/src/scripts/update-contract-tags.ts +++ b/functions/src/scripts/update-contract-tags.ts @@ -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() { diff --git a/functions/src/scripts/update-feed.ts b/functions/src/scripts/update-feed.ts index d698a529..fee7398d 100644 --- a/functions/src/scripts/update-feed.ts +++ b/functions/src/scripts/update-feed.ts @@ -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 { computeFeed } from '../update-feed' import { getFeedContracts, getTaggedContracts } from '../get-feed-data' diff --git a/functions/src/scripts/update-last-comment-time.ts b/functions/src/scripts/update-last-comment-time.ts index 99d7f52d..ae950fbe 100644 --- a/functions/src/scripts/update-last-comment-time.ts +++ b/functions/src/scripts/update-last-comment-time.ts @@ -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() diff --git a/functions/src/sell-bet.ts b/functions/src/sell-bet.ts index c685498b..fff88716 100644 --- a/functions/src/sell-bet.ts +++ b/functions/src/sell-bet.ts @@ -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 ( diff --git a/functions/src/sell-shares.ts b/functions/src/sell-shares.ts index 158a5f6a..e4dbcbc9 100644 --- a/functions/src/sell-shares.ts +++ b/functions/src/sell-shares.ts @@ -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 ( diff --git a/functions/src/transact.ts b/functions/src/transact.ts index 77323638..79b5ccb8 100644 --- a/functions/src/transact.ts +++ b/functions/src/transact.ts @@ -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 }) diff --git a/functions/src/unsubscribe.ts b/functions/src/unsubscribe.ts index c2981358..317cf61e 100644 --- a/functions/src/unsubscribe.ts +++ b/functions/src/unsubscribe.ts @@ -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 }) diff --git a/functions/src/update-contract-metrics.ts b/functions/src/update-contract-metrics.ts index 9214d2dc..c3801df6 100644 --- a/functions/src/update-contract-metrics.ts +++ b/functions/src/update-contract-metrics.ts @@ -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() diff --git a/functions/src/update-feed.ts b/functions/src/update-feed.ts index c9d2def8..59d6ddd8 100644 --- a/functions/src/update-feed.ts +++ b/functions/src/update-feed.ts @@ -3,9 +3,9 @@ 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, @@ -15,7 +15,7 @@ import { User } from '../../common/user' import { getContractScore, MAX_FEED_CONTRACTS, -} from 'common/recommended-contracts' +} from '../../common/recommended-contracts' import { callCloudFunction } from './call-cloud-function' import { getFeedContracts, diff --git a/functions/src/update-recommendations.ts b/functions/src/update-recommendations.ts index e18e7c0e..4e656dda 100644 --- a/functions/src/update-recommendations.ts +++ b/functions/src/update-recommendations.ts @@ -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() diff --git a/functions/src/update-user-metrics.ts b/functions/src/update-user-metrics.ts index 6f755622..70fd1bc5 100644 --- a/functions/src/update-user-metrics.ts +++ b/functions/src/update-user-metrics.ts @@ -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() diff --git a/functions/src/utils.ts b/functions/src/utils.ts index d06b6ef2..c0f92f94 100644 --- a/functions/src/utils.ts +++ b/functions/src/utils.ts @@ -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'