type stringclasses 7
values | content stringlengths 4 9.55k | repo stringlengths 7 96 | path stringlengths 4 178 | language stringclasses 1
value |
|---|---|---|---|---|
ClassDeclaration |
class BinaryWidgetView extends TestWidgetView {
render(): void {
this._rendered += 1;
}
_rendered = 0;
} | KGerring/ipywidgets | packages/base/test/src/dummy-manager.ts | TypeScript |
ClassDeclaration |
export class DummyManager implements widgets.IWidgetManager {
constructor() {
this.el = window.document.createElement('div');
}
protected loadClass(
className: string,
moduleName: string,
moduleVersion: string
): Promise<any> {
if (moduleName === '@jupyter-widgets/base') {
if ((widge... | KGerring/ipywidgets | packages/base/test/src/dummy-manager.ts | TypeScript |
MethodDeclaration |
on_open(fn: Function): void {
this._on_open = fn;
} | KGerring/ipywidgets | packages/base/test/src/dummy-manager.ts | TypeScript |
MethodDeclaration |
on_close(fn: Function): void {
this._on_close = fn;
} | KGerring/ipywidgets | packages/base/test/src/dummy-manager.ts | TypeScript |
MethodDeclaration |
on_msg(fn: Function): void {
this._on_msg = fn;
} | KGerring/ipywidgets | packages/base/test/src/dummy-manager.ts | TypeScript |
MethodDeclaration |
_process_msg(msg: any): any {
if (this._on_msg) {
return this._on_msg(msg);
} else {
return Promise.resolve();
}
} | KGerring/ipywidgets | packages/base/test/src/dummy-manager.ts | TypeScript |
MethodDeclaration |
open(): string {
if (this._on_open) {
this._on_open();
}
return '';
} | KGerring/ipywidgets | packages/base/test/src/dummy-manager.ts | TypeScript |
MethodDeclaration |
close(): string {
if (this._on_close) {
this._on_close();
}
return '';
} | KGerring/ipywidgets | packages/base/test/src/dummy-manager.ts | TypeScript |
MethodDeclaration |
send(): string {
return '';
} | KGerring/ipywidgets | packages/base/test/src/dummy-manager.ts | TypeScript |
MethodDeclaration |
defaults(): Backbone.ObjectHash {
return {
...super.defaults(),
_model_module: 'test-widgets',
_model_name: 'TestWidget',
_model_module_version: '1.0.0',
_view_module: 'test-widgets',
_view_name: 'TestWidgetView',
_view_module_version: '1.0.0',
_view_count: null as a... | KGerring/ipywidgets | packages/base/test/src/dummy-manager.ts | TypeScript |
MethodDeclaration |
render(): void {
this._rendered += 1;
super.render();
} | KGerring/ipywidgets | packages/base/test/src/dummy-manager.ts | TypeScript |
MethodDeclaration |
remove(): void {
this._removed += 1;
super.remove();
} | KGerring/ipywidgets | packages/base/test/src/dummy-manager.ts | TypeScript |
MethodDeclaration |
defaults(): Backbone.ObjectHash {
return {
...super.defaults(),
_model_name: 'BinaryWidget',
_view_name: 'BinaryWidgetView',
array: new Int8Array(0),
};
} | KGerring/ipywidgets | packages/base/test/src/dummy-manager.ts | TypeScript |
MethodDeclaration |
render(): void {
this._rendered += 1;
} | KGerring/ipywidgets | packages/base/test/src/dummy-manager.ts | TypeScript |
MethodDeclaration |
protected loadClass(
className: string,
moduleName: string,
moduleVersion: string
): Promise<any> {
if (moduleName === '@jupyter-widgets/base') {
if ((widgets as any)[className]) {
return Promise.resolve((widgets as any)[className]);
} else {
return Promise.reject(`Cannot ... | KGerring/ipywidgets | packages/base/test/src/dummy-manager.ts | TypeScript |
MethodDeclaration | /**
* Creates a promise for a view of a given model
*
* Make sure the view creation is not out of order with
* any state updates.
*/
create_view(
model: widgets.DOMWidgetModel,
options?: any
): Promise<widgets.DOMWidgetView>; | KGerring/ipywidgets | packages/base/test/src/dummy-manager.ts | TypeScript |
MethodDeclaration |
create_view(
model: widgets.WidgetModel,
options?: any
): Promise<widgets.WidgetView> {
throw new Error('Not implemented in dummy manager');
} | KGerring/ipywidgets | packages/base/test/src/dummy-manager.ts | TypeScript |
MethodDeclaration | /**
* callback handlers specific to a view
*/
callbacks(view?: widgets.WidgetView): widgets.ICallbacks {
return {};
} | KGerring/ipywidgets | packages/base/test/src/dummy-manager.ts | TypeScript |
MethodDeclaration | /**
* Get a promise for a model by model id.
*
* #### Notes
* If a model is not found, undefined is returned (NOT a promise). However,
* the calling code should also deal with the case where a rejected promise
* is returned, and should treat that also as a model not found.
*/
get_model(model_id: st... | KGerring/ipywidgets | packages/base/test/src/dummy-manager.ts | TypeScript |
MethodDeclaration | /**
* Create a comm and new widget model.
* @param options - same options as new_model but comm is not
* required and additional options are available.
* @param serialized_state - serialized model attributes.
*/
new_widget(
options: widgets.IWidgetOptions,
serialized_st... | KGerring/ipywidgets | packages/base/test/src/dummy-manager.ts | TypeScript |
MethodDeclaration |
register_model(
model_id: string,
modelPromise: Promise<widgets.WidgetModel>
): void {
this._models[model_id] = modelPromise;
modelPromise.then((model) => {
model.once('comm:close', () => {
delete this._models[model_id];
});
});
} | KGerring/ipywidgets | packages/base/test/src/dummy-manager.ts | TypeScript |
MethodDeclaration | /**
* Create and return a promise for a new widget model
*
* @param options - the options for creating the model.
* @param serialized_state - attribute values for the model.
*
* @example
* widget_manager.new_model({
* model_name: 'IntSlider',
* model_module: '@jupyter-widgets/contro... | KGerring/ipywidgets | packages/base/test/src/dummy-manager.ts | TypeScript |
MethodDeclaration |
async _make_model(
options: any,
serialized_state: any = {}
): Promise<widgets.WidgetModel> {
const model_id = options.model_id;
const model_promise = this.loadClass(
options.model_name,
options.model_module,
options.model_module_version
);
let ModelType;
try {
Mod... | KGerring/ipywidgets | packages/base/test/src/dummy-manager.ts | TypeScript |
MethodDeclaration | /**
* Resolve a URL relative to the current notebook location.
*
* The default implementation just returns the original url.
*/
resolveUrl(url: string): Promise<string> {
return Promise.resolve(url);
} | KGerring/ipywidgets | packages/base/test/src/dummy-manager.ts | TypeScript |
MethodDeclaration |
inline_sanitize(s: string): string {
return s;
} | KGerring/ipywidgets | packages/base/test/src/dummy-manager.ts | TypeScript |
FunctionDeclaration |
export function matchRegistrarAccountsWithIndexes (
judgementsWithRegistrarIndexes: SortedJudgements,
allRegistrars: Registrar[]
): Judgement[] {
return judgementsWithRegistrarIndexes.map(({ judgementName, registrarsIndexes }) => {
const findRegistrarByIndex = (index: number) => allRegistrars.find((registrar... | 454076513/apps | packages/react-hooks/src/utils/matchRegistrarAccountsWithIndexes.ts | TypeScript |
ArrowFunction |
({ judgementName, registrarsIndexes }) => {
const findRegistrarByIndex = (index: number) => allRegistrars.find((registrar) => registrar.index === index);
return {
judgementName,
registrars: registrarsIndexes.map((index) => findRegistrarByIndex(index.toNumber()))
};
} | 454076513/apps | packages/react-hooks/src/utils/matchRegistrarAccountsWithIndexes.ts | TypeScript |
ArrowFunction |
(index: number) => allRegistrars.find((registrar) => registrar.index === index) | 454076513/apps | packages/react-hooks/src/utils/matchRegistrarAccountsWithIndexes.ts | TypeScript |
ArrowFunction |
(registrar) => registrar.index === index | 454076513/apps | packages/react-hooks/src/utils/matchRegistrarAccountsWithIndexes.ts | TypeScript |
ArrowFunction |
(index) => findRegistrarByIndex(index.toNumber()) | 454076513/apps | packages/react-hooks/src/utils/matchRegistrarAccountsWithIndexes.ts | TypeScript |
ClassDeclaration |
@NgModule({
imports: [
CommonModule,
RouterModule.forChild(AdminLayoutRoutes),
FormsModule,
ReactiveFormsModule,
MatButtonModule,
MatRippleModule,
MatFormFieldModule,
MatInputModule,
MatSelectModule,
MatTooltipModule,
],
declarations: [
DashboardComponent... | vscalcione/material-angular-dashboard | src/app/layouts/admin-layout/admin-layout.module.ts | TypeScript |
FunctionDeclaration |
function isEmpty(
op: OperationDefinitionNode | FragmentDefinitionNode,
fragments: FragmentMap,
): boolean {
return op.selectionSet.selections.every(
selection =>
selection.kind === 'FragmentSpread' &&
isEmpty(fragments[selection.name.value], fragments),
);
} | Baehongmin/gatsby-blog | node_modules/apollo-utilities/src/transform.ts | TypeScript |
FunctionDeclaration |
function nullIfDocIsEmpty(doc: DocumentNode) {
return isEmpty(
getOperationDefinition(doc) || getFragmentDefinition(doc),
createFragmentMap(getFragmentDefinitions(doc)),
)
? null
: doc;
} | Baehongmin/gatsby-blog | node_modules/apollo-utilities/src/transform.ts | TypeScript |
FunctionDeclaration |
function getDirectiveMatcher(
directives: (RemoveDirectiveConfig | GetDirectiveConfig)[],
) {
return function directiveMatcher(directive: DirectiveNode) {
return directives.some(
dir =>
(dir.name && dir.name === directive.name.value) ||
(dir.test && dir.test(directive)),
);
};
} | Baehongmin/gatsby-blog | node_modules/apollo-utilities/src/transform.ts | TypeScript |
FunctionDeclaration |
export function removeDirectivesFromDocument(
directives: RemoveDirectiveConfig[],
doc: DocumentNode,
): DocumentNode | null {
const variablesInUse: Record<string, boolean> = Object.create(null);
let variablesToRemove: RemoveArgumentsConfig[] = [];
const fragmentSpreadsInUse: Record<string, boolean> = Objec... | Baehongmin/gatsby-blog | node_modules/apollo-utilities/src/transform.ts | TypeScript |
FunctionDeclaration |
export function addTypenameToDocument(doc: DocumentNode): DocumentNode {
return visit(checkDocument(doc), {
SelectionSet: {
enter(node, _key, parent) {
// Don't add __typename to OperationDefinitions.
if (
parent &&
(parent as OperationDefinitionNode).kind === 'Operation... | Baehongmin/gatsby-blog | node_modules/apollo-utilities/src/transform.ts | TypeScript |
FunctionDeclaration |
export function removeConnectionDirectiveFromDocument(doc: DocumentNode) {
return removeDirectivesFromDocument(
[connectionRemoveConfig],
checkDocument(doc),
);
} | Baehongmin/gatsby-blog | node_modules/apollo-utilities/src/transform.ts | TypeScript |
FunctionDeclaration |
function hasDirectivesInSelectionSet(
directives: GetDirectiveConfig[],
selectionSet: SelectionSetNode,
nestedCheck = true,
): boolean {
return (
selectionSet &&
selectionSet.selections &&
selectionSet.selections.some(selection =>
hasDirectivesInSelection(directives, selection, nestedCheck),
... | Baehongmin/gatsby-blog | node_modules/apollo-utilities/src/transform.ts | TypeScript |
FunctionDeclaration |
function hasDirectivesInSelection(
directives: GetDirectiveConfig[],
selection: SelectionNode,
nestedCheck = true,
): boolean {
if (selection.kind !== 'Field' || !(selection as FieldNode)) {
return true;
}
if (!selection.directives) {
return false;
}
return (
selection.directives.some(get... | Baehongmin/gatsby-blog | node_modules/apollo-utilities/src/transform.ts | TypeScript |
FunctionDeclaration |
export function getDirectivesFromDocument(
directives: GetDirectiveConfig[],
doc: DocumentNode,
): DocumentNode {
checkDocument(doc);
let parentPath: string;
return nullIfDocIsEmpty(
visit(doc, {
SelectionSet: {
enter(node, _key, _parent, path) {
const currentPath = path.join('-... | Baehongmin/gatsby-blog | node_modules/apollo-utilities/src/transform.ts | TypeScript |
FunctionDeclaration |
function getArgumentMatcher(config: RemoveArgumentsConfig[]) {
return function argumentMatcher(argument: ArgumentNode) {
return config.some(
(aConfig: RemoveArgumentsConfig) =>
argument.value &&
argument.value.kind === 'Variable' &&
argument.value.name &&
(aConfig.name === a... | Baehongmin/gatsby-blog | node_modules/apollo-utilities/src/transform.ts | TypeScript |
FunctionDeclaration |
export function removeArgumentsFromDocument(
config: RemoveArgumentsConfig[],
doc: DocumentNode,
): DocumentNode {
const argMatcher = getArgumentMatcher(config);
return nullIfDocIsEmpty(
visit(doc, {
OperationDefinition: {
enter(node) {
return {
...node,
// ... | Baehongmin/gatsby-blog | node_modules/apollo-utilities/src/transform.ts | TypeScript |
FunctionDeclaration |
export function removeFragmentSpreadFromDocument(
config: RemoveFragmentSpreadConfig[],
doc: DocumentNode,
): DocumentNode {
function enter(
node: FragmentSpreadNode | FragmentDefinitionNode,
): null | void {
if (config.some(def => def.name === node.name.value)) {
return null;
}
}
return... | Baehongmin/gatsby-blog | node_modules/apollo-utilities/src/transform.ts | TypeScript |
FunctionDeclaration |
function enter(
node: FragmentSpreadNode | FragmentDefinitionNode,
): null | void {
if (config.some(def => def.name === node.name.value)) {
return null;
}
} | Baehongmin/gatsby-blog | node_modules/apollo-utilities/src/transform.ts | TypeScript |
FunctionDeclaration |
function getAllFragmentSpreadsFromSelectionSet(
selectionSet: SelectionSetNode,
): FragmentSpreadNode[] {
const allFragments: FragmentSpreadNode[] = [];
selectionSet.selections.forEach(selection => {
if (
(selection.kind === 'Field' || selection.kind === 'InlineFragment') &&
selection.selectionS... | Baehongmin/gatsby-blog | node_modules/apollo-utilities/src/transform.ts | TypeScript |
FunctionDeclaration | // If the incoming document is a query, return it as is. Otherwise, build a
// new document containing a query operation based on the selection set
// of the previous main operation.
export function buildQueryFromSelectionSet(
document: DocumentNode,
): DocumentNode {
const definition = getMainDefinition(document);... | Baehongmin/gatsby-blog | node_modules/apollo-utilities/src/transform.ts | TypeScript |
FunctionDeclaration | // Remove fields / selection sets that include an @client directive.
export function removeClientSetsFromDocument(
document: DocumentNode,
): DocumentNode | null {
checkDocument(document);
let modifiedDoc = removeDirectivesFromDocument(
[
{
test: (directive: DirectiveNode) => directive.name.val... | Baehongmin/gatsby-blog | node_modules/apollo-utilities/src/transform.ts | TypeScript |
ArrowFunction |
selection =>
selection.kind === 'FragmentSpread' &&
isEmpty(fragments[selection.name.value], fragments) | Baehongmin/gatsby-blog | node_modules/apollo-utilities/src/transform.ts | TypeScript |
ArrowFunction |
dir =>
(dir.name && dir.name === directive.name.value) ||
(dir.test && dir.test(directive)) | Baehongmin/gatsby-blog | node_modules/apollo-utilities/src/transform.ts | TypeScript |
ArrowFunction |
directive => directive.remove | Baehongmin/gatsby-blog | node_modules/apollo-utilities/src/transform.ts | TypeScript |
ArrowFunction |
arg => {
if (arg.value.kind === 'Variable') {
variablesToRemove.push({
name: (arg.value as VariableNode).name.value,
});
}
} | Baehongmin/gatsby-blog | node_modules/apollo-utilities/src/transform.ts | TypeScript |
ArrowFunction |
frag => {
fragmentSpreadsToRemove.push({
name: frag.name.value,
});
} | Baehongmin/gatsby-blog | node_modules/apollo-utilities/src/transform.ts | TypeScript |
ArrowFunction |
v => !variablesInUse[v.name] | Baehongmin/gatsby-blog | node_modules/apollo-utilities/src/transform.ts | TypeScript |
ArrowFunction |
fs => !fragmentSpreadsInUse[fs.name] | Baehongmin/gatsby-blog | node_modules/apollo-utilities/src/transform.ts | TypeScript |
ArrowFunction |
selection => {
return (
selection.kind === 'Field' &&
((selection as FieldNode).name.value === '__typename' ||
(selection as FieldNode).name.value.lastIndexOf('__', 0) === 0)
);
} | Baehongmin/gatsby-blog | node_modules/apollo-utilities/src/transform.ts | TypeScript |
ArrowFunction |
(directive: DirectiveNode) => {
const willRemove = directive.name.value === 'connection';
if (willRemove) {
if (
!directive.arguments ||
!directive.arguments.some(arg => arg.name.value === 'key')
) {
console.warn(
'Removing an @connection directive even though it d... | Baehongmin/gatsby-blog | node_modules/apollo-utilities/src/transform.ts | TypeScript |
ArrowFunction |
arg => arg.name.value === 'key' | Baehongmin/gatsby-blog | node_modules/apollo-utilities/src/transform.ts | TypeScript |
ArrowFunction |
selection =>
hasDirectivesInSelection(directives, selection, nestedCheck) | Baehongmin/gatsby-blog | node_modules/apollo-utilities/src/transform.ts | TypeScript |
ArrowFunction |
selection => hasDirectivesInSelection(directives, selection) | Baehongmin/gatsby-blog | node_modules/apollo-utilities/src/transform.ts | TypeScript |
ArrowFunction |
(aConfig: RemoveArgumentsConfig) =>
argument.value &&
argument.value.kind === 'Variable' &&
argument.value.name &&
(aConfig.name === argument.value.name.value ||
(aConfig.test && aConfig.test(argument))) | Baehongmin/gatsby-blog | node_modules/apollo-utilities/src/transform.ts | TypeScript |
ArrowFunction |
varDef =>
!config.some(arg => arg.name === varDef.variable.name.value) | Baehongmin/gatsby-blog | node_modules/apollo-utilities/src/transform.ts | TypeScript |
ArrowFunction |
arg => arg.name === varDef.variable.name.value | Baehongmin/gatsby-blog | node_modules/apollo-utilities/src/transform.ts | TypeScript |
ArrowFunction |
argConfig => argConfig.remove | Baehongmin/gatsby-blog | node_modules/apollo-utilities/src/transform.ts | TypeScript |
ArrowFunction |
arg => {
if (argMatcher(arg)) {
argMatchCount += 1;
}
} | Baehongmin/gatsby-blog | node_modules/apollo-utilities/src/transform.ts | TypeScript |
ArrowFunction |
def => def.name === node.name.value | Baehongmin/gatsby-blog | node_modules/apollo-utilities/src/transform.ts | TypeScript |
ArrowFunction |
selection => {
if (
(selection.kind === 'Field' || selection.kind === 'InlineFragment') &&
selection.selectionSet
) {
getAllFragmentSpreadsFromSelectionSet(selection.selectionSet).forEach(
frag => allFragments.push(frag),
);
} else if (selection.kind === 'FragmentSpread') {
... | Baehongmin/gatsby-blog | node_modules/apollo-utilities/src/transform.ts | TypeScript |
ArrowFunction |
frag => allFragments.push(frag) | Baehongmin/gatsby-blog | node_modules/apollo-utilities/src/transform.ts | TypeScript |
ArrowFunction |
(directive: DirectiveNode) => directive.name.value === 'client' | Baehongmin/gatsby-blog | node_modules/apollo-utilities/src/transform.ts | TypeScript |
ArrowFunction |
selection => {
return (
selection.kind === 'Field' &&
(selection as FieldNode).name.value === '__typename'
);
} | Baehongmin/gatsby-blog | node_modules/apollo-utilities/src/transform.ts | TypeScript |
TypeAliasDeclaration |
export type RemoveNodeConfig<N> = {
name?: string;
test?: (node: N) => boolean;
remove?: boolean;
}; | Baehongmin/gatsby-blog | node_modules/apollo-utilities/src/transform.ts | TypeScript |
TypeAliasDeclaration |
export type GetNodeConfig<N> = {
name?: string;
test?: (node: N) => boolean;
}; | Baehongmin/gatsby-blog | node_modules/apollo-utilities/src/transform.ts | TypeScript |
TypeAliasDeclaration |
export type RemoveDirectiveConfig = RemoveNodeConfig<DirectiveNode>; | Baehongmin/gatsby-blog | node_modules/apollo-utilities/src/transform.ts | TypeScript |
TypeAliasDeclaration |
export type GetDirectiveConfig = GetNodeConfig<DirectiveNode>; | Baehongmin/gatsby-blog | node_modules/apollo-utilities/src/transform.ts | TypeScript |
TypeAliasDeclaration |
export type RemoveArgumentsConfig = RemoveNodeConfig<ArgumentNode>; | Baehongmin/gatsby-blog | node_modules/apollo-utilities/src/transform.ts | TypeScript |
TypeAliasDeclaration |
export type GetFragmentSpreadConfig = GetNodeConfig<FragmentSpreadNode>; | Baehongmin/gatsby-blog | node_modules/apollo-utilities/src/transform.ts | TypeScript |
TypeAliasDeclaration |
export type RemoveFragmentSpreadConfig = RemoveNodeConfig<FragmentSpreadNode>; | Baehongmin/gatsby-blog | node_modules/apollo-utilities/src/transform.ts | TypeScript |
TypeAliasDeclaration |
export type RemoveFragmentDefinitionConfig = RemoveNodeConfig<
FragmentDefinitionNode
>; | Baehongmin/gatsby-blog | node_modules/apollo-utilities/src/transform.ts | TypeScript |
TypeAliasDeclaration |
export type RemoveVariableDefinitionConfig = RemoveNodeConfig<
VariableDefinitionNode
>; | Baehongmin/gatsby-blog | node_modules/apollo-utilities/src/transform.ts | TypeScript |
MethodDeclaration |
enter(node, _key, parent) {
// Store each variable that's referenced as part of an argument
// (excluding operation definition variables), so we know which
// variables are being used. If we later want to remove a variable
// we'll fist check to see if it's being used, before co... | Baehongmin/gatsby-blog | node_modules/apollo-utilities/src/transform.ts | TypeScript |
MethodDeclaration |
enter(node) {
if (directives && node.directives) {
// If `remove` is set to true for a directive, and a directive match
// is found for a field, remove the field as well.
const shouldRemoveField = directives.some(
directive => directive.remove,
);... | Baehongmin/gatsby-blog | node_modules/apollo-utilities/src/transform.ts | TypeScript |
MethodDeclaration |
enter(node) {
// Keep track of referenced fragment spreads. This is used to
// determine if top level fragment definitions should be removed.
fragmentSpreadsInUse[node.name.value] = true;
} | Baehongmin/gatsby-blog | node_modules/apollo-utilities/src/transform.ts | TypeScript |
MethodDeclaration |
enter(node) {
// If a matching directive is found, remove it.
if (getDirectiveMatcher(directives)(node)) {
return null;
}
} | Baehongmin/gatsby-blog | node_modules/apollo-utilities/src/transform.ts | TypeScript |
MethodDeclaration |
enter(node, _key, parent) {
// Don't add __typename to OperationDefinitions.
if (
parent &&
(parent as OperationDefinitionNode).kind === 'OperationDefinition'
) {
return;
}
// No changes if no selections.
const { selections } = node;
... | Baehongmin/gatsby-blog | node_modules/apollo-utilities/src/transform.ts | TypeScript |
MethodDeclaration |
enter(node, _key, _parent, path) {
const currentPath = path.join('-');
if (
!parentPath ||
currentPath === parentPath ||
!currentPath.startsWith(parentPath)
) {
if (node.selections) {
const selectionsWithDirectives = node.sele... | Baehongmin/gatsby-blog | node_modules/apollo-utilities/src/transform.ts | TypeScript |
MethodDeclaration |
enter(node) {
return {
...node,
// Remove matching top level variables definitions.
variableDefinitions: node.variableDefinitions.filter(
varDef =>
!config.some(arg => arg.name === varDef.variable.name.value),
),
};
... | Baehongmin/gatsby-blog | node_modules/apollo-utilities/src/transform.ts | TypeScript |
MethodDeclaration |
enter(node) {
// If `remove` is set to true for an argument, and an argument match
// is found for a field, remove the field as well.
const shouldRemoveField = config.some(argConfig => argConfig.remove);
if (shouldRemoveField) {
let argMatchCount = 0;
no... | Baehongmin/gatsby-blog | node_modules/apollo-utilities/src/transform.ts | TypeScript |
MethodDeclaration |
enter(node) {
// Remove all matching arguments.
if (argMatcher(node)) {
return null;
}
} | Baehongmin/gatsby-blog | node_modules/apollo-utilities/src/transform.ts | TypeScript |
MethodDeclaration |
enter(node) {
return {
...node,
operation: 'query',
};
} | Baehongmin/gatsby-blog | node_modules/apollo-utilities/src/transform.ts | TypeScript |
MethodDeclaration |
enter(node) {
if (node.selectionSet) {
const isTypenameOnly = node.selectionSet.selections.every(
selection => {
return (
selection.kind === 'Field' &&
(selection as FieldNode).name.value === '__typename'
);
... | Baehongmin/gatsby-blog | node_modules/apollo-utilities/src/transform.ts | TypeScript |
ArrowFunction |
() => this.flush() | ajaaym/nodejs-pubsub | src/message-queues.ts | TypeScript |
ArrowFunction |
([ackId]) => ackId | ajaaym/nodejs-pubsub | src/message-queues.ts | TypeScript |
ArrowFunction |
(table: {[index: string]: string[]}, [ackId, deadline]) => {
if (!table[deadline!]) {
table[deadline!] = [];
}
table[deadline!].push(ackId);
return table;
} | ajaaym/nodejs-pubsub | src/message-queues.ts | TypeScript |
ArrowFunction |
async deadline => {
const ackIds = modAckTable[deadline];
const ackDeadlineSeconds = Number(deadline);
const reqOpts = {subscription, ackIds, ackDeadlineSeconds};
try {
await client.modifyAckDeadline(reqOpts, this._options.callOptions!);
} catch (e) {
throw new BatchError... | ajaaym/nodejs-pubsub | src/message-queues.ts | TypeScript |
ClassDeclaration | /**
* Error class used to signal a batch failure.
*
* @class
*
* @param {string} message The error message.
* @param {ServiceError} err The grpc service error.
*/
export class BatchError extends Error implements ServiceError {
ackIds: string[];
code?: status;
metadata?: Metadata;
constructor(err: Service... | ajaaym/nodejs-pubsub | src/message-queues.ts | TypeScript |
ClassDeclaration | /**
* Class for buffering ack/modAck requests.
*
* @private
* @class
*
* @param {Subscriber} sub The subscriber we're queueing requests for.
* @param {BatchOptions} options Batching options.
*/
export abstract class MessageQueue {
numPendingRequests: number;
protected _onFlush?: DeferredPromise<void>;
pro... | ajaaym/nodejs-pubsub | src/message-queues.ts | TypeScript |
ClassDeclaration | /**
* Queues up Acknowledge (ack) requests.
*
* @private
* @class
*/
export class AckQueue extends MessageQueue {
/**
* Sends a batch of ack requests.
*
* @private
*
* @param {Array.<Array.<string|number>>} batch Array of ackIds and deadlines.
* @return {Promise}
*/
protected async _sendBa... | ajaaym/nodejs-pubsub | src/message-queues.ts | TypeScript |
ClassDeclaration | /**
* Queues up ModifyAckDeadline requests and sends them out in batches.
*
* @private
* @class
*/
export class ModAckQueue extends MessageQueue {
/**
* Sends a batch of modAck requests. Each deadline requires its own request,
* so we have to group all the ackIds by deadline and send multiple requests.
... | ajaaym/nodejs-pubsub | src/message-queues.ts | TypeScript |
InterfaceDeclaration | /**
* @typedef {object} BatchOptions
* @property {object} [callOptions] Request configuration option, outlined
* here: {@link https://googleapis.github.io/gax-nodejs/CallSettings.html}.
* @property {number} [maxMessages=3000] Maximum number of messages allowed in
* each batch sent.
* @property {number} [m... | ajaaym/nodejs-pubsub | src/message-queues.ts | TypeScript |
TypeAliasDeclaration |
type QueuedMessages = Array<[string, number?]>; | ajaaym/nodejs-pubsub | src/message-queues.ts | TypeScript |
MethodDeclaration |
protected abstract _sendBatch(batch: QueuedMessages): Promise<void>; | ajaaym/nodejs-pubsub | src/message-queues.ts | TypeScript |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.