Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import * as t from 'io-ts';
import * as Region_ from 'maas-schemas-ts/core/region';
type Defined =
| Record
| Array
| string
| boolean
| number
| null;
const Defined = t.union([
t.UnknownRecord,
t.UnknownArray,
t.string,
t.boolean,
t.number,
t.null,
]);
export const schemaId =
'http://maasglobal.com/maas-backend/regions/regions-options/response.json';
// Response
// The default export. More information at the top.
export type Response = t.Branded<
{
options?: Array;
debug?: {};
} & {
options: Defined;
},
*/
import * as t from 'io-ts';
type Defined =
| Record
| Array
| string
| boolean
| number
| null;
const Defined = t.union([
t.UnknownRecord,
t.UnknownArray,
t.string,
t.boolean,
t.number,
t.null,
]);
export const schemaId = 'http://maasglobal.com/core/components/units-geo.json';
// Latitude
// Geographic latitude (north-south axis) in WGS-84 system, see https://en.wikipedia.org/wiki/World_Geodetic_System
export type Latitude = t.Branded;
export const Latitude = t.brand(
t.number,
(x): x is t.Branded =>
(typeof x !== 'number' || x >= -90) && (typeof x !== 'number' || x <= 90),
'Latitude',
);
export interface LatitudeBrand {
const licenseLiterals = LICENSES.map(s => t.literal(s));
if (licenseLiterals.length < 2) {
throw new Error('expected LICENSES array to include at least 2 items');
}
export const RuntimeFrameworkInfo = t.type({
basePath: t.string,
license: t.type({
type: t.union([licenseLiterals[0], licenseLiterals[1], ...licenseLiterals.slice(2)]),
expired: t.boolean,
expiry_date_in_millis: t.number,
}),
security: t.type({
enabled: t.boolean,
available: t.boolean,
}),
settings: t.type({
// encryptionKey: t.string,
// enrollmentTokensTtlInSeconds: t.number,
// defaultUserRoles: t.array(t.string),
}),
});
export interface FrameworkInfo extends t.TypeOf {}
interface ManagementSection {
register(
sectionId: string,
options: {
visible: boolean;
display: string;
Validation,
ValidationError,
} from 'io-ts';
import { pipe } from 'fp-ts/lib/pipeable';
import { array, either, option } from 'fp-ts';
import { Either } from 'fp-ts/lib/Either';
import { setFromArray } from 'io-ts-types/lib/setFromArray';
import { Ord } from 'fp-ts/lib/Ord';
export interface Codec<a> extends Type {}
export const stringOption = optionFromNullable(t.string);
export const booleanOption = optionFromNullable(t.boolean);
export const numberOption = optionFromNullable(t.number);
export const stringArrayOption = optionFromNullable(t.array(t.string));
export const primitiveArrayOption = optionFromNullable(t.array(t.union([t.string, t.boolean, t.number])));
export const dictionary = (codec: C, name?: string): RecordC =>
record(string, codec, name);
export const reportIfFailed = </a><a>(validation: Validation</a><a>): Either =>
pipe(
validation,
either.mapLeft(e =>
pipe(
array.last(e),
option.fold(
() => new Error('Validation failure should contain at least one error'),
e => new Error(getMessage(e)),
),
),
),</a>
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
import * as t from 'io-ts';
export const NewRuleSchema = t.intersection([
t.type({
description: t.string,
enabled: t.boolean,
filters: t.array(t.unknown),
index: t.array(t.string),
interval: t.string,
language: t.string,
name: t.string,
query: t.string,
risk_score: t.number,
severity: t.string,
type: t.union([t.literal('query'), t.literal('saved_query')]),
}),
t.partial({
created_by: t.string,
false_positives: t.array(t.string),
from: t.string,
id: t.string,
max_signals: t.number,
owner: ShortcodeMediaOwner,
is_ad: t.boolean,
edge_web_media_to_related_media: EdgeMediaToCaption,
edge_sidecar_to_children: t.union([EdgeSidecarToChildren, t.undefined]),
dash_info: t.union([
t.undefined,
t.type({
is_dash_eligible: t.boolean,
video_dash_manifest: t.null,
number_of_qualities: t.number,
}),
]),
video_url: t.union([t.undefined, t.string]),
video_view_count: t.union([t.undefined, t.number]),
encoding_status: t.union([t.undefined, t.string, t.null]),
is_published: t.union([t.undefined, t.boolean]),
product_type: t.union([t.undefined, t.string]),
title: t.union([t.undefined, t.string, t.null]),
video_duration: t.union([t.undefined, t.number]),
});
export const SinglePost = t.type({
shortcode_media: excess(ShortcodeMedia),
});
export const FullApiPost = t.type({
shortcode_media: excess(
t.type({
...ShortcodeMedia.props,
location: t.union([Location, t.null]),
}),
),
})
),
displayName: t.union([
t.string,
t.type({
name: t.string,
color: t.string
})
]),
extraGlobals: t.array(t.string),
globalSetup: t.string,
globalTeardown: t.string,
moduleNameMapper: t.record(t.string, t.string),
resetMocks: t.boolean,
resetModules: t.boolean,
restoreMocks: t.boolean,
snapshotSerializers: t.array(t.string),
transform: t.record(
t.string,
t.union([t.string, t.tuple([t.string, t.object])])
),
transformIgnorePatterns: t.array(t.string),
watchPathIgnorePatterns: t.array(t.string)
})
),
webpack: t.partial({
modifier: t.Function,
entry: t.union([
t.string,
t.dictionary(t.string, t.string),
t.array(t.string)
]),
import { ZeppelinPlugin } from "./ZeppelinPlugin";
import { decorators as d, IPluginOptions } from "knub";
import { Member, TextChannel } from "eris";
import { renderTemplate } from "../templateFormatter";
import { createChunkedMessage, stripObjectToScalars, tNullable } from "../utils";
import { LogType } from "../data/LogType";
import { GuildLogs } from "../data/GuildLogs";
import * as t from "io-ts";
const ConfigSchema = t.type({
send_dm: t.boolean,
send_to_channel: tNullable(t.string),
message: t.string,
});
type TConfigSchema = t.TypeOf;
export class WelcomeMessagePlugin extends ZeppelinPlugin {
public static pluginName = "welcome_message";
public static configSchema = ConfigSchema;
public static pluginInfo = {
prettyName: "Welcome message",
};
protected logs: GuildLogs;
public static getStaticDefaultOptions(): IPluginOptions {
import * as t from "io-ts";
import * as _ from "lodash";
import Knex from "knex";
import { Bytes32, OrdersRow, OrderState, OutcomeParam, SortLimitParams, UIOrder, UIOrders } from "../../types";
import { queryModifier } from "./database";
import { formatBigNumberAsFixed } from "../../utils/format-big-number-as-fixed";
export const OrdersParamsSpecific = t.type({
universe: t.union([t.string, t.null, t.undefined]),
marketId: t.union([t.string, t.null, t.undefined]),
outcome: t.union([OutcomeParam, t.number, t.null, t.undefined]),
orderType: t.union([t.string, t.null, t.undefined]),
creator: t.union([t.string, t.null, t.undefined]),
orderState: t.union([t.string, t.null, t.undefined]),
orphaned: t.union([t.boolean, t.null, t.undefined]),
earliestCreationTime: t.union([t.number, t.null, t.undefined]),
latestCreationTime: t.union([t.number, t.null, t.undefined]),
});
export const OrdersParams = t.intersection([
OrdersParamsSpecific,
SortLimitParams,
]);
interface OrdersRowWithCreationTimeAndCanceled extends OrdersRow {
creationTime: number;
canceledBlockNumber: Bytes32|null;
canceledTransactionHash: Bytes32|null;
canceledTime: number;
}
import { decorators as d, IPluginOptions, getInviteLink, logger } from "knub";
import { trimPluginDescription, ZeppelinPlugin } from "./ZeppelinPlugin";
import humanizeDuration from "humanize-duration";
import { Message, Member, Guild, TextableChannel, VoiceChannel, Channel, User } from "eris";
import { GuildVCAlerts } from "../data/GuildVCAlerts";
import moment from "moment-timezone";
import { resolveMember, sorter, createChunkedMessage, errorMessage, successMessage, MINUTES } from "../utils";
import * as t from "io-ts";
const ConfigSchema = t.type({
can_where: t.boolean,
can_alert: t.boolean,
});
type TConfigSchema = t.TypeOf;
const ALERT_LOOP_TIME = 30 * 1000;
export class LocatePlugin extends ZeppelinPlugin {
public static pluginName = "locate_user";
public static configSchema = ConfigSchema;
public static pluginInfo = {
prettyName: "Locate user",
description: trimPluginDescription(`
This plugin allows users with access to the commands the following:
* Instantly receive an invite to the voice channel of a user
* Be notified as soon as a user switches or joins a voice channel