Skip to content

five-on-it / apps/api/src/postgres / PostgresStore

Interface: PostgresStore ​

Defined in: apps/api/src/postgres.ts:387

A store in Postgres, and how to let go of its connections.

Extends ​

Methods ​

accountEntitlement() ​

accountEntitlement(account): Promise<Entitlement | undefined>

Defined in: apps/api/src/store.ts:945

The entitlement of the Steam account that signs in to an account, if one does.

Parameters ​

account ​

string

Returns ​

Promise<Entitlement | undefined>

Inherited from ​

Store.accountEntitlement


addRunPlayer() ​

addRunPlayer(player): Promise<boolean>

Defined in: apps/api/src/store.ts:977

Adds a seat to an open run's roster (a player placed in it under way, joinInProgress): false when the run is not open any more, the seat is taken, or the account has a seat of the run already (nothing added).

Parameters ​

player ​

RunPlayer

Returns ​

Promise<boolean>

Inherited from ​

Store.addRunPlayer


appendAudit() ​

appendAudit(entry): Promise<void>

Defined in: apps/api/src/store.ts:812

Adds a decision to the audit log.

Parameters ​

entry ​

AuditEntry

Returns ​

Promise<void>

Inherited from ​

Store.appendAudit


applyStanding() ​

applyStanding(lines, fresh): Promise<{ applied: StandingLine[]; standings: PlayerStanding[]; }>

Defined in: apps/api/src/store.ts:1003

Applies lines to their accounts' standings, atomically each, once each (a line whose id is in the ledger already is left out): its Respect added (to its season's too), its conduct moved and kept in 0–10,000, its skill set when it carries one, its name kept; an account without a standing starts at fresh's. Answers the lines applied and the standings after.

Parameters ​

lines ​

readonly StandingLine[]

fresh ​

(account, name) => PlayerStanding

Returns ​

Promise<{ applied: StandingLine[]; standings: PlayerStanding[]; }>

Inherited from ​

Store.applyStanding


auditLog() ​

auditLog(limit, action?): Promise<AuditEntry[]>

Defined in: apps/api/src/store.ts:814

The audit log, newest first, at most limit entries: every one, or those of one action.

Parameters ​

limit ​

number

action? ​

"conduct" | "delete" | "settings" | "takedown" | "restore" | "feature" | "unfeature" | "dismiss" | "uphold" | "limits" | "erase"

Returns ​

Promise<AuditEntry[]>

Inherited from ​

Store.auditLog


cancelJob() ​

cancelJob(id, at): Promise<Job | undefined>

Defined in: apps/api/src/store.ts:898

Cancels a job that is queued, running or waiting at a time (ISO), atomically: it is over (cancelled, no lease), so a claim never takes it and the attempt running it can renew or settle nothing. Answers the job as it was before, or undefined when there is none or it was over already.

Parameters ​

id ​

string

at ​

string

Returns ​

Promise<Job | undefined>

Inherited from ​

Store.cancelJob


claimJob() ​

claimJob(kind, at, leaseUntil, options?): Promise<Job | undefined>

Defined in: apps/api/src/store.ts:870

Claims the next queued job of a kind at a time (ISO), atomically, so two processes never claim the same one: the highest priority first, then the owner with the fewest jobs of that kind started that day (UTC), then the oldest (queue.ts's order). A creation (create) of an owner who has one running already waits (one at a time each, which Postgres's index holds too). It answers the job as claimed (running, its attempts counted, held until leaseUntil), or undefined when none is queued.

Parameters ​

kind ​

JobKind

at ​

string

leaseUntil ​

string

options? ​

ClaimOptions

Returns ​

Promise<Job | undefined>

Inherited from ​

Store.claimJob


close() ​

close(): Promise<void>

Defined in: apps/api/src/postgres.ts:389

Closes the connection pool.

Returns ​

Promise<void>


consents() ​

consents(account): Promise<Consent[]>

Defined in: apps/api/src/store.ts:818

An account's acceptances, newest first.

Parameters ​

account ​

string

Returns ​

Promise<Consent[]>

Inherited from ​

Store.consents


countMissionRun() ​

countMissionRun(run): Promise<boolean>

Defined in: apps/api/src/store.ts:1028

Counts a run in its mission version's tally, once (by the run's id): a settled run, a completion when it completed, its accounts among the distinct players. False when it was counted already.

Parameters ​

run ​

MissionRun

Returns ​

Promise<boolean>

Inherited from ​

Store.countMissionRun


deleteDraft() ​

deleteDraft(id): Promise<boolean>

Defined in: apps/api/src/store.ts:780

Forgets a draft and its builds' records (their artifacts stay: they are content-addressed); false when there was none.

Parameters ​

id ​

string

Returns ​

Promise<boolean>

Inherited from ​

Store.deleteDraft


deleteLimits() ​

deleteLimits(account): Promise<void>

Defined in: apps/api/src/store.ts:926

Forgets the limits an admin set an account: it has the defaults again.

Parameters ​

account ​

string

Returns ​

Promise<void>

Inherited from ​

Store.deleteLimits


deleteOAuthGrant() ​

deleteOAuthGrant(id): Promise<void>

Defined in: apps/api/src/store.ts:845

Revokes a grant: forgets it and its refresh tokens.

Parameters ​

id ​

string

Returns ​

Promise<void>

Inherited from ​

Store.deleteOAuthGrant


deleteSettings() ​

deleteSettings(): Promise<void>

Defined in: apps/api/src/store.ts:934

Forgets the platform's settings: the configuration's defaults again.

Returns ​

Promise<void>

Inherited from ​

Store.deleteSettings


endorsements() ​

endorsements(query): Promise<Endorsement[]>

Defined in: apps/api/src/store.ts:1047

The endorsements of a run, or those given or received by an account since a time.

Parameters ​

query ​
account? ​

string

run? ​

string

since? ​

string

Returns ​

Promise<Endorsement[]>

Inherited from ​

Store.endorsements


endRun() ​

endRun(ended): Promise<boolean>

Defined in: apps/api/src/store.ts:992

Ends a run that is still open, atomically: the run as ended says (its state, result, end); false when it had ended already (it is left as it was).

Parameters ​

ended ​

Run

Returns ​

Promise<boolean>

Inherited from ​

Store.endRun


eraseStanding() ​

eraseStanding(account): Promise<void>

Defined in: apps/api/src/store.ts:1061

Forgets an account's standing: its standing, its ledger, the endorsements it gave and got, its ratings of missions, and its account among the missions' players (each kept as an anonymous one, so the missions' counts stay).

Parameters ​

account ​

string

Returns ​

Promise<void>

Inherited from ​

Store.eraseStanding


expireJobs() ​

expireJobs(kind, at, attempts): Promise<Job[]>

Defined in: apps/api/src/store.ts:891

The running jobs of a kind whose lease ran out before a time (ISO): queued again while they had fewer than attempts attempts, failed after that; answered as they are now.

Parameters ​

kind ​

JobKind

at ​

string

attempts ​

number

Returns ​

Promise<Job[]>

Inherited from ​

Store.expireJobs


findAccounts() ​

findAccounts(q, limit): Promise<KnownAccount[]>

Defined in: apps/api/src/store.ts:939

The accounts the API has seen (drafts' owners, quotas' spenders, accounts with limits) whose id or name holds q (any case), by id, at most limit.

Parameters ​

q ​

string

limit ​

number

Returns ​

Promise<KnownAccount[]>

Inherited from ​

Store.findAccounts


findJobs() ​

findJobs(query): Promise<Job[]>

Defined in: apps/api/src/store.ts:906

The jobs a query asks for, whole, the newest first.

Parameters ​

query ​

JobQuery

Returns ​

Promise<Job[]>

Inherited from ​

Store.findJobs


getBuild() ​

getBuild(id): Promise<Build | undefined>

Defined in: apps/api/src/store.ts:784

A build by id.

Parameters ​

id ​

string

Returns ​

Promise<Build | undefined>

Inherited from ​

Store.getBuild


getDraft() ​

getDraft(id): Promise<Draft | undefined>

Defined in: apps/api/src/store.ts:776

A draft by id.

Parameters ​

id ​

string

Returns ​

Promise<Draft | undefined>

Inherited from ​

Store.getDraft


getEntitlement() ​

getEntitlement(steamid): Promise<Entitlement | undefined>

Defined in: apps/api/src/store.ts:943

A Steam account's entitlement by its SteamID64.

Parameters ​

steamid ​

string

Returns ​

Promise<Entitlement | undefined>

Inherited from ​

Store.getEntitlement


getJob() ​

getJob(id): Promise<Job | undefined>

Defined in: apps/api/src/store.ts:857

A job by id.

Parameters ​

id ​

string

Returns ​

Promise<Job | undefined>

Inherited from ​

Store.getJob


getLimits() ​

getLimits(account): Promise<AccountLimits | undefined>

Defined in: apps/api/src/store.ts:924

The limits an admin set an account, if any.

Parameters ​

account ​

string

Returns ​

Promise<AccountLimits | undefined>

Inherited from ​

Store.getLimits


getMissionRating() ​

getMissionRating(key, account): Promise<MissionRating | undefined>

Defined in: apps/api/src/store.ts:1051

An account's rating of a mission's version.

Parameters ​

key ​

MissionKey

account ​

string

Returns ​

Promise<MissionRating | undefined>

Inherited from ​

Store.getMissionRating


getOAuthClient() ​

getOAuthClient(id): Promise<OAuthClient | undefined>

Defined in: apps/api/src/store.ts:832

An OAuth client by id.

Parameters ​

id ​

string

Returns ​

Promise<OAuthClient | undefined>

Inherited from ​

Store.getOAuthClient


getOAuthGrant() ​

getOAuthGrant(id): Promise<OAuthGrant | undefined>

Defined in: apps/api/src/store.ts:843

A grant by id; undefined once revoked or forgotten.

Parameters ​

id ​

string

Returns ​

Promise<OAuthGrant | undefined>

Inherited from ​

Store.getOAuthGrant


getOAuthRefresh() ​

getOAuthRefresh(hash): Promise<OAuthRefresh | undefined>

Defined in: apps/api/src/store.ts:849

A refresh token by the hash of its value.

Parameters ​

hash ​

string

Returns ​

Promise<OAuthRefresh | undefined>

Inherited from ​

Store.getOAuthRefresh


getPlayerStanding() ​

getPlayerStanding(account): Promise<PlayerStanding | undefined>

Defined in: apps/api/src/store.ts:994

An account's standing, if it has one.

Parameters ​

account ​

string

Returns ​

Promise<PlayerStanding | undefined>

Inherited from ​

Store.getPlayerStanding


getRating() ​

getRating(game, account): Promise<Rating | undefined>

Defined in: apps/api/src/store.ts:798

An account's rating of a game.

Parameters ​

game ​

string

account ​

string

Returns ​

Promise<Rating | undefined>

Inherited from ​

Store.getRating


getReport() ​

getReport(id): Promise<Report | undefined>

Defined in: apps/api/src/store.ts:804

A report by id.

Parameters ​

id ​

string

Returns ​

Promise<Report | undefined>

Inherited from ​

Store.getReport


getRun() ​

getRun(id): Promise<Run | undefined>

Defined in: apps/api/src/store.ts:981

A run by its id.

Parameters ​

id ​

string

Returns ​

Promise<Run | undefined>

Inherited from ​

Store.getRun


getSettings() ​

getSettings(): Promise<PlatformSettings | undefined>

Defined in: apps/api/src/store.ts:930

The platform's settings an admin set, if any.

Returns ​

Promise<PlatformSettings | undefined>

Inherited from ​

Store.getSettings


getTranscript() ​

getTranscript(job): Promise<Transcript | undefined>

Defined in: apps/api/src/store.ts:967

A creation's transcript, while it is kept.

Parameters ​

job ​

string

Returns ​

Promise<Transcript | undefined>

Inherited from ​

Store.getTranscript


jobsStarted() ​

jobsStarted(kind, since): Promise<Map<string, number>>

Defined in: apps/api/src/store.ts:861

How many jobs of a kind each owner had started since a time (ISO).

Parameters ​

kind ​

JobKind

since ​

string

Returns ​

Promise<Map<string, number>>

Inherited from ​

Store.jobsStarted


latestBuild() ​

latestBuild(draft): Promise<Build | undefined>

Defined in: apps/api/src/store.ts:788

A draft's latest build.

Parameters ​

draft ​

string

Returns ​

Promise<Build | undefined>

Inherited from ​

Store.latestBuild


latestVersions() ​

latestVersions(): Promise<GameVersion[]>

Defined in: apps/api/src/store.ts:794

The latest version of every game, newest first.

Returns ​

Promise<GameVersion[]>

Inherited from ​

Store.latestVersions


leaderboard() ​

leaderboard(season, limit): Promise<LeaderboardLine[]>

Defined in: apps/api/src/store.ts:1043

The leaderboard: the accounts by the Respect earned in a season (all: their Respect), the most first, at most limit (none with nothing).

Parameters ​

season ​

string

limit ​

number

Returns ​

Promise<LeaderboardLine[]>

Inherited from ​

Store.leaderboard


ledgerTotals() ​

ledgerTotals(since, until?): Promise<LedgerTotals>

Defined in: apps/api/src/store.ts:963

What the lines claimed from since (and before until) spent, and hold reserved.

Parameters ​

since ​

string

until? ​

string

Returns ​

Promise<LedgerTotals>

Inherited from ​

Store.ledgerTotals


listDrafts() ​

listDrafts(owner): Promise<Draft[]>

Defined in: apps/api/src/store.ts:782

An owner's drafts, newest first.

Parameters ​

owner ​

string

Returns ​

Promise<Draft[]>

Inherited from ​

Store.listDrafts


listJobs() ​

listJobs(kind, states): Promise<JobSummary[]>

Defined in: apps/api/src/store.ts:859

The jobs of a kind in the states given, without their documents, in the order they were queued.

Parameters ​

kind ​

JobKind

states ​

readonly ("done" | "failed" | "waiting" | "running" | "queued" | "cancelled")[]

Returns ​

Promise<JobSummary[]>

Inherited from ​

Store.listJobs


listLimits() ​

listLimits(): Promise<AccountLimits[]>

Defined in: apps/api/src/store.ts:928

Every account's limits an admin set, the latest set first.

Returns ​

Promise<AccountLimits[]>

Inherited from ​

Store.listLimits


listReports() ​

listReports(state?): Promise<Report[]>

Defined in: apps/api/src/store.ts:806

The reports, newest first: every one, or those in one state.

Parameters ​

state? ​

"open" | "actioned" | "dismissed"

Returns ​

Promise<Report[]>

Inherited from ​

Store.listReports


markRunPaid() ​

markRunPaid(run, at): Promise<void>

Defined in: apps/api/src/store.ts:1032

Marks a run's seats paid (once: a later mark keeps the first time).

Parameters ​

run ​

string

at ​

string

Returns ​

Promise<void>

Inherited from ​

Store.markRunPaid


missionRatings() ​

missionRatings(key): Promise<{ average: number; count: number; }>

Defined in: apps/api/src/store.ts:1053

A mission version's ratings: how many, their mean (two decimals; 0 without any).

Parameters ​

key ​

MissionKey

Returns ​

Promise<{ average: number; count: number; }>

Inherited from ​

Store.missionRatings


missionRatingsBy() ​

missionRatingsBy(account): Promise<MissionRating[]>

Defined in: apps/api/src/store.ts:1055

An account's ratings of missions, the newest first (its data's export).

Parameters ​

account ​

string

Returns ​

Promise<MissionRating[]>

Inherited from ​

Store.missionRatingsBy


missionTally() ​

missionTally(key): Promise<{ completions: number; players: number; runs: number; }>

Defined in: apps/api/src/store.ts:1034

A mission version's tally.

Parameters ​

key ​

MissionKey

Returns ​

Promise<{ completions: number; players: number; runs: number; }>

Inherited from ​

Store.missionTally


moveJob() ​

moveJob(job, from): Promise<boolean>

Defined in: apps/api/src/store.ts:904

Saves a job as given (no lease) when it is still in the state from, atomically: a creation's conversation moved on (waiting to queued when its owner says more, waiting to done when it went quiet) never overwrites a cancel or a claim. False when it was not.

Parameters ​

job ​

Job

from ​

"done" | "failed" | "waiting" | "running" | "queued" | "cancelled"

Returns ​

Promise<boolean>

Inherited from ​

Store.moveJob


openRuns() ​

openRuns(): Promise<Run[]>

Defined in: apps/api/src/store.ts:985

The runs still open, the oldest first: what the sweep looks at.

Returns ​

Promise<Run[]>

Inherited from ​

Store.openRuns


openRunsOf() ​

openRunsOf(account): Promise<Run[]>

Defined in: apps/api/src/store.ts:987

The runs still open an account has a seat in, the oldest first.

Parameters ​

account ​

string

Returns ​

Promise<Run[]>

Inherited from ​

Store.openRunsOf


playerStandings() ​

playerStandings(accounts): Promise<PlayerStanding[]>

Defined in: apps/api/src/store.ts:996

The standings of the accounts given that have one.

Parameters ​

accounts ​

readonly string[]

Returns ​

Promise<PlayerStanding[]>

Inherited from ​

Store.playerStandings


purgeOAuth() ​

purgeOAuth(before): Promise<number>

Defined in: apps/api/src/store.ts:853

Forgets the codes, refresh tokens and grants that expired before a time (ISO); returns how many.

Parameters ​

before ​

string

Returns ​

Promise<number>

Inherited from ​

Store.purgeOAuth


purgeTelemetry() ​

purgeTelemetry(before): Promise<number>

Defined in: apps/api/src/store.ts:828

Forgets the telemetry records older than a time (ISO); returns how many.

Parameters ​

before ​

string

Returns ​

Promise<number>

Inherited from ​

Store.purgeTelemetry


purgeTranscripts() ​

purgeTranscripts(before): Promise<number>

Defined in: apps/api/src/store.ts:969

Forgets the transcripts kept before a time (ISO); returns how many.

Parameters ​

before ​

string

Returns ​

Promise<number>

Inherited from ​

Store.purgeTranscripts


putBuild() ​

putBuild(build): Promise<void>

Defined in: apps/api/src/store.ts:786

Saves a build (insert or replace).

Parameters ​

build ​

Build

Returns ​

Promise<void>

Inherited from ​

Store.putBuild


putConsent() ​

putConsent(consent): Promise<void>

Defined in: apps/api/src/store.ts:816

Records an account's acceptance of a version of the terms (again: the latest time).

Parameters ​

Consent

Returns ​

Promise<void>

Inherited from ​

Store.putConsent


putDraft() ​

putDraft(draft): Promise<void>

Defined in: apps/api/src/store.ts:778

Saves a draft (insert or replace).

Parameters ​

draft ​

Draft

Returns ​

Promise<void>

Inherited from ​

Store.putDraft


putEndorsement() ​

putEndorsement(endorsement): Promise<boolean>

Defined in: apps/api/src/store.ts:1045

Keeps an endorsement, once per run, giver and receiver: false when it was given already.

Parameters ​

endorsement ​

Endorsement

Returns ​

Promise<boolean>

Inherited from ​

Store.putEndorsement


putEntitlement() ​

putEntitlement(entitlement): Promise<void>

Defined in: apps/api/src/store.ts:941

Saves a Steam account's entitlement (insert or replace; one Steam account per account).

Parameters ​

entitlement ​

Entitlement

Returns ​

Promise<void>

Inherited from ​

Store.putEntitlement


putJob() ​

putJob(job): Promise<void>

Defined in: apps/api/src/store.ts:855

Saves a job (insert or replace).

Parameters ​

job ​

Job

Returns ​

Promise<void>

Inherited from ​

Store.putJob


putLedger() ​

putLedger(entry): Promise<void>

Defined in: apps/api/src/store.ts:956

Saves a creation's line in the ledger (insert or replace).

Parameters ​

entry ​

LedgerEntry

Returns ​

Promise<void>

Inherited from ​

Store.putLedger


putLimits() ​

putLimits(limits): Promise<void>

Defined in: apps/api/src/store.ts:922

Saves the limits an admin set an account (insert or replace).

Parameters ​

limits ​

AccountLimits

Returns ​

Promise<void>

Inherited from ​

Store.putLimits


putMissionRating() ​

putMissionRating(rating): Promise<void>

Defined in: apps/api/src/store.ts:1049

Keeps a player's rating of a mission's version (again: replaced).

Parameters ​

rating ​

MissionRating

Returns ​

Promise<void>

Inherited from ​

Store.putMissionRating


putOAuthClient() ​

putOAuthClient(client): Promise<void>

Defined in: apps/api/src/store.ts:830

Saves an OAuth client.

Parameters ​

client ​

OAuthClient

Returns ​

Promise<void>

Inherited from ​

Store.putOAuthClient


putOAuthCode() ​

putOAuthCode(code): Promise<void>

Defined in: apps/api/src/store.ts:834

Saves an authorization code.

Parameters ​

code ​

OAuthCode

Returns ​

Promise<void>

Inherited from ​

Store.putOAuthCode


putOAuthGrant() ​

putOAuthGrant(grant): Promise<void>

Defined in: apps/api/src/store.ts:841

Saves a grant (insert or replace).

Parameters ​

grant ​

OAuthGrant

Returns ​

Promise<void>

Inherited from ​

Store.putOAuthGrant


putOAuthRefresh() ​

putOAuthRefresh(token): Promise<void>

Defined in: apps/api/src/store.ts:847

Saves a refresh token.

Parameters ​

token ​

OAuthRefresh

Returns ​

Promise<void>

Inherited from ​

Store.putOAuthRefresh


putRating() ​

putRating(rating): Promise<void>

Defined in: apps/api/src/store.ts:796

Saves a rating (one per game and account: a new one replaces the old).

Parameters ​

rating ​

Rating

Returns ​

Promise<void>

Inherited from ​

Store.putRating


putReport() ​

putReport(report): Promise<void>

Defined in: apps/api/src/store.ts:802

Saves a report (insert or replace; a replaced one keeps its place in the list).

Parameters ​

report ​

Report

Returns ​

Promise<void>

Inherited from ​

Store.putReport


putRun() ​

putRun(run, players): Promise<void>

Defined in: apps/api/src/store.ts:971

Saves a run and its roster (insert; the roster as it is given, by seat).

Parameters ​

run ​

Run

players ​

readonly RunPlayer[]

Returns ​

Promise<void>

Inherited from ​

Store.putRun


putSettings() ​

putSettings(settings): Promise<void>

Defined in: apps/api/src/store.ts:932

Saves the platform's settings (replacing them).

Parameters ​

settings ​

PlatformSettings

Returns ​

Promise<void>

Inherited from ​

Store.putSettings


putStanding() ​

putStanding(standing): Promise<void>

Defined in: apps/api/src/store.ts:808

Saves a game's standing (insert or replace).

Parameters ​

standing ​

GameStanding

Returns ​

Promise<void>

Inherited from ​

Store.putStanding


putTelemetry() ​

putTelemetry(record): Promise<void>

Defined in: apps/api/src/store.ts:820

Keeps a telemetry record.

Parameters ​

record ​

TelemetryRecord

Returns ​

Promise<void>

Inherited from ​

Store.putTelemetry


putTranscript() ​

putTranscript(transcript): Promise<void>

Defined in: apps/api/src/store.ts:965

Keeps a creation's transcript (insert or replace).

Parameters ​

transcript ​

Transcript

Returns ​

Promise<void>

Inherited from ​

Store.putTranscript


putVersion() ​

putVersion(version): Promise<void>

Defined in: apps/api/src/store.ts:790

Saves a game version.

Parameters ​

version ​

GameVersion

Returns ​

Promise<void>

Inherited from ​

Store.putVersion


quotaUsage() ​

quotaUsage(account, day): Promise<Partial<Record<QuotaKind, number>>>

Defined in: apps/api/src/store.ts:920

An account's uses of its quotas on a day (YYYY-MM-DD); a quota it did not use is left out.

Parameters ​

account ​

string

day ​

string

Returns ​

Promise<Partial<Record<QuotaKind, number>>>

Inherited from ​

Store.quotaUsage


ratingSummaries() ​

ratingSummaries(games): Promise<Map<string, RatingSummary>>

Defined in: apps/api/src/store.ts:800

The ratings of the games given, summed up; a game nobody rated is left out.

Parameters ​

games ​

readonly string[]

Returns ​

Promise<Map<string, RatingSummary>>

Inherited from ​

Store.ratingSummaries


refundQuota() ​

refundQuota(account, what, day): Promise<number>

Defined in: apps/api/src/store.ts:918

Gives back one use of an account's quota on a day, when it used any: its uses that day now.

Parameters ​

account ​

string

what ​

QuotaKind

day ​

string

Returns ​

Promise<number>

Inherited from ​

Store.refundQuota


removeRunPlayer() ​

removeRunPlayer(run, seat): Promise<void>

Defined in: apps/api/src/store.ts:979

Takes a seat filled under way off a run's roster again (its server refused it); nothing for a seat it has not.

Parameters ​

run ​

string

seat ​

number

Returns ​

Promise<void>

Inherited from ​

Store.removeRunPlayer


renewJob() ​

renewJob(id, attempt, leaseUntil, step?): Promise<boolean>

Defined in: apps/api/src/store.ts:880

Extends the lease of a running job's attempt, and says what it is doing now when step is given; false when that attempt no longer holds it.

Parameters ​

id ​

string

attempt ​

number

leaseUntil ​

string

step? ​

string

Returns ​

Promise<boolean>

Inherited from ​

Store.renewJob


runPlayers() ​

runPlayers(run): Promise<RunPlayer[]>

Defined in: apps/api/src/store.ts:983

A run's roster, by seat.

Parameters ​

run ​

string

Returns ​

Promise<RunPlayer[]>

Inherited from ​

Store.runPlayers


runStandingLines() ​

runStandingLines(run): Promise<StandingLine[]>

Defined in: apps/api/src/store.ts:1038

The lines of one run's ledger (every account's).

Parameters ​

run ​

string

Returns ​

Promise<StandingLine[]>

Inherited from ​

Store.runStandingLines


settleJob() ​

settleJob(job): Promise<boolean>

Defined in: apps/api/src/store.ts:886

Ends a running job's attempt, saving it as given (done, failed or cancelled, no lease), when that attempt (job.attempts) still holds it; false otherwise (its lease ran out and another process took it, or it was cancelled).

Parameters ​

job ​

Job

Returns ​

Promise<boolean>

Inherited from ​

Store.settleJob


spendLedger() ​

spendLedger(job, spent, settledAt?): Promise<void>

Defined in: apps/api/src/store.ts:961

Records what a creation spent so far (never less than it had), and settles it when settledAt is given (a settled line keeps its first settling time).

Parameters ​

job ​

string

spent ​

number

settledAt? ​

string

Returns ​

Promise<void>

Inherited from ​

Store.spendLedger


spendQuota() ​

spendQuota(account, what, day, limit): Promise<number | undefined>

Defined in: apps/api/src/store.ts:911

Counts one use of an account's quota on a day (YYYY-MM-DD, UTC), atomically, when it has used fewer than limit: its uses that day now, or undefined when none are left.

Parameters ​

account ​

string

what ​

QuotaKind

day ​

string

limit ​

number

Returns ​

Promise<number | undefined>

Inherited from ​

Store.spendQuota


staleEntitlements() ​

staleEntitlements(seenSince, checkedBefore, limit): Promise<Entitlement[]>

Defined in: apps/api/src/store.ts:950

The entitlements signed in with since a time and last checked before another (ISO), the longest unchecked first, at most limit: what the daily sweep asks Steam again.

Parameters ​

seenSince ​

string

checkedBefore ​

string

limit ​

number

Returns ​

Promise<Entitlement[]>

Inherited from ​

Store.staleEntitlements


standingLines() ​

standingLines(account, query): Promise<StandingLine[]>

Defined in: apps/api/src/store.ts:1036

An account's ledger lines a query asks for, the newest first.

Parameters ​

account ​

string

query ​

StandingQuery

Returns ​

Promise<StandingLine[]>

Inherited from ​

Store.standingLines


standings() ​

standings(): Promise<Map<string, GameStanding>>

Defined in: apps/api/src/store.ts:810

Every game's standing that a moderator ever set.

Returns ​

Promise<Map<string, GameStanding>>

Inherited from ​

Store.standings


telemetry() ​

telemetry(kind, since, limit): Promise<TelemetryRecord[]>

Defined in: apps/api/src/store.ts:822

The telemetry records of a kind since a time (ISO), newest first, at most limit.

Parameters ​

kind ​

"crash" | "event"

since ​

string

limit ​

number

Returns ​

Promise<TelemetryRecord[]>

Inherited from ​

Store.telemetry


unpaidRuns() ​

unpaidRuns(endedSince, limit): Promise<Run[]>

Defined in: apps/api/src/store.ts:1030

The settled runs that count (not playtests, not abandoned nor lost) ended since a time (ISO) whose seats were not paid yet, the oldest first, at most limit.

Parameters ​

endedSince ​

string

limit ​

number

Returns ​

Promise<Run[]>

Inherited from ​

Store.unpaidRuns


useOAuthCode() ​

useOAuthCode(hash, at): Promise<OAuthCode | undefined>

Defined in: apps/api/src/store.ts:839

Marks a code used at a time (ISO), once: the code as it was before (usedAt set when it had been used already), or undefined when there is none.

Parameters ​

hash ​

string

at ​

string

Returns ​

Promise<OAuthCode | undefined>

Inherited from ​

Store.useOAuthCode


useOAuthRefresh() ​

useOAuthRefresh(hash, at): Promise<OAuthRefresh | undefined>

Defined in: apps/api/src/store.ts:851

Marks a refresh token used at a time (ISO), once: the token as it was before, as useOAuthCode.

Parameters ​

hash ​

string

at ​

string

Returns ​

Promise<OAuthRefresh | undefined>

Inherited from ​

Store.useOAuthRefresh


versions() ​

versions(gameId): Promise<GameVersion[]>

Defined in: apps/api/src/store.ts:792

A game's versions, oldest first.

Parameters ​

gameId ​

string

Returns ​

Promise<GameVersion[]>

Inherited from ​

Store.versions


withStanding() ​

withStanding(account, name, fresh, work): Promise<{ applied: boolean; standing: PlayerStanding; }>

Defined in: apps/api/src/store.ts:1014

Pays one account's seat of a run atomically (respect.ts): its standing (a new one's, fresh, when it has none) held while work reads the account's ledger (lines, inside the same transaction: the day's repeat counted where nothing can change it meanwhile) and returns the line to apply; the line applied once (by its id) and the standing after. Postgres runs it in one transaction holding the account's row (SELECT … FOR UPDATE).

Parameters ​

account ​

string

name ​

string

fresh ​

(account, name) => PlayerStanding

work ​

(standing, lines) => Promise<StandingLine | undefined>

Returns ​

Promise<{ applied: boolean; standing: PlayerStanding; }>

Inherited from ​

Store.withStanding