Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// TransferLeg
// The purpose of this remains a mystery
export type TransferLeg = t.Branded<
{
startTime?: Units_.Time;
endTime?: Units_.Time;
mode?: TravelMode_.TransferMode;
} & {
mode: Defined;
startTime: Defined;
endTime: Defined;
},
TransferLegBrand
>;
export const TransferLeg = t.brand(
t.intersection([
t.partial({
startTime: Units_.Time,
endTime: Units_.Time,
mode: TravelMode_.TransferMode,
}),
t.type({
mode: Defined,
startTime: Defined,
endTime: Defined,
}),
]),
(
x,
): x is t.Branded<
{
startTime?: Units_.Time;
import * as t from "io-ts";
import Knex from "knex";
import { JoinedReportsMarketsRow, SortLimitParams, UIReport } from "../../types";
import { formatBigNumberAsFixed } from "../../utils/format-big-number-as-fixed";
import { queryModifier } from "./database";
export const ReportingHistoryParamsSpecific = t.type({
reporter: t.string,
universe: t.union([t.string, t.null, t.undefined]),
marketId: t.union([t.string, t.null, t.undefined]),
disputeWindow: t.union([t.string, t.null, t.undefined]),
earliestCreationTime: t.union([t.number, t.null, t.undefined]),
latestCreationTime: t.union([t.number, t.null, t.undefined]),
});
export const ReportingHistoryParams = t.intersection([
ReportingHistoryParamsSpecific,
SortLimitParams,
]);
export interface UIReports {
[universe: string]: {
[marketId: string]: {
crowdsourcers: Array>;
initialReporter: UIReport|null;
},
};
}
// Look up a user's reporting history (i.e., all reports submitted by a given reporter); should take reporter (address) as a required parameter and take market, universe, and disputeWindow all as optional parameters. For reporting windows that are complete, should also include the consensus outcome, whether the user's report matched the consensus, how much REP the user gained or lost from redistribution, and how much the user earned in reporting fees.
export async function getReportingHistory(db: Knex, augur: {}, params: t.TypeOf): Promise> {
if (params.universe == null && params.marketId == null && params.disputeWindow == null) throw new Error("Must provide reference to universe, specify universe, marketId, or disputeWindow");
export const schemaId =
'http://maasglobal.com/maas-backend/bookings/bookings-create/response.json';
// Response
// The default export. More information at the top.
export type Response = t.Branded<
{
booking?: Booking_.Booking;
debug?: {};
} & {
booking: Defined;
},
ResponseBrand
>;
export const Response = t.brand(
t.intersection([
t.partial({
booking: Booking_.Booking,
debug: t.type({}),
}),
t.type({
booking: Defined,
}),
]),
(
x,
): x is t.Branded<
{
booking?: Booking_.Booking;
debug?: {};
} & {
booking: Defined;
// Response
// The default export. More information at the top.
export type Response = t.Branded<
{
options?: Array;
additional?: {
bikeStations?: Array;
};
} & {
options: Defined;
},
ResponseBrand
>;
export const Response = t.brand(
t.intersection([
t.partial({
options: t.array(BookingOption_.BookingOption),
additional: t.partial({
bikeStations: t.array(BikeStation_.BikeStation),
}),
}),
t.type({
options: Defined,
}),
]),
(
x,
): x is t.Branded<
{
options?: Array;
additional?: {
function _resolve(id: string): Resolved {
// 1. Resolve local relative modules
if (isLocalModuleId(id)) {
return {
location: 'relative',
// We let this throw normally
filepath: resolve.sync(id, {
basedir: process.cwd()
})
}
}
const strippedId = stripVersion(id)
const Pkg = t.type({
package: t.intersection([
t.type({
name: t.string,
version: t.string
}),
t.record(t.string, t.unknown)
]),
path: t.string
})
const decodePkg = (filepath: string) =>
Pkg.decode(readPkgUp.sync({
cwd: path.dirname(filepath)
})).getOrElseL(() => {
throw new Error(`\`${id}\` has an invalid \`package.json\` file`)
})
version: t.string,
enrolled_at: t.string,
user_provided_metadata: t.dictionary(t.string, t.string),
local_metadata: t.dictionary(t.string, t.string),
shared_id: t.string,
access_api_key_id: t.string,
access_api_key: t.string,
policy_id: t.string,
});
export const NewRuntimeAgent = t.intersection([
t.interface(newAgentProperties),
newAgentOptionalProperties,
]);
export const RuntimeAgent = t.intersection([
t.interface({
...newAgentProperties,
id: t.string,
actions: t.array(RuntimeAgentAction),
current_error_events: t.array(RuntimeAgentEvent),
}),
t.partial({
last_updated: t.string,
last_checkin: t.string,
}),
newAgentOptionalProperties,
]);
export const RuntimeSavedObjectAgentAttributes = t.intersection([
t.partial({
shared_id: t.string,
readonly type: 'number';
}
const NumberSchemaObjectCodec: Codec = intersection(
[
BaseNumericSchemaObjectCodec,
type({
type: literal('number'),
}),
],
'NumberSchemaObject',
);
export interface IntegerSchemaObject extends BaseNumericSchemaObject {
readonly type: 'integer';
}
const IntegerSchemaObjectCodec: Codec = intersection(
[
BaseNumericSchemaObjectCodec,
type({
type: literal('integer'),
}),
],
'IntegerSchemaObject',
);
export interface StringSchemaObject extends BasePrimitiveSchemaObject {
readonly type: 'string';
readonly maxLength: Option;
readonly minLength: Option;
readonly pattern: Option;
}
const StringSchemaObjectCodec: Codec = intersection(
BasePrimitiveSchemaObjectCodec,
type({
type: literal('boolean'),
}),
],
'BooleanSchemaObject',
);
export interface BaseNumericSchemaObject extends BasePrimitiveSchemaObject {
readonly multipleOf: Option;
readonly maximum: Option;
readonly exclusiveMaximum: Option;
readonly minimum: Option;
readonly exclusiveMinimum: Option;
}
const BaseNumericSchemaObjectCodec: Codec = intersection(
[
BasePrimitiveSchemaObjectCodec,
type({
multipleOf: optionFromNullable(positive),
maximum: optionFromNullable(number),
exclusiveMaximum: optionFromNullable(number),
minimum: optionFromNullable(number),
exclusiveMinimum: optionFromNullable(number),
}),
],
'BaseNumericSchemaObject',
);
export interface NumberSchemaObject extends BaseNumericSchemaObject {
readonly type: 'number';
}
BasePrimitiveSchemaObjectCodec,
type({
multipleOf: optionFromNullable(positive),
maximum: optionFromNullable(number),
exclusiveMaximum: optionFromNullable(number),
minimum: optionFromNullable(number),
exclusiveMinimum: optionFromNullable(number),
}),
],
'BaseNumericSchemaObject',
);
export interface NumberSchemaObject extends BaseNumericSchemaObject {
readonly type: 'number';
}
const NumberSchemaObjectCodec: Codec = intersection(
[
BaseNumericSchemaObjectCodec,
type({
type: literal('number'),
}),
],
'NumberSchemaObject',
);
export interface IntegerSchemaObject extends BaseNumericSchemaObject {
readonly type: 'integer';
}
const IntegerSchemaObjectCodec: Codec = intersection(
[
BaseNumericSchemaObjectCodec,
type({
>;
export const Provider = t.brand(
t.intersection([
t.partial({
name: t.string,
agencyId: Common_.AgencyId,
groupId: t.string,
hidden: t.boolean,
branding: t.partial({
primaryColor: t.string,
secondaryColor: t.string,
icon: Units_.Url,
logoSolidColor: Units_.Url,
logoFullColor: Units_.Url,
}),
features: t.intersection([
t.partial({
ticket: t.boolean,
stationsList: t.boolean,
stationsRetrieve: t.boolean,
}),
t.type({
ticket: Defined,
stationsList: Defined,
stationsRetrieve: Defined,
}),
]),
extra: t.partial({
radius: t.intersection([
t.partial({
fixedFareAmount: t.number,
fixedFareCurrency: t.union([