type
stringclasses 7
values | content
stringlengths 4
9.55k
| repo
stringlengths 7
96
| path
stringlengths 4
178
| language
stringclasses 1
value |
|---|---|---|---|---|
ArrowFunction
|
async ({ ally }) => {
try {
const apple = ally.use('apple')
if (apple.accessDenied()) {
return 'Access was denied'
}
if (apple.stateMisMatch()) {
return 'Request expired. Retry again'
}
if (apple.hasError()) {
return apple.getError()
}
const user = await apple.user()
return user
} catch (error) {
console.log({ error: error.response })
throw error
}
}
|
bitkidd/adonis-ally
|
examples/apple.ts
|
TypeScript
|
ArrowFunction
|
(node) => {
if (!isElementDomNode(node)) {
return {};
}
return {
...extra.parse(node),
order: +(node.getAttribute('start') ?? 1),
};
}
|
MarielleSarmiento/remirror
|
packages/remirror__extension-list/src/ordered-list-extension.ts
|
TypeScript
|
ArrowFunction
|
(node) => {
const extraAttributes = extra.dom(node);
return node.attrs.order === 1
? ['ol', extraAttributes, 0]
: ['ol', { ...extraAttributes, start: node.attrs.order }, 0];
}
|
MarielleSarmiento/remirror
|
packages/remirror__extension-list/src/ordered-list-extension.ts
|
TypeScript
|
ArrowFunction
|
({ t }) => t(Messages.ORDERED_LIST_LABEL)
|
MarielleSarmiento/remirror
|
packages/remirror__extension-list/src/ordered-list-extension.ts
|
TypeScript
|
ArrowFunction
|
(match) => ({ order: +assertGet(match, 1) })
|
MarielleSarmiento/remirror
|
packages/remirror__extension-list/src/ordered-list-extension.ts
|
TypeScript
|
ArrowFunction
|
(match, node) => node.childCount + (node.attrs.order as number) === +assertGet(match, 1)
|
MarielleSarmiento/remirror
|
packages/remirror__extension-list/src/ordered-list-extension.ts
|
TypeScript
|
ClassDeclaration
|
/**
* Creates the list for the ordered list.
*/
@extension({})
export class OrderedListExtension extends NodeExtension {
get name() {
return 'orderedList' as const;
}
createTags() {
return [ExtensionTag.Block, ExtensionTag.ListContainerNode];
}
createNodeSpec(extra: ApplySchemaAttributes, override: NodeSpecOverride): NodeExtensionSpec {
return {
content: 'listItem+',
...override,
attrs: {
...extra.defaults(),
order: {
default: 1,
},
},
parseDOM: [
{
tag: 'ol',
getAttrs: (node) => {
if (!isElementDomNode(node)) {
return {};
}
return {
...extra.parse(node),
order: +(node.getAttribute('start') ?? 1),
};
},
},
],
toDOM: (node) => {
const extraAttributes = extra.dom(node);
return node.attrs.order === 1
? ['ol', extraAttributes, 0]
: ['ol', { ...extraAttributes, start: node.attrs.order }, 0];
},
};
}
/**
* Automatically add the `ListItemExtension` which is required here.
*/
createExtensions() {
return [new ListItemExtension()];
}
/**
* Toggle the ordered list for the current selection.
*/
@command({ icon: 'listOrdered', label: ({ t }) => t(Messages.ORDERED_LIST_LABEL) })
toggleOrderedList(): CommandFunction {
return toggleList(this.type, assertGet(this.store.schema.nodes, 'listItem'));
}
@keyBinding({ shortcut: NamedShortcut.OrderedList, command: 'toggleOrderedList' })
listShortcut(props: KeyBindingProps): boolean {
return this.toggleOrderedList()(props);
}
createInputRules(): InputRule[] {
return [
wrappingInputRule(
/^(\d+)\.\s$/,
this.type,
(match) => ({ order: +assertGet(match, 1) }),
(match, node) => node.childCount + (node.attrs.order as number) === +assertGet(match, 1),
),
];
}
}
|
MarielleSarmiento/remirror
|
packages/remirror__extension-list/src/ordered-list-extension.ts
|
TypeScript
|
InterfaceDeclaration
|
interface AllExtensions {
orderedList: OrderedListExtension;
}
|
MarielleSarmiento/remirror
|
packages/remirror__extension-list/src/ordered-list-extension.ts
|
TypeScript
|
MethodDeclaration
|
createTags() {
return [ExtensionTag.Block, ExtensionTag.ListContainerNode];
}
|
MarielleSarmiento/remirror
|
packages/remirror__extension-list/src/ordered-list-extension.ts
|
TypeScript
|
MethodDeclaration
|
createNodeSpec(extra: ApplySchemaAttributes, override: NodeSpecOverride): NodeExtensionSpec {
return {
content: 'listItem+',
...override,
attrs: {
...extra.defaults(),
order: {
default: 1,
},
},
parseDOM: [
{
tag: 'ol',
getAttrs: (node) => {
if (!isElementDomNode(node)) {
return {};
}
return {
...extra.parse(node),
order: +(node.getAttribute('start') ?? 1),
};
},
},
],
toDOM: (node) => {
const extraAttributes = extra.dom(node);
return node.attrs.order === 1
? ['ol', extraAttributes, 0]
: ['ol', { ...extraAttributes, start: node.attrs.order }, 0];
},
};
}
|
MarielleSarmiento/remirror
|
packages/remirror__extension-list/src/ordered-list-extension.ts
|
TypeScript
|
MethodDeclaration
|
/**
* Automatically add the `ListItemExtension` which is required here.
*/
createExtensions() {
return [new ListItemExtension()];
}
|
MarielleSarmiento/remirror
|
packages/remirror__extension-list/src/ordered-list-extension.ts
|
TypeScript
|
MethodDeclaration
|
/**
* Toggle the ordered list for the current selection.
*/
@command({ icon: 'listOrdered', label: ({ t }) => t(Messages.ORDERED_LIST_LABEL) })
toggleOrderedList(): CommandFunction {
return toggleList(this.type, assertGet(this.store.schema.nodes, 'listItem'));
}
|
MarielleSarmiento/remirror
|
packages/remirror__extension-list/src/ordered-list-extension.ts
|
TypeScript
|
MethodDeclaration
|
@keyBinding({ shortcut: NamedShortcut.OrderedList, command: 'toggleOrderedList' })
listShortcut(props: KeyBindingProps): boolean {
return this.toggleOrderedList()(props);
}
|
MarielleSarmiento/remirror
|
packages/remirror__extension-list/src/ordered-list-extension.ts
|
TypeScript
|
MethodDeclaration
|
createInputRules(): InputRule[] {
return [
wrappingInputRule(
/^(\d+)\.\s$/,
this.type,
(match) => ({ order: +assertGet(match, 1) }),
(match, node) => node.childCount + (node.attrs.order as number) === +assertGet(match, 1),
),
];
}
|
MarielleSarmiento/remirror
|
packages/remirror__extension-list/src/ordered-list-extension.ts
|
TypeScript
|
InterfaceDeclaration
|
export interface Parse {
(context: Context, options?: Options): Promise<any>;
text: (context: Context, options?: Options) => Promise<any>;
form: (context: Context, options?: Options) => Promise<any>;
json: (context: Context, options?: Options) => Promise<any>;
}
|
0815Strohhut/DefinitelyTyped
|
types/co-body/index.d.ts
|
TypeScript
|
InterfaceDeclaration
|
export interface Options {
limit?: number | string;
strict?: boolean;
queryString?: qs.IParseOptions;
jsonTypes?: string[];
returnRawBody?: boolean;
formTypes?: string[];
textTypes?: string[];
encoding?: string;
length?: number;
}
|
0815Strohhut/DefinitelyTyped
|
types/co-body/index.d.ts
|
TypeScript
|
TypeAliasDeclaration
|
type Context = http.IncomingMessage | Koa.Context;
|
0815Strohhut/DefinitelyTyped
|
types/co-body/index.d.ts
|
TypeScript
|
ClassDeclaration
|
@Component({
selector: 'rv-msg-detail-owner',
templateUrl: './msg-detail-owner.component.html',
styleUrls: ['./msg-detail-owner.component.scss'],
encapsulation: ViewEncapsulation.None
})
export class MsgDetailOwnerComponent implements OnInit {
constructor() { }
ngOnInit() {
}
}
|
gutropolis/rvtrailer
|
src/app/shared/msg-detail-owner/msg-detail-owner.component.ts
|
TypeScript
|
MethodDeclaration
|
ngOnInit() {
}
|
gutropolis/rvtrailer
|
src/app/shared/msg-detail-owner/msg-detail-owner.component.ts
|
TypeScript
|
FunctionDeclaration
|
function expandPathResolving(path: string) {
if (path.startsWith('~/')) {
return path.replace('~', homedir());
}
return path;
}
|
0xc0deface/rust-analyzer
|
editors/code/src/server.ts
|
TypeScript
|
ArrowFunction
|
(messageOrDataObject: string | any, data?: string) => {
if (typeof messageOrDataObject === 'string') {
if (
messageOrDataObject.includes(
'rust-analyzer/publishDecorations'
) ||
messageOrDataObject.includes(
'rust-analyzer/decorationsRequest'
)
) {
// Don't log publish decorations requests
} else {
// @ts-ignore This is just a utility function
Server.client.logTrace(messageOrDataObject, data);
}
} else {
// @ts-ignore
Server.client.logObjectTrace(messageOrDataObject);
}
}
|
0xc0deface/rust-analyzer
|
editors/code/src/server.ts
|
TypeScript
|
ArrowFunction
|
() => {
for (const [type, handler] of notificationHandlers) {
Server.client.onNotification(type, handler);
}
}
|
0xc0deface/rust-analyzer
|
editors/code/src/server.ts
|
TypeScript
|
ClassDeclaration
|
export class Server {
public static highlighter = new Highlighter();
public static config = new Config();
public static client: lc.LanguageClient;
public static start(
notificationHandlers: Iterable<[string, lc.GenericNotificationHandler]>
) {
// '.' Is the fallback if no folder is open
// TODO?: Workspace folders support Uri's (eg: file://test.txt). It might be a good idea to test if the uri points to a file.
let folder: string = '.';
if (workspace.workspaceFolders !== undefined) {
folder = workspace.workspaceFolders[0].uri.fsPath.toString();
}
const run: lc.Executable = {
command: expandPathResolving(this.config.raLspServerPath),
options: { cwd: folder }
};
const serverOptions: lc.ServerOptions = {
run,
debug: run
};
const traceOutputChannel = window.createOutputChannel(
'Rust Analyzer Language Server Trace'
);
const clientOptions: lc.LanguageClientOptions = {
documentSelector: [{ scheme: 'file', language: 'rust' }],
initializationOptions: {
publishDecorations: true,
lruCapacity: Server.config.lruCapacity,
maxInlayHintLength: Server.config.maxInlayHintLength,
excludeGlobs: Server.config.excludeGlobs,
useClientWatching: Server.config.useClientWatching,
featureFlags: Server.config.featureFlags
},
traceOutputChannel
};
Server.client = new lc.LanguageClient(
'rust-analyzer',
'Rust Analyzer Language Server',
serverOptions,
clientOptions
);
// HACK: This is an awful way of filtering out the decorations notifications
// However, pending proper support, this is the most effecitve approach
// Proper support for this would entail a change to vscode-languageclient to allow not notifying on certain messages
// Or the ability to disable the serverside component of highlighting (but this means that to do tracing we need to disable hihlighting)
// This also requires considering our settings strategy, which is work which needs doing
// @ts-ignore The tracer is private to vscode-languageclient, but we need access to it to not log publishDecorations requests
Server.client._tracer = {
log: (messageOrDataObject: string | any, data?: string) => {
if (typeof messageOrDataObject === 'string') {
if (
messageOrDataObject.includes(
'rust-analyzer/publishDecorations'
) ||
messageOrDataObject.includes(
'rust-analyzer/decorationsRequest'
)
) {
// Don't log publish decorations requests
} else {
// @ts-ignore This is just a utility function
Server.client.logTrace(messageOrDataObject, data);
}
} else {
// @ts-ignore
Server.client.logObjectTrace(messageOrDataObject);
}
}
};
Server.client.registerProposedFeatures();
Server.client.onReady().then(() => {
for (const [type, handler] of notificationHandlers) {
Server.client.onNotification(type, handler);
}
});
Server.client.start();
}
}
|
0xc0deface/rust-analyzer
|
editors/code/src/server.ts
|
TypeScript
|
MethodDeclaration
|
public static start(
notificationHandlers: Iterable<[string, lc.GenericNotificationHandler]>
) {
// '.' Is the fallback if no folder is open
// TODO?: Workspace folders support Uri's (eg: file://test.txt). It might be a good idea to test if the uri points to a file.
let folder: string = '.';
if (workspace.workspaceFolders !== undefined) {
folder = workspace.workspaceFolders[0].uri.fsPath.toString();
}
const run: lc.Executable = {
command: expandPathResolving(this.config.raLspServerPath),
options: { cwd: folder }
};
const serverOptions: lc.ServerOptions = {
run,
debug: run
};
const traceOutputChannel = window.createOutputChannel(
'Rust Analyzer Language Server Trace'
);
const clientOptions: lc.LanguageClientOptions = {
documentSelector: [{ scheme: 'file', language: 'rust' }],
initializationOptions: {
publishDecorations: true,
lruCapacity: Server.config.lruCapacity,
maxInlayHintLength: Server.config.maxInlayHintLength,
excludeGlobs: Server.config.excludeGlobs,
useClientWatching: Server.config.useClientWatching,
featureFlags: Server.config.featureFlags
},
traceOutputChannel
};
Server.client = new lc.LanguageClient(
'rust-analyzer',
'Rust Analyzer Language Server',
serverOptions,
clientOptions
);
// HACK: This is an awful way of filtering out the decorations notifications
// However, pending proper support, this is the most effecitve approach
// Proper support for this would entail a change to vscode-languageclient to allow not notifying on certain messages
// Or the ability to disable the serverside component of highlighting (but this means that to do tracing we need to disable hihlighting)
// This also requires considering our settings strategy, which is work which needs doing
// @ts-ignore The tracer is private to vscode-languageclient, but we need access to it to not log publishDecorations requests
Server.client._tracer = {
log: (messageOrDataObject: string | any, data?: string) => {
if (typeof messageOrDataObject === 'string') {
if (
messageOrDataObject.includes(
'rust-analyzer/publishDecorations'
) ||
messageOrDataObject.includes(
'rust-analyzer/decorationsRequest'
)
) {
// Don't log publish decorations requests
} else {
// @ts-ignore This is just a utility function
Server.client.logTrace(messageOrDataObject, data);
}
} else {
// @ts-ignore
Server.client.logObjectTrace(messageOrDataObject);
}
}
};
Server.client.registerProposedFeatures();
Server.client.onReady().then(() => {
for (const [type, handler] of notificationHandlers) {
Server.client.onNotification(type, handler);
}
});
Server.client.start();
}
|
0xc0deface/rust-analyzer
|
editors/code/src/server.ts
|
TypeScript
|
FunctionDeclaration
|
async function writeFiles(testInfo: TestInfo, files: Files) {
const baseDir = testInfo.outputPath();
const headerJS = `
const pwt = require('@playwright/test');
`;
const headerTS = `
import * as pwt from '@playwright/test';
`;
const headerESM = `
import * as pwt from '@playwright/test';
`;
const hasConfig = Object.keys(files).some(name => name.includes('.config.'));
if (!hasConfig) {
files = {
...files,
'playwright.config.ts': `
module.exports = { projects: [ {} ] };
`,
};
}
await Promise.all(Object.keys(files).map(async name => {
const fullName = path.join(baseDir, name);
await fs.promises.mkdir(path.dirname(fullName), { recursive: true });
const isTypeScriptSourceFile = name.endsWith('.ts') && !name.endsWith('.d.ts');
const isJSModule = name.endsWith('.mjs') || name.includes('esm');
const header = isTypeScriptSourceFile ? headerTS : (isJSModule ? headerESM : headerJS);
if (typeof files[name] === 'string' && files[name].includes('//@no-header')) {
await fs.promises.writeFile(fullName, files[name]);
} else if (/(spec|test)\.(js|ts|mjs)$/.test(name)) {
const fileHeader = header + 'const { expect } = pwt;\n';
await fs.promises.writeFile(fullName, fileHeader + files[name]);
} else if (/\.(js|ts)$/.test(name) && !name.endsWith('d.ts')) {
await fs.promises.writeFile(fullName, header + files[name]);
} else {
await fs.promises.writeFile(fullName, files[name]);
}
}));
return baseDir;
}
|
yongdamsh/playwright
|
tests/playwright-test/playwright-test-fixtures.ts
|
TypeScript
|
FunctionDeclaration
|
async function runPlaywrightTest(childProcess: CommonFixtures['childProcess'], baseDir: string, params: any, env: Env, options: RunOptions): Promise<RunResult> {
const paramList = [];
for (const key of Object.keys(params)) {
for (const value of Array.isArray(params[key]) ? params[key] : [params[key]]) {
const k = key.startsWith('-') ? key : '--' + key;
paramList.push(params[key] === true ? `${k}` : `${k}=${value}`);
}
}
const outputDir = path.join(baseDir, 'test-results');
const reportFile = path.join(outputDir, 'report.json');
const args = ['node', cliEntrypoint, 'test'];
if (!options.usesCustomOutputDir)
args.push('--output=' + outputDir);
args.push(
'--reporter=dot,json',
'--workers=2',
...paramList
);
if (options.additionalArgs)
args.push(...options.additionalArgs);
const cacheDir = fs.mkdtempSync(path.join(os.tmpdir(), 'playwright-test-cache-'));
const testProcess = childProcess({
command: args,
env: {
...process.env,
PLAYWRIGHT_JSON_OUTPUT_NAME: reportFile,
PWTEST_CACHE_DIR: cacheDir,
PWTEST_SKIP_TEST_OUTPUT: '1',
...env,
PLAYWRIGHT_DOCKER: undefined,
PW_GRID: undefined,
},
cwd: baseDir,
});
let didSendSigint = false;
testProcess.onOutput = () => {
if (options.sendSIGINTAfter && !didSendSigint && countTimes(testProcess.output, '%%SEND-SIGINT%%') >= options.sendSIGINTAfter) {
didSendSigint = true;
process.kill(testProcess.process.pid, 'SIGINT');
}
};
const { exitCode } = await testProcess.exited;
await removeFolderAsync(cacheDir);
const outputString = testProcess.output.toString();
const summary = (re: RegExp) => {
let result = 0;
let match = re.exec(outputString);
while (match) {
result += (+match[1]);
match = re.exec(outputString);
}
return result;
};
const passed = summary(/(\d+) passed/g);
const failed = summary(/(\d+) failed/g);
const flaky = summary(/(\d+) flaky/g);
const skipped = summary(/(\d+) skipped/g);
let report;
try {
report = JSON.parse(fs.readFileSync(reportFile).toString());
} catch (e) {
testProcess.output += '\n' + e.toString();
}
const results = [];
function visitSuites(suites?: JSONReportSuite[]) {
if (!suites)
return;
for (const suite of suites) {
for (const spec of suite.specs) {
for (const test of spec.tests)
results.push(...test.results);
}
visitSuites(suite.suites);
}
}
if (report)
visitSuites(report.suites);
return {
exitCode,
output: testProcess.output,
passed,
failed,
flaky,
skipped,
report,
results,
};
}
|
yongdamsh/playwright
|
tests/playwright-test/playwright-test-fixtures.ts
|
TypeScript
|
FunctionDeclaration
|
function visitSuites(suites?: JSONReportSuite[]) {
if (!suites)
return;
for (const suite of suites) {
for (const spec of suite.specs) {
for (const test of spec.tests)
results.push(...test.results);
}
visitSuites(suite.suites);
}
}
|
yongdamsh/playwright
|
tests/playwright-test/playwright-test-fixtures.ts
|
TypeScript
|
FunctionDeclaration
|
export function stripAnsi(str: string): string {
return str.replace(asciiRegex, '');
}
|
yongdamsh/playwright
|
tests/playwright-test/playwright-test-fixtures.ts
|
TypeScript
|
FunctionDeclaration
|
export function countTimes(s: string, sub: string): number {
let result = 0;
for (let index = 0; index !== -1;) {
index = s.indexOf(sub, index);
if (index !== -1) {
result++;
index += sub.length;
}
}
return result;
}
|
yongdamsh/playwright
|
tests/playwright-test/playwright-test-fixtures.ts
|
TypeScript
|
ArrowFunction
|
name => name.includes('.config.')
|
yongdamsh/playwright
|
tests/playwright-test/playwright-test-fixtures.ts
|
TypeScript
|
ArrowFunction
|
async name => {
const fullName = path.join(baseDir, name);
await fs.promises.mkdir(path.dirname(fullName), { recursive: true });
const isTypeScriptSourceFile = name.endsWith('.ts') && !name.endsWith('.d.ts');
const isJSModule = name.endsWith('.mjs') || name.includes('esm');
const header = isTypeScriptSourceFile ? headerTS : (isJSModule ? headerESM : headerJS);
if (typeof files[name] === 'string' && files[name].includes('//@no-header')) {
await fs.promises.writeFile(fullName, files[name]);
} else if (/(spec|test)\.(js|ts|mjs)$/.test(name)) {
const fileHeader = header + 'const { expect } = pwt;\n';
await fs.promises.writeFile(fullName, fileHeader + files[name]);
} else if (/\.(js|ts)$/.test(name) && !name.endsWith('d.ts')) {
await fs.promises.writeFile(fullName, header + files[name]);
} else {
await fs.promises.writeFile(fullName, files[name]);
}
}
|
yongdamsh/playwright
|
tests/playwright-test/playwright-test-fixtures.ts
|
TypeScript
|
ArrowFunction
|
() => {
if (options.sendSIGINTAfter && !didSendSigint && countTimes(testProcess.output, '%%SEND-SIGINT%%') >= options.sendSIGINTAfter) {
didSendSigint = true;
process.kill(testProcess.process.pid, 'SIGINT');
}
}
|
yongdamsh/playwright
|
tests/playwright-test/playwright-test-fixtures.ts
|
TypeScript
|
ArrowFunction
|
(re: RegExp) => {
let result = 0;
let match = re.exec(outputString);
while (match) {
result += (+match[1]);
match = re.exec(outputString);
}
return result;
}
|
yongdamsh/playwright
|
tests/playwright-test/playwright-test-fixtures.ts
|
TypeScript
|
ArrowFunction
|
async ({}, use, testInfo) => {
await use(files => writeFiles(testInfo, files));
}
|
yongdamsh/playwright
|
tests/playwright-test/playwright-test-fixtures.ts
|
TypeScript
|
ArrowFunction
|
files => writeFiles(testInfo, files)
|
yongdamsh/playwright
|
tests/playwright-test/playwright-test-fixtures.ts
|
TypeScript
|
ArrowFunction
|
async ({ childProcess }, use, testInfo: TestInfo) => {
await use(async (files: Files, params: Params = {}, env: Env = {}, options: RunOptions = {}) => {
const baseDir = await writeFiles(testInfo, files);
return await runPlaywrightTest(childProcess, baseDir, params, env, options);
});
}
|
yongdamsh/playwright
|
tests/playwright-test/playwright-test-fixtures.ts
|
TypeScript
|
ArrowFunction
|
async (files: Files, params: Params = {}, env: Env = {}, options: RunOptions = {}) => {
const baseDir = await writeFiles(testInfo, files);
return await runPlaywrightTest(childProcess, baseDir, params, env, options);
}
|
yongdamsh/playwright
|
tests/playwright-test/playwright-test-fixtures.ts
|
TypeScript
|
ArrowFunction
|
async ({ childProcess }, use, testInfo) => {
await use(async files => {
const baseDir = await writeFiles(testInfo, { 'tsconfig.json': JSON.stringify(TSCONFIG), ...files });
const tsc = childProcess({
command: ['npx', 'tsc', '-p', baseDir],
cwd: baseDir,
shell: true,
});
const { exitCode } = await tsc.exited;
return { exitCode, output: tsc.output };
});
}
|
yongdamsh/playwright
|
tests/playwright-test/playwright-test-fixtures.ts
|
TypeScript
|
ArrowFunction
|
async files => {
const baseDir = await writeFiles(testInfo, { 'tsconfig.json': JSON.stringify(TSCONFIG), ...files });
const tsc = childProcess({
command: ['npx', 'tsc', '-p', baseDir],
cwd: baseDir,
shell: true,
});
const { exitCode } = await tsc.exited;
return { exitCode, output: tsc.output };
}
|
yongdamsh/playwright
|
tests/playwright-test/playwright-test-fixtures.ts
|
TypeScript
|
TypeAliasDeclaration
|
type RunResult = {
exitCode: number,
output: string,
passed: number,
failed: number,
flaky: number,
skipped: number,
report: JSONReport,
results: any[],
};
|
yongdamsh/playwright
|
tests/playwright-test/playwright-test-fixtures.ts
|
TypeScript
|
TypeAliasDeclaration
|
type TSCResult = {
output: string;
exitCode: number;
};
|
yongdamsh/playwright
|
tests/playwright-test/playwright-test-fixtures.ts
|
TypeScript
|
TypeAliasDeclaration
|
type Files = { [key: string]: string | Buffer };
|
yongdamsh/playwright
|
tests/playwright-test/playwright-test-fixtures.ts
|
TypeScript
|
TypeAliasDeclaration
|
type Params = { [key: string]: string | number | boolean | string[] };
|
yongdamsh/playwright
|
tests/playwright-test/playwright-test-fixtures.ts
|
TypeScript
|
TypeAliasDeclaration
|
type Env = { [key: string]: string | number | boolean | undefined };
|
yongdamsh/playwright
|
tests/playwright-test/playwright-test-fixtures.ts
|
TypeScript
|
TypeAliasDeclaration
|
type RunOptions = {
sendSIGINTAfter?: number;
usesCustomOutputDir?: boolean;
additionalArgs?: string[];
};
|
yongdamsh/playwright
|
tests/playwright-test/playwright-test-fixtures.ts
|
TypeScript
|
TypeAliasDeclaration
|
type Fixtures = {
writeFiles: (files: Files) => Promise<string>;
runInlineTest: (files: Files, params?: Params, env?: Env, options?: RunOptions) => Promise<RunResult>;
runTSC: (files: Files) => Promise<TSCResult>;
};
|
yongdamsh/playwright
|
tests/playwright-test/playwright-test-fixtures.ts
|
TypeScript
|
ArrowFunction
|
() => {
it("should match snapshot", () => {
const { container } = render(
<FMCircularProgress testID="circular-progress-test" />
);
expect(container).toMatchSnapshot();
});
}
|
HZN-one/flex
|
test/Components/Molecules/FMCircularProgress/FMCircularProgress.spec.tsx
|
TypeScript
|
ArrowFunction
|
() => {
const { container } = render(
<FMCircularProgress testID="circular-progress-test" />
);
expect(container).toMatchSnapshot();
}
|
HZN-one/flex
|
test/Components/Molecules/FMCircularProgress/FMCircularProgress.spec.tsx
|
TypeScript
|
FunctionDeclaration
|
function _ModAlertWeb(props: IAlertShow) {
const { title = '', type = 'warning', subtitle, timeout = 5000 } = props;
const timeoutInstance: any = useRef();
const eligibleToDismiss = useRef<boolean>(false);
const [ready, setReady] = useState(true);
const [visible, setVisible] = useState(false);
const isMounted = useIsMounted();
const clickDismiss = useCallback(() => {
timeoutInstance.current && clearTimeout(timeoutInstance.current);
isMounted.current && setVisible(false);
}, [isMounted]);
useEffect(() => {
setTimeout(() => {
setVisible(true);
timeoutInstance.current = setTimeout(() => {
isMounted.current && setVisible(false);
}, timeout + 1000);
setTimeout(() => {
eligibleToDismiss.current = true;
}, 100);
}, 500);
}, []);
useEffect(() => {
eligibleToDismiss.current &&
!visible &&
setTimeout(() => {
isMounted.current && setReady(false);
}, 1000);
}, [visible]);
return ready ? (
<Container visible={visible ? 'yes' : 'no'}>
<FlexRow>
<Line type={type} />
<FlexOne>
<Title dangerouslySetInnerHTML={{ __html: title }} />
{subtitle ? <Subtitle dangerouslySetInnerHTML={{ __html: subtitle }} /> : null}
</FlexOne>
<BasicBtn
onClick={() => {
clickDismiss();
}}
>
<Icon role={'button'} icon={'clear'} />
</BasicBtn>
</FlexRow>
</Container>
) : null;
}
|
edyCodeforLife/MAMAGURUASSESMENT
|
src/components/alert/custom-alert.tsx
|
TypeScript
|
ArrowFunction
|
props => (props.visible === 'yes' ? 36 : -460)
|
edyCodeforLife/MAMAGURUASSESMENT
|
src/components/alert/custom-alert.tsx
|
TypeScript
|
ArrowFunction
|
props => styleColor[props.type]
|
edyCodeforLife/MAMAGURUASSESMENT
|
src/components/alert/custom-alert.tsx
|
TypeScript
|
ArrowFunction
|
() => {
timeoutInstance.current && clearTimeout(timeoutInstance.current);
isMounted.current && setVisible(false);
}
|
edyCodeforLife/MAMAGURUASSESMENT
|
src/components/alert/custom-alert.tsx
|
TypeScript
|
ArrowFunction
|
() => {
setTimeout(() => {
setVisible(true);
timeoutInstance.current = setTimeout(() => {
isMounted.current && setVisible(false);
}, timeout + 1000);
setTimeout(() => {
eligibleToDismiss.current = true;
}, 100);
}, 500);
}
|
edyCodeforLife/MAMAGURUASSESMENT
|
src/components/alert/custom-alert.tsx
|
TypeScript
|
ArrowFunction
|
() => {
setVisible(true);
timeoutInstance.current = setTimeout(() => {
isMounted.current && setVisible(false);
}, timeout + 1000);
setTimeout(() => {
eligibleToDismiss.current = true;
}, 100);
}
|
edyCodeforLife/MAMAGURUASSESMENT
|
src/components/alert/custom-alert.tsx
|
TypeScript
|
ArrowFunction
|
() => {
isMounted.current && setVisible(false);
}
|
edyCodeforLife/MAMAGURUASSESMENT
|
src/components/alert/custom-alert.tsx
|
TypeScript
|
ArrowFunction
|
() => {
eligibleToDismiss.current = true;
}
|
edyCodeforLife/MAMAGURUASSESMENT
|
src/components/alert/custom-alert.tsx
|
TypeScript
|
ArrowFunction
|
() => {
eligibleToDismiss.current &&
!visible &&
setTimeout(() => {
isMounted.current && setReady(false);
}, 1000);
}
|
edyCodeforLife/MAMAGURUASSESMENT
|
src/components/alert/custom-alert.tsx
|
TypeScript
|
ArrowFunction
|
() => {
isMounted.current && setReady(false);
}
|
edyCodeforLife/MAMAGURUASSESMENT
|
src/components/alert/custom-alert.tsx
|
TypeScript
|
InterfaceDeclaration
|
export interface IAlertShow {
id?: string;
title: string;
subtitle?: string;
type?: 'warning' | 'success' | 'info';
timeout?: number;
}
|
edyCodeforLife/MAMAGURUASSESMENT
|
src/components/alert/custom-alert.tsx
|
TypeScript
|
FunctionDeclaration
|
function generateFileHashMap(): Map<string, string> {
const hashes = new Map<string, string>();
host.scopedSync().list(normalize('./dist')).forEach(name => {
const matches = name.match(OUTPUT_RE);
if (matches) {
const [, module, hash] = matches;
hashes.set(module, hash);
}
});
return hashes;
}
|
ThomasBurleson/devkit
|
packages/angular_devkit/build_angular/test/browser/output-hashing_spec_large.ts
|
TypeScript
|
FunctionDeclaration
|
function validateHashes(
oldHashes: Map<string, string>,
newHashes: Map<string, string>,
shouldChange: Array<string>,
): void {
newHashes.forEach((hash, module) => {
if (hash == oldHashes.get(module)) {
if (shouldChange.includes(module)) {
throw new Error(
`Module "${module}" did not change hash (${hash}), but was expected to.`);
}
} else if (!shouldChange.includes(module)) {
throw new Error(`Module "${module}" changed hash (${hash}), but was not expected to.`);
}
});
}
|
ThomasBurleson/devkit
|
packages/angular_devkit/build_angular/test/browser/output-hashing_spec_large.ts
|
TypeScript
|
ArrowFunction
|
done => host.initialize().subscribe(undefined, done.fail, done)
|
ThomasBurleson/devkit
|
packages/angular_devkit/build_angular/test/browser/output-hashing_spec_large.ts
|
TypeScript
|
ArrowFunction
|
done => host.restore().subscribe(undefined, done.fail, done)
|
ThomasBurleson/devkit
|
packages/angular_devkit/build_angular/test/browser/output-hashing_spec_large.ts
|
TypeScript
|
ArrowFunction
|
(done) => {
const OUTPUT_RE = /(main|styles|lazy\.module)\.([a-z0-9]+)\.(chunk|bundle)\.(js|css)$/;
function generateFileHashMap(): Map<string, string> {
const hashes = new Map<string, string>();
host.scopedSync().list(normalize('./dist')).forEach(name => {
const matches = name.match(OUTPUT_RE);
if (matches) {
const [, module, hash] = matches;
hashes.set(module, hash);
}
});
return hashes;
}
function validateHashes(
oldHashes: Map<string, string>,
newHashes: Map<string, string>,
shouldChange: Array<string>,
): void {
newHashes.forEach((hash, module) => {
if (hash == oldHashes.get(module)) {
if (shouldChange.includes(module)) {
throw new Error(
`Module "${module}" did not change hash (${hash}), but was expected to.`);
}
} else if (!shouldChange.includes(module)) {
throw new Error(`Module "${module}" changed hash (${hash}), but was not expected to.`);
}
});
}
let oldHashes: Map<string, string>;
let newHashes: Map<string, string>;
host.writeMultipleFiles(lazyModuleFiles);
host.writeMultipleFiles(lazyModuleImport);
const overrides = { outputHashing: 'all', extractCss: true };
// We must do several builds instead of a single one in watch mode, so that the output
// path is deleted on each run and only contains the most recent files.
runTargetSpec(host, browserTargetSpec, overrides).pipe(
tap(() => {
// Save the current hashes.
oldHashes = generateFileHashMap();
host.writeMultipleFiles(lazyModuleFiles);
host.writeMultipleFiles(lazyModuleImport);
}),
// Lazy chunk hash should have changed without modifying main bundle.
concatMap(() => runTargetSpec(host, browserTargetSpec, overrides)),
tap(() => {
newHashes = generateFileHashMap();
validateHashes(oldHashes, newHashes, []);
oldHashes = newHashes;
host.writeMultipleFiles({ 'src/styles.css': 'body { background: blue; }' });
}),
// Style hash should change.
concatMap(() => runTargetSpec(host, browserTargetSpec, overrides)),
tap(() => {
newHashes = generateFileHashMap();
validateHashes(oldHashes, newHashes, ['styles']);
oldHashes = newHashes;
host.writeMultipleFiles({ 'src/app/app.component.css': 'h1 { margin: 10px; }' });
}),
// Main hash should change, since inline styles go in the main bundle.
concatMap(() => runTargetSpec(host, browserTargetSpec, overrides)),
tap(() => {
newHashes = generateFileHashMap();
validateHashes(oldHashes, newHashes, ['main']);
oldHashes = newHashes;
host.appendToFile('src/app/lazy/lazy.module.ts', `console.log(1);`);
}),
// Lazy loaded bundle should change, and so should inline.
concatMap(() => runTargetSpec(host, browserTargetSpec, overrides)),
tap(() => {
newHashes = generateFileHashMap();
validateHashes(oldHashes, newHashes, ['lazy.module']);
oldHashes = newHashes;
host.appendToFile('src/main.ts', '');
}),
// Nothing should have changed.
concatMap(() => runTargetSpec(host, browserTargetSpec, overrides)),
tap(() => {
newHashes = generateFileHashMap();
validateHashes(oldHashes, newHashes, []);
}),
).subscribe(undefined, done.fail, done);
}
|
ThomasBurleson/devkit
|
packages/angular_devkit/build_angular/test/browser/output-hashing_spec_large.ts
|
TypeScript
|
ArrowFunction
|
name => {
const matches = name.match(OUTPUT_RE);
if (matches) {
const [, module, hash] = matches;
hashes.set(module, hash);
}
}
|
ThomasBurleson/devkit
|
packages/angular_devkit/build_angular/test/browser/output-hashing_spec_large.ts
|
TypeScript
|
ArrowFunction
|
(hash, module) => {
if (hash == oldHashes.get(module)) {
if (shouldChange.includes(module)) {
throw new Error(
`Module "${module}" did not change hash (${hash}), but was expected to.`);
}
} else if (!shouldChange.includes(module)) {
throw new Error(`Module "${module}" changed hash (${hash}), but was not expected to.`);
}
}
|
ThomasBurleson/devkit
|
packages/angular_devkit/build_angular/test/browser/output-hashing_spec_large.ts
|
TypeScript
|
ArrowFunction
|
() => {
// Save the current hashes.
oldHashes = generateFileHashMap();
host.writeMultipleFiles(lazyModuleFiles);
host.writeMultipleFiles(lazyModuleImport);
}
|
ThomasBurleson/devkit
|
packages/angular_devkit/build_angular/test/browser/output-hashing_spec_large.ts
|
TypeScript
|
ArrowFunction
|
() => runTargetSpec(host, browserTargetSpec, overrides)
|
ThomasBurleson/devkit
|
packages/angular_devkit/build_angular/test/browser/output-hashing_spec_large.ts
|
TypeScript
|
ArrowFunction
|
() => {
newHashes = generateFileHashMap();
validateHashes(oldHashes, newHashes, []);
oldHashes = newHashes;
host.writeMultipleFiles({ 'src/styles.css': 'body { background: blue; }' });
}
|
ThomasBurleson/devkit
|
packages/angular_devkit/build_angular/test/browser/output-hashing_spec_large.ts
|
TypeScript
|
ArrowFunction
|
() => {
newHashes = generateFileHashMap();
validateHashes(oldHashes, newHashes, ['styles']);
oldHashes = newHashes;
host.writeMultipleFiles({ 'src/app/app.component.css': 'h1 { margin: 10px; }' });
}
|
ThomasBurleson/devkit
|
packages/angular_devkit/build_angular/test/browser/output-hashing_spec_large.ts
|
TypeScript
|
ArrowFunction
|
() => {
newHashes = generateFileHashMap();
validateHashes(oldHashes, newHashes, ['main']);
oldHashes = newHashes;
host.appendToFile('src/app/lazy/lazy.module.ts', `console.log(1);`);
}
|
ThomasBurleson/devkit
|
packages/angular_devkit/build_angular/test/browser/output-hashing_spec_large.ts
|
TypeScript
|
ArrowFunction
|
() => {
newHashes = generateFileHashMap();
validateHashes(oldHashes, newHashes, ['lazy.module']);
oldHashes = newHashes;
host.appendToFile('src/main.ts', '');
}
|
ThomasBurleson/devkit
|
packages/angular_devkit/build_angular/test/browser/output-hashing_spec_large.ts
|
TypeScript
|
ArrowFunction
|
() => {
newHashes = generateFileHashMap();
validateHashes(oldHashes, newHashes, []);
}
|
ThomasBurleson/devkit
|
packages/angular_devkit/build_angular/test/browser/output-hashing_spec_large.ts
|
TypeScript
|
ArrowFunction
|
(done) => {
host.writeMultipleFiles({ 'src/styles.css': `h1 { background: url('./spectrum.png')}` });
host.writeMultipleFiles(lazyModuleFiles);
host.writeMultipleFiles(lazyModuleImport);
// We must do several builds instead of a single one in watch mode, so that the output
// path is deleted on each run and only contains the most recent files.
// 'all' should hash everything.
runTargetSpec(host, browserTargetSpec, { outputHashing: 'all', extractCss: true }).pipe(
tap(() => {
expect(host.fileMatchExists('dist', /runtime\.[0-9a-f]{20}\.js/)).toBeTruthy();
expect(host.fileMatchExists('dist', /main\.[0-9a-f]{20}\.js/)).toBeTruthy();
expect(host.fileMatchExists('dist', /polyfills\.[0-9a-f]{20}\.js/)).toBeTruthy();
expect(host.fileMatchExists('dist', /vendor\.[0-9a-f]{20}\.js/)).toBeTruthy();
expect(host.fileMatchExists('dist', /styles\.[0-9a-f]{20}\.css/)).toBeTruthy();
expect(host.fileMatchExists('dist', /spectrum\.[0-9a-f]{20}\.png/)).toBeTruthy();
}),
// 'none' should hash nothing.
concatMap(() => runTargetSpec(host, browserTargetSpec,
{ outputHashing: 'none', extractCss: true })),
tap(() => {
expect(host.fileMatchExists('dist', /runtime\.[0-9a-f]{20}\.js/)).toBeFalsy();
expect(host.fileMatchExists('dist', /main\.[0-9a-f]{20}\.js/)).toBeFalsy();
expect(host.fileMatchExists('dist', /polyfills\.[0-9a-f]{20}\.js/)).toBeFalsy();
expect(host.fileMatchExists('dist', /vendor\.[0-9a-f]{20}\.js/)).toBeFalsy();
expect(host.fileMatchExists('dist', /styles\.[0-9a-f]{20}\.css/)).toBeFalsy();
expect(host.fileMatchExists('dist', /spectrum\.[0-9a-f]{20}\.png/)).toBeFalsy();
}),
// 'media' should hash css resources only.
concatMap(() => runTargetSpec(host, browserTargetSpec,
{ outputHashing: 'media', extractCss: true })),
tap(() => {
expect(host.fileMatchExists('dist', /runtime\.[0-9a-f]{20}\.js/)).toBeFalsy();
expect(host.fileMatchExists('dist', /main\.[0-9a-f]{20}\.js/)).toBeFalsy();
expect(host.fileMatchExists('dist', /polyfills\.[0-9a-f]{20}\.js/)).toBeFalsy();
expect(host.fileMatchExists('dist', /vendor\.[0-9a-f]{20}\.js/)).toBeFalsy();
expect(host.fileMatchExists('dist', /styles\.[0-9a-f]{20}\.css/)).toBeFalsy();
expect(host.fileMatchExists('dist', /spectrum\.[0-9a-f]{20}\.png/)).toBeTruthy();
}),
// 'bundles' should hash bundles only.
concatMap(() => runTargetSpec(host, browserTargetSpec,
{ outputHashing: 'bundles', extractCss: true })),
tap(() => {
expect(host.fileMatchExists('dist', /runtime\.[0-9a-f]{20}\.js/)).toBeTruthy();
expect(host.fileMatchExists('dist', /main\.[0-9a-f]{20}\.js/)).toBeTruthy();
expect(host.fileMatchExists('dist', /polyfills\.[0-9a-f]{20}\.js/)).toBeTruthy();
expect(host.fileMatchExists('dist', /vendor\.[0-9a-f]{20}\.js/)).toBeTruthy();
expect(host.fileMatchExists('dist', /styles\.[0-9a-f]{20}\.css/)).toBeTruthy();
expect(host.fileMatchExists('dist', /spectrum\.[0-9a-f]{20}\.png/)).toBeFalsy();
}),
).subscribe(undefined, done.fail, done);
}
|
ThomasBurleson/devkit
|
packages/angular_devkit/build_angular/test/browser/output-hashing_spec_large.ts
|
TypeScript
|
ArrowFunction
|
() => {
expect(host.fileMatchExists('dist', /runtime\.[0-9a-f]{20}\.js/)).toBeTruthy();
expect(host.fileMatchExists('dist', /main\.[0-9a-f]{20}\.js/)).toBeTruthy();
expect(host.fileMatchExists('dist', /polyfills\.[0-9a-f]{20}\.js/)).toBeTruthy();
expect(host.fileMatchExists('dist', /vendor\.[0-9a-f]{20}\.js/)).toBeTruthy();
expect(host.fileMatchExists('dist', /styles\.[0-9a-f]{20}\.css/)).toBeTruthy();
expect(host.fileMatchExists('dist', /spectrum\.[0-9a-f]{20}\.png/)).toBeTruthy();
}
|
ThomasBurleson/devkit
|
packages/angular_devkit/build_angular/test/browser/output-hashing_spec_large.ts
|
TypeScript
|
ArrowFunction
|
() => runTargetSpec(host, browserTargetSpec,
{ outputHashing: 'none', extractCss: true })
|
ThomasBurleson/devkit
|
packages/angular_devkit/build_angular/test/browser/output-hashing_spec_large.ts
|
TypeScript
|
ArrowFunction
|
() => {
expect(host.fileMatchExists('dist', /runtime\.[0-9a-f]{20}\.js/)).toBeFalsy();
expect(host.fileMatchExists('dist', /main\.[0-9a-f]{20}\.js/)).toBeFalsy();
expect(host.fileMatchExists('dist', /polyfills\.[0-9a-f]{20}\.js/)).toBeFalsy();
expect(host.fileMatchExists('dist', /vendor\.[0-9a-f]{20}\.js/)).toBeFalsy();
expect(host.fileMatchExists('dist', /styles\.[0-9a-f]{20}\.css/)).toBeFalsy();
expect(host.fileMatchExists('dist', /spectrum\.[0-9a-f]{20}\.png/)).toBeFalsy();
}
|
ThomasBurleson/devkit
|
packages/angular_devkit/build_angular/test/browser/output-hashing_spec_large.ts
|
TypeScript
|
ArrowFunction
|
() => runTargetSpec(host, browserTargetSpec,
{ outputHashing: 'media', extractCss: true })
|
ThomasBurleson/devkit
|
packages/angular_devkit/build_angular/test/browser/output-hashing_spec_large.ts
|
TypeScript
|
ArrowFunction
|
() => {
expect(host.fileMatchExists('dist', /runtime\.[0-9a-f]{20}\.js/)).toBeFalsy();
expect(host.fileMatchExists('dist', /main\.[0-9a-f]{20}\.js/)).toBeFalsy();
expect(host.fileMatchExists('dist', /polyfills\.[0-9a-f]{20}\.js/)).toBeFalsy();
expect(host.fileMatchExists('dist', /vendor\.[0-9a-f]{20}\.js/)).toBeFalsy();
expect(host.fileMatchExists('dist', /styles\.[0-9a-f]{20}\.css/)).toBeFalsy();
expect(host.fileMatchExists('dist', /spectrum\.[0-9a-f]{20}\.png/)).toBeTruthy();
}
|
ThomasBurleson/devkit
|
packages/angular_devkit/build_angular/test/browser/output-hashing_spec_large.ts
|
TypeScript
|
ArrowFunction
|
() => runTargetSpec(host, browserTargetSpec,
{ outputHashing: 'bundles', extractCss: true })
|
ThomasBurleson/devkit
|
packages/angular_devkit/build_angular/test/browser/output-hashing_spec_large.ts
|
TypeScript
|
ArrowFunction
|
() => {
expect(host.fileMatchExists('dist', /runtime\.[0-9a-f]{20}\.js/)).toBeTruthy();
expect(host.fileMatchExists('dist', /main\.[0-9a-f]{20}\.js/)).toBeTruthy();
expect(host.fileMatchExists('dist', /polyfills\.[0-9a-f]{20}\.js/)).toBeTruthy();
expect(host.fileMatchExists('dist', /vendor\.[0-9a-f]{20}\.js/)).toBeTruthy();
expect(host.fileMatchExists('dist', /styles\.[0-9a-f]{20}\.css/)).toBeTruthy();
expect(host.fileMatchExists('dist', /spectrum\.[0-9a-f]{20}\.png/)).toBeFalsy();
}
|
ThomasBurleson/devkit
|
packages/angular_devkit/build_angular/test/browser/output-hashing_spec_large.ts
|
TypeScript
|
ClassDeclaration
|
@Resolver('Scoreboard')
export class ScoreboardResolver {
constructor(private readonly scoreboardService: ScoreboardService) {}
@Query('findScoreboards')
async findAll(@Args('league') league: string) {
return await this.scoreboardService.findAll(league);
}
@Query('scoreboards')
async scoreboards(
@Args('league') league: string,
@Args('filterValue') filterValue: number,
) {
return await this.scoreboardService.scoreboards(league, filterValue);
}
@Query('filters')
async findFilters(@Args('league') league: string) {
return await this.scoreboardService.findFilters(league);
}
@Mutation('createScoreboard')
async createScoreboard(@Args('input') dto: CreateScoreboardDto) {
return await this.scoreboardService.update(dto);
}
}
|
jackhenry/blindfold-api
|
src/scoreboard/resolvers/scoreboard.resolver.ts
|
TypeScript
|
MethodDeclaration
|
@Query('findScoreboards')
async findAll(@Args('league') league: string) {
return await this.scoreboardService.findAll(league);
}
|
jackhenry/blindfold-api
|
src/scoreboard/resolvers/scoreboard.resolver.ts
|
TypeScript
|
MethodDeclaration
|
@Query('scoreboards')
async scoreboards(
@Args('league') league: string,
@Args('filterValue') filterValue: number,
) {
return await this.scoreboardService.scoreboards(league, filterValue);
}
|
jackhenry/blindfold-api
|
src/scoreboard/resolvers/scoreboard.resolver.ts
|
TypeScript
|
MethodDeclaration
|
@Query('filters')
async findFilters(@Args('league') league: string) {
return await this.scoreboardService.findFilters(league);
}
|
jackhenry/blindfold-api
|
src/scoreboard/resolvers/scoreboard.resolver.ts
|
TypeScript
|
MethodDeclaration
|
@Mutation('createScoreboard')
async createScoreboard(@Args('input') dto: CreateScoreboardDto) {
return await this.scoreboardService.update(dto);
}
|
jackhenry/blindfold-api
|
src/scoreboard/resolvers/scoreboard.resolver.ts
|
TypeScript
|
ClassDeclaration
|
export declare class ApiError extends CustomError {
code: APIErrorCode;
info: string;
constructor(code: APIErrorCode, info: string);
}
|
Davinci-Leonardo/cardano-js-sdk
|
packages/cip30/dist/errors/ApiError.d.ts
|
TypeScript
|
EnumDeclaration
|
export declare enum APIErrorCode {
InvalidRequest = -1,
InternalError = -2,
Refused = -3
}
|
Davinci-Leonardo/cardano-js-sdk
|
packages/cip30/dist/errors/ApiError.d.ts
|
TypeScript
|
FunctionDeclaration
|
function handleStateChange(stateFilter: string) {
proposalsCtx.changeStateFilter(stateFilter);
}
|
zhiiker/barnbridge-frontend
|
src/modules/governance/views/proposals-view/index.tsx
|
TypeScript
|
FunctionDeclaration
|
function handleBackClick() {
history.push('/governance/overview');
}
|
zhiiker/barnbridge-frontend
|
src/modules/governance/views/proposals-view/index.tsx
|
TypeScript
|
ArrowFunction
|
() => {
const history = useHistory();
const wallet = useWallet();
const daoCtx = useDAO();
const proposalsCtx = useProposals();
const [state, setState] = useMergeState<ProposalsViewState>(InitialState);
function handleStateChange(stateFilter: string) {
proposalsCtx.changeStateFilter(stateFilter);
}
const handleSearchChange = useDebounce((ev: React.ChangeEvent<HTMLInputElement>) => {
proposalsCtx.changeSearchFilter(ev.target.value);
}, 400);
React.useEffect(() => {
daoCtx.actions.hasActiveProposal().then(hasActiveProposal => {
setState({ hasActiveProposal });
});
}, [wallet.account]);
const hasCreateRestrictions = state.hasActiveProposal !== undefined && daoCtx.actions.hasThreshold() !== undefined;
const canCreateProposal = state.hasActiveProposal === false && daoCtx.actions.hasThreshold() === true;
return (
<Grid flow="row" gap={32}>
<Grid flow="col" align="center" justify="space-between">
<Text type="h1" weight="bold" color="primary">
Proposals
</Text>
{wallet.isActive && (
<Grid flow="row" gap={8} align="end" justify="end">
<Button type="primary" disabled={!canCreateProposal} onClick={()
|
zhiiker/barnbridge-frontend
|
src/modules/governance/views/proposals-view/index.tsx
|
TypeScript
|
ArrowFunction
|
(ev: React.ChangeEvent<HTMLInputElement>) => {
proposalsCtx.changeSearchFilter(ev.target.value);
}
|
zhiiker/barnbridge-frontend
|
src/modules/governance/views/proposals-view/index.tsx
|
TypeScript
|
ArrowFunction
|
() => {
daoCtx.actions.hasActiveProposal().then(hasActiveProposal => {
setState({ hasActiveProposal });
});
}
|
zhiiker/barnbridge-frontend
|
src/modules/governance/views/proposals-view/index.tsx
|
TypeScript
|
ArrowFunction
|
hasActiveProposal => {
setState({ hasActiveProposal });
}
|
zhiiker/barnbridge-frontend
|
src/modules/governance/views/proposals-view/index.tsx
|
TypeScript
|
ArrowFunction
|
() => {
const history = useHistory();
const dao = useDAO();
function handleBackClick() {
history.push('/governance/overview');
}
if (dao.isActive === undefined) {
return <AntdSpin />;
}
if (!dao.isActive) {
return (
<Grid flow="row" gap={24} align="start">
<Button type="link" icon={<Icon name="left-arrow" />} onClick={handleBackClick}>
Overview
</Button>
<ActivationThreshold className={s.activationThreshold} />
</Grid>
|
zhiiker/barnbridge-frontend
|
src/modules/governance/views/proposals-view/index.tsx
|
TypeScript
|
TypeAliasDeclaration
|
type ProposalsViewState = {
hasActiveProposal?: boolean;
showWhyReason: boolean;
};
|
zhiiker/barnbridge-frontend
|
src/modules/governance/views/proposals-view/index.tsx
|
TypeScript
|
MethodDeclaration
|
proposals
<
|
zhiiker/barnbridge-frontend
|
src/modules/governance/views/proposals-view/index.tsx
|
TypeScript
|
MethodDeclaration
|
setState({ showWhyReason: visible })
|
zhiiker/barnbridge-frontend
|
src/modules/governance/views/proposals-view/index.tsx
|
TypeScript
|
MethodDeclaration
|
handleSearchChange(ev)
|
zhiiker/barnbridge-frontend
|
src/modules/governance/views/proposals-view/index.tsx
|
TypeScript
|
ClassDeclaration
|
export default abstract class AbstractSortDropdown<T extends SortDropdownAttrs> extends Component<T> {
view(): import("mithril").Vnode<{
className: string;
buttonClassName: string;
label: string;
}, unknown>;
className(): string;
activeSort(): string;
applySort(sort: string): void;
abstract options(): SortOptions;
defaultSort(): string;
}
|
flamarkt/core
|
js/dist-typings/common/components/AbstractSortDropdown.d.ts
|
TypeScript
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.