Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it('type', () => {
const T = t.keyof({
a: null,
b: null
})
const match = pipe(
lit('search'),
then(type('topic', T))
)
assert.deepStrictEqual(match.parser.run(Route.parse('/search/a')), some([{ topic: 'a' }, Route.empty]))
assert.deepStrictEqual(match.parser.run(Route.parse('/search/b')), some([{ topic: 'b' }, Route.empty]))
assert.deepStrictEqual(match.parser.run(Route.parse('/search/')), none)
})
PLC4X: true,
PLC4XTransform: true,
PLC5Y: true,
PLC5X: true,
PLC5XTransform: true,
PointToPoint: true,
IAReference: true,
'Logit-4': true,
'Logit-5': true
})
export type ICQCalibrationType =
| 'Full'
| 'Adjust'
export const ICQCalibrationType = t.keyof({
Full: true,
Adjust: true
})
export type ICQCalibrationStatus =
| 'NoCal'
| 'Ok'
| 'Failed'
| 'Expired'
| 'Overridden'
| 'OverriddenLot'
| 'PendingQC'
| 'InProcess'
export const ICQCalibrationStatus = t.keyof({
NoCal: true,
import * as t from "io-ts";
import Knex from "knex";
import { formatBigNumberAsFixed } from "../../utils/format-big-number-as-fixed";
import { BigNumber, DisputeTokensRowWithTokenState, ReportingState, UIDisputeTokenInfo, UIDisputeTokens } from "../../types";
import { reshapeDisputeTokensRowToUIDisputeTokenInfo } from "./database";
export const DisputeTokenState = t.keyof({
ALL: null,
UNCLAIMED: null,
UNFINALIZED: null,
});
export const DisputeTokensParams = t.type({
universe: t.string,
account: t.string,
stakeTokenState: t.union([DisputeTokenState, t.null, t.undefined]),
});
export async function getDisputeTokens(db: Knex, augur: {}, params: t.TypeOf) {
const query: Knex.QueryBuilder = db.select(["payouts.*", "disputes.crowdsourcerId as disputeToken", "balances.balance", "market_state.reportingState"]).from("disputes");
query.join("markets", "markets.marketId", "crowdsourcers.marketId");
query.leftJoin("market_state", "markets.marketStateId", "market_state.marketStateId");
query.leftJoin("blocks", "markets.creationBlockNumber", "blocks.blockNumber");
})
),
});
return pipe(
fetchJobStatusResponsePayloadRT.decode(response),
fold(throwErrors(createPlainError), identity)
);
};
export const fetchJobStatusRequestPayloadRT = rt.type({
jobIds: rt.array(rt.string),
});
export type FetchJobStatusRequestPayload = rt.TypeOf;
const datafeedStateRT = rt.keyof({
started: null,
stopped: null,
'': null,
});
const jobStateRT = rt.keyof({
closed: null,
closing: null,
deleting: null,
failed: null,
opened: null,
opening: null,
});
export const jobSummaryRT = rt.intersection([
rt.type({
function isMetricExplorerOptions(subject: any): subject is MetricsExplorerOptions {
const MetricRequired = t.type({
aggregation: t.string,
});
const MetricOptional = t.partial({
field: t.string,
rate: t.boolean,
color: t.keyof(Object.fromEntries(values(MetricsExplorerColor).map(c => [c, null])) as Record<
string,
null
>),
label: t.string,
});
const Metric = t.intersection([MetricRequired, MetricOptional]);
const OptionsRequired = t.type({
aggregation: t.string,
metrics: t.array(Metric),
});
const OptionsOptional = t.partial({
limit: t.number,
groupBy: t.string,
bar: null,
});
export type InventoryVisType = rt.TypeOf;
export const InventoryFormatterTypeRT = rt.keyof({
abbreviatedNumber: null,
bits: null,
bytes: null,
number: null,
percent: null,
});
export type InventoryFormatterType = rt.TypeOf;
export type InventoryItemType = rt.TypeOf;
export const InventoryMetricRT = rt.keyof({
hostSystemOverview: null,
hostCpuUsage: null,
hostFilesystem: null,
hostK8sOverview: null,
hostK8sCpuCap: null,
hostK8sDiskCap: null,
hostK8sMemoryCap: null,
hostK8sPodCap: null,
hostLoad: null,
hostMemoryUsage: null,
hostNetworkTraffic: null,
hostDockerOverview: null,
hostDockerInfo: null,
hostDockerTop5ByCpu: null,
hostDockerTop5ByMemory: null,
podOverview: null,
import * as t from 'io-ts'
const TrueOrFalse = t.keyof({
true: null,
false: null
})
export class BooleanFromStringType extends t.Type {
readonly _tag: 'BooleanFromStringType' = 'BooleanFromStringType'
constructor() {
super('BooleanFromString', t.boolean.is, (u, c) => TrueOrFalse.validate(u, c).map(tof => tof === 'true'), String)
}
}
export interface BooleanFromStringC extends BooleanFromStringType {}
export const BooleanFromString: BooleanFromStringC = new BooleanFromStringType()
container: null,
awsEC2: null,
awsS3: null,
awsSQS: null,
awsRDS: null,
});
export const InventoryVisTypeRT = rt.keyof({
line: null,
area: null,
bar: null,
});
export type InventoryVisType = rt.TypeOf;
export const InventoryFormatterTypeRT = rt.keyof({
abbreviatedNumber: null,
bits: null,
bytes: null,
number: null,
percent: null,
});
export type InventoryFormatterType = rt.TypeOf;
export type InventoryItemType = rt.TypeOf;
export const InventoryMetricRT = rt.keyof({
hostSystemOverview: null,
hostCpuUsage: null,
hostFilesystem: null,
hostK8sOverview: null,
hostK8sCpuCap: null,
hostK8sDiskCap: null,
function isMetricExplorerChartOptions(subject: any): subject is MetricsExplorerChartOptions {
const ChartOptions = t.type({
yAxisMode: t.keyof(Object.fromEntries(
values(MetricsExplorerYAxisMode).map(v => [v, null])
) as Record),
type: t.keyof(Object.fromEntries(
values(MetricsExplorerChartType).map(v => [v, null])
) as Record),
stack: t.boolean,
});
const result = ChartOptions.decode(subject);
try {
ThrowReporter.report(result);
return true;
} catch (e) {
return false;
}
}