type
stringclasses
7 values
content
stringlengths
4
9.55k
repo
stringlengths
7
96
path
stringlengths
4
178
language
stringclasses
1 value
ArrowFunction
async ({ api, store }: Ports) => { try { const { status, body: user } = await api.users.me.get(); store.commit("setUser", user); return status === 200; } catch (error) { return false; } }
HosokawaR/twinte-front
src/usecases/authCheck.ts
TypeScript
ArrowFunction
() => { let service: LocalStoreService; beforeEach(() => { TestBed.configureTestingModule({}); service = TestBed.inject(LocalStoreService); }); it("should be created", () => { expect(service).toBeTruthy(); }); }
BuildForSDG/team-011-frontend
src/app/shared/services/local-store.service.spec.ts
TypeScript
ArrowFunction
() => { TestBed.configureTestingModule({}); service = TestBed.inject(LocalStoreService); }
BuildForSDG/team-011-frontend
src/app/shared/services/local-store.service.spec.ts
TypeScript
ArrowFunction
() => { expect(service).toBeTruthy(); }
BuildForSDG/team-011-frontend
src/app/shared/services/local-store.service.spec.ts
TypeScript
ClassDeclaration
export declare class MzTextareaPrefixDirective implements OnInit { private elementRef; private renderer; constructor(elementRef: ElementRef, renderer: Renderer); ngOnInit(): void; }
johnwanjema/git
node_modules/ngx-materialize/src/textarea/textarea-prefix/textarea-prefix.directive.d.ts
TypeScript
MethodDeclaration
ngOnInit(): void;
johnwanjema/git
node_modules/ngx-materialize/src/textarea/textarea-prefix/textarea-prefix.directive.d.ts
TypeScript
ClassDeclaration
/** * Negative Guard validates a property is not a negative number */ class NegativeGuard implements Guard { /** * @inheritDoc */ public guard<T = unknown>(property: T, errorMessage?: string, error?: Instantiable<Error>): T { Guarder.guard(NumberGuard, property, errorMessage, error) const int = parseInt(Guarder.empty(property).toString()) if (int < 0) { this.throwError(errorMessage ?? 'Property not allowed to be negative number', error) } return property } private throwError(message: string, error?: Instantiable<Error>): never { if (error) { throw new error(message) } throw new ArgumentError(message) } }
ToeFungi/Guarder
src/guards/NegativeGuard.ts
TypeScript
MethodDeclaration
/** * @inheritDoc */ public guard<T = unknown>(property: T, errorMessage?: string, error?: Instantiable<Error>): T { Guarder.guard(NumberGuard, property, errorMessage, error) const int = parseInt(Guarder.empty(property).toString()) if (int < 0) { this.throwError(errorMessage ?? 'Property not allowed to be negative number', error) } return property }
ToeFungi/Guarder
src/guards/NegativeGuard.ts
TypeScript
MethodDeclaration
private throwError(message: string, error?: Instantiable<Error>): never { if (error) { throw new error(message) } throw new ArgumentError(message) }
ToeFungi/Guarder
src/guards/NegativeGuard.ts
TypeScript
ArrowFunction
() => { let service: ProductService; beforeEach(() => { TestBed.configureTestingModule({}); service = TestBed.inject(ProductService); }); it('should be created', () => { expect(service).toBeTruthy(); }); }
hackmel/ProductListAppAngularDotNet
WebClient/src/app/services/product.service.spec.ts
TypeScript
ArrowFunction
() => { TestBed.configureTestingModule({}); service = TestBed.inject(ProductService); }
hackmel/ProductListAppAngularDotNet
WebClient/src/app/services/product.service.spec.ts
TypeScript
ArrowFunction
(e: MouseEvent) => { console.log(e); this.hello.emit({ message: 'Hello Stencil!' }); }
shingo1551/hello-event
stencil-app/src/components/app-hello/app-hello.tsx
TypeScript
ClassDeclaration
@Component({ tag: 'app-hello', shadow: true, }) export class AppHello { @Event() hello: EventEmitter<{ message: string }>; connectedCallback() { console.log(this); } onClick = (e: MouseEvent) => { console.log(e); this.hello.emit({ message: 'Hello Stencil!' }); } render() { return ( <div> <p>Hello Stencil!</p> <button onClick={this.onClick}>HELLO</button> </div> ) } }
shingo1551/hello-event
stencil-app/src/components/app-hello/app-hello.tsx
TypeScript
MethodDeclaration
connectedCallback() { console.log(this); }
shingo1551/hello-event
stencil-app/src/components/app-hello/app-hello.tsx
TypeScript
MethodDeclaration
render() { return ( <div> <p>Hello Stencil!</p> <button onClick={this.onClick}>HELLO</button> </div> ) }
shingo1551/hello-event
stencil-app/src/components/app-hello/app-hello.tsx
TypeScript
FunctionDeclaration
export function setUser(user: IUser) { return { type: 'SET_USER', payload: user }; }
DanielSpasov/Cr46-Dashboard
src/app/+store/actions/userActions.ts
TypeScript
ClassDeclaration
@Component({ selector: 'app-view-summary', templateUrl: './summary.component.html', styleUrls: ['./summary.component.scss'], }) export class SummaryComponent extends AbstractViewComponent<SummaryView> { title: string; isLoading = false; currentAction: Action; constructor( private actionService: ActionService, private viewService: ViewService ) { super(); } update() { const view = this.v; this.title = this.viewService.viewTitleAsText(view); } identifyItem(index: number, item: SummaryItem): string { return `${index}-${item.header}`; } onPortLoad(isLoading: boolean) { this.isLoading = isLoading; } setAction(action: Action) { this.currentAction = action; } onActionSubmit(formGroup: FormGroup) { if (formGroup && formGroup.value) { this.actionService.perform(formGroup.value); this.currentAction = undefined; } } onActionCancel() { this.currentAction = undefined; } shouldShowFooter(): boolean { if (this.v && this.v.config.actions) { if (!this.currentAction && this.v.config.actions.length > 0) { return true; } } return false; } }
alexbarbato/octant
web/src/app/modules/shared/components/presentation/summary/summary.component.ts
TypeScript
MethodDeclaration
update() { const view = this.v; this.title = this.viewService.viewTitleAsText(view); }
alexbarbato/octant
web/src/app/modules/shared/components/presentation/summary/summary.component.ts
TypeScript
MethodDeclaration
identifyItem(index: number, item: SummaryItem): string { return `${index}-${item.header}`; }
alexbarbato/octant
web/src/app/modules/shared/components/presentation/summary/summary.component.ts
TypeScript
MethodDeclaration
onPortLoad(isLoading: boolean) { this.isLoading = isLoading; }
alexbarbato/octant
web/src/app/modules/shared/components/presentation/summary/summary.component.ts
TypeScript
MethodDeclaration
setAction(action: Action) { this.currentAction = action; }
alexbarbato/octant
web/src/app/modules/shared/components/presentation/summary/summary.component.ts
TypeScript
MethodDeclaration
onActionSubmit(formGroup: FormGroup) { if (formGroup && formGroup.value) { this.actionService.perform(formGroup.value); this.currentAction = undefined; } }
alexbarbato/octant
web/src/app/modules/shared/components/presentation/summary/summary.component.ts
TypeScript
MethodDeclaration
onActionCancel() { this.currentAction = undefined; }
alexbarbato/octant
web/src/app/modules/shared/components/presentation/summary/summary.component.ts
TypeScript
MethodDeclaration
shouldShowFooter(): boolean { if (this.v && this.v.config.actions) { if (!this.currentAction && this.v.config.actions.length > 0) { return true; } } return false; }
alexbarbato/octant
web/src/app/modules/shared/components/presentation/summary/summary.component.ts
TypeScript
FunctionDeclaration
/** * Creates a function that invokes func, with the this binding and arguments of the created function, while it's called less than n times. * Subsequent calls to the created function return the result of the last func invocation. * @param {number} n The number of calls at whichc func is no longer invoked. * @example * * let calls = 0; * * class MyClass { * @Before(3) * fn() { * calls++; * } * } * * const myClass = new MyClass(); * * myClass.fn(); * myClass.fn(); * myClass.fn(); * myClass.fn(); * * calls === 2; // => true */ export function Before(n: number): LodashDecorator { return decorator(n); }
Cyrus-d/lodash-decorators
src/before.ts
TypeScript
ArrowFunction
() => { it('enforces the presense of a `focusElement`', async () => { iliadCustomElementsDefine('focusable-test', class extends Focusable {}); try { const el = await fixture<Focusable>( html` <focusable-test></focusable-test> ` ); await elementUpdated(el); const focusEl = el.focusElement; expect(focusEl).to.exist; } catch (error) { expect(() => { throw error; }).to.throw('Must implement focusElement getter!'); } }); }
gaoding-inc/Iliad-ui
packages/shared/test/focusable.test.ts
TypeScript
ArrowFunction
async () => { iliadCustomElementsDefine('focusable-test', class extends Focusable {}); try { const el = await fixture<Focusable>( html` <focusable-test></focusable-test> ` ); await elementUpdated(el); const focusEl = el.focusElement; expect(focusEl).to.exist; } catch (error) { expect(() => { throw error; }).to.throw('Must implement focusElement getter!'); } }
gaoding-inc/Iliad-ui
packages/shared/test/focusable.test.ts
TypeScript
ArrowFunction
() => { throw error; }
gaoding-inc/Iliad-ui
packages/shared/test/focusable.test.ts
TypeScript
ArrowFunction
() => import( './components/status-card/status-card' /* webpackChunkName: "object-service-status-card" */ ).then((m) => m.default)
abhi-kn/console
frontend/packages/noobaa-storage-plugin/src/plugin.ts
TypeScript
ArrowFunction
(m) => m.default
abhi-kn/console
frontend/packages/noobaa-storage-plugin/src/plugin.ts
TypeScript
ArrowFunction
() => import( './components/details-card/details-card' /* webpackChunkName: "object-service-details-card" */ ).then((m) => m.DetailsCard)
abhi-kn/console
frontend/packages/noobaa-storage-plugin/src/plugin.ts
TypeScript
ArrowFunction
(m) => m.DetailsCard
abhi-kn/console
frontend/packages/noobaa-storage-plugin/src/plugin.ts
TypeScript
ArrowFunction
() => import( './components/buckets-card/buckets-card' /* webpackChunkName: "object-service-buckets-card" */ ).then((m) => m.BucketsCard)
abhi-kn/console
frontend/packages/noobaa-storage-plugin/src/plugin.ts
TypeScript
ArrowFunction
(m) => m.BucketsCard
abhi-kn/console
frontend/packages/noobaa-storage-plugin/src/plugin.ts
TypeScript
ArrowFunction
() => import( './components/resource-providers-card/resource-providers-card' /* webpackChunkName: "object-service-resource-providers-card" */ ).then((m) => m.ResourceProvidersCard)
abhi-kn/console
frontend/packages/noobaa-storage-plugin/src/plugin.ts
TypeScript
ArrowFunction
(m) => m.ResourceProvidersCard
abhi-kn/console
frontend/packages/noobaa-storage-plugin/src/plugin.ts
TypeScript
ArrowFunction
() => import( './components/data-consumption-card/data-consumption-card' /* webpackChunkName: "object-service-data-consumption-card" */ ).then((m) => m.default)
abhi-kn/console
frontend/packages/noobaa-storage-plugin/src/plugin.ts
TypeScript
ArrowFunction
() => import( './components/activity-card/activity-card' /* webpackChunkName: "object-service-activity-card" */ ).then((m) => m.default)
abhi-kn/console
frontend/packages/noobaa-storage-plugin/src/plugin.ts
TypeScript
ArrowFunction
() => import( './components/object-data-reduction-card/object-data-reduction-card' /* webpackChunkName: "object-service-data-reduction-card" */ ).then((m) => m.default)
abhi-kn/console
frontend/packages/noobaa-storage-plugin/src/plugin.ts
TypeScript
ArrowFunction
() => import( './components/object-bucket-page/object-bucket' /* webpackChunkName: "object-bucket-page" */ ).then((m) => m.ObjectBucketsPage)
abhi-kn/console
frontend/packages/noobaa-storage-plugin/src/plugin.ts
TypeScript
ArrowFunction
(m) => m.ObjectBucketsPage
abhi-kn/console
frontend/packages/noobaa-storage-plugin/src/plugin.ts
TypeScript
ArrowFunction
() => import( './components/object-bucket-page/object-bucket' /* webpackChunkName: "object-bucket-page" */ ).then((m) => m.ObjectBucketDetailsPage)
abhi-kn/console
frontend/packages/noobaa-storage-plugin/src/plugin.ts
TypeScript
ArrowFunction
(m) => m.ObjectBucketDetailsPage
abhi-kn/console
frontend/packages/noobaa-storage-plugin/src/plugin.ts
TypeScript
ArrowFunction
() => import( './components/object-bucket-claim-page/object-bucket-claim' /* webpackChunkName: "object-bucket-claim-page" */ ).then((m) => m.ObjectBucketClaimsPage)
abhi-kn/console
frontend/packages/noobaa-storage-plugin/src/plugin.ts
TypeScript
ArrowFunction
(m) => m.ObjectBucketClaimsPage
abhi-kn/console
frontend/packages/noobaa-storage-plugin/src/plugin.ts
TypeScript
ArrowFunction
() => import( './components/object-bucket-claim-page/object-bucket-claim' /* webpackChunkName: "object-bucket-claim-page" */ ).then((m) => m.ObjectBucketClaimsDetailsPage)
abhi-kn/console
frontend/packages/noobaa-storage-plugin/src/plugin.ts
TypeScript
ArrowFunction
(m) => m.ObjectBucketClaimsDetailsPage
abhi-kn/console
frontend/packages/noobaa-storage-plugin/src/plugin.ts
TypeScript
ArrowFunction
() => import( './components/object-bucket-claim-page/create-obc' /* webpackChunkName: "create-obc" */ ).then((m) => m.CreateOBCPage)
abhi-kn/console
frontend/packages/noobaa-storage-plugin/src/plugin.ts
TypeScript
ArrowFunction
(m) => m.CreateOBCPage
abhi-kn/console
frontend/packages/noobaa-storage-plugin/src/plugin.ts
TypeScript
TypeAliasDeclaration
type ConsumedExtensions = | ModelFeatureFlag | ModelDefinition | DashboardsTab | DashboardsCard | ResourceNSNavItem | ResourceClusterNavItem | ResourceListPage | ResourceDetailsPage | YAMLTemplate | RoutePage;
abhi-kn/console
frontend/packages/noobaa-storage-plugin/src/plugin.ts
TypeScript
ArrowFunction
async () => { // When loading Lish we avoid all this extra data loading if (window.location?.pathname?.match(/linodes\/[0-9]+\/lish/)) { return; } // Initial Requests: Things we need immediately (before rendering the app) const dataFetchingPromises: Promise<any>[] = [ // Fetch user's account information queryClient.prefetchQuery({ queryFn: getAccountInfo, queryKey: accountQueryKey, }), // Username and whether a user is restricted this.props.requestProfile(), // Is a user managed queryClient.prefetchQuery({ queryKey: 'account-settings', queryFn: getAccountSettings, }), // Is this a large account? (should we use API or Redux-based search/pagination) this.props.checkAccountSize(), ]; // Start events polling startEventsInterval(); try { await Promise.all(dataFetchingPromises); } catch { /** We choose to do nothing, relying on the Redux error state. */ } finally { this.props.markAppAsDoneLoading(); this.makeSecondaryRequests(); } }
tjdawson/manager
packages/manager/src/components/AuthenticationWrapper/AuthenticationWrapper.tsx
TypeScript
ArrowFunction
async () => { try { await Promise.all([ this.props.requestTypes(), this.props.requestNotifications(), ]); } catch { /** We choose to do nothing, relying on the Redux error state. */ } }
tjdawson/manager
packages/manager/src/components/AuthenticationWrapper/AuthenticationWrapper.tsx
TypeScript
ArrowFunction
() => { const { linodes, types } = this.props; // The types we already know about (from /types and /types-legacy). const knownTypeIds = types.map((thisType) => thisType.id); // The types of each Linode on the account. const linodeTypeIds = uniqBy((thisLinode) => thisLinode.type, linodes).map( (thisLinode) => thisLinode.type ); // The difference between these two, i.e. the types we don't know about. const missingTypeIds = difference(linodeTypeIds, knownTypeIds); // For each type we don't know about, request it. missingTypeIds.forEach((thisMissingTypeId) => { if (thisMissingTypeId !== null) { this.props.requestLinodeType({ typeId: thisMissingTypeId, isShadowPlan: true, }); } }); }
tjdawson/manager
packages/manager/src/components/AuthenticationWrapper/AuthenticationWrapper.tsx
TypeScript
ArrowFunction
(thisType) => thisType.id
tjdawson/manager
packages/manager/src/components/AuthenticationWrapper/AuthenticationWrapper.tsx
TypeScript
ArrowFunction
(thisLinode) => thisLinode.type
tjdawson/manager
packages/manager/src/components/AuthenticationWrapper/AuthenticationWrapper.tsx
TypeScript
ArrowFunction
(thisMissingTypeId) => { if (thisMissingTypeId !== null) { this.props.requestLinodeType({ typeId: thisMissingTypeId, isShadowPlan: true, }); } }
tjdawson/manager
packages/manager/src/components/AuthenticationWrapper/AuthenticationWrapper.tsx
TypeScript
ArrowFunction
(state) => ({ isAuthenticated: Boolean(state.authentication.token), linodesLoading: state.__resources.linodes.loading, linodesLastUpdated: state.__resources.linodes.lastUpdated, linodes: Object.values(state.__resources.linodes.itemsById), pendingUpload: state.pendingUpload, types: state.__resources.types.entities, typesLastUpdated: state.__resources.types.lastUpdated, })
tjdawson/manager
packages/manager/src/components/AuthenticationWrapper/AuthenticationWrapper.tsx
TypeScript
ArrowFunction
( dispatch: ThunkDispatch<ApplicationState, undefined, Action<any>> ) => ({ initSession: () => dispatch(handleInitTokens()), checkAccountSize: () => dispatch(checkAccountSize()), requestLinodes: () => dispatch(requestLinodes({})), requestNotifications: () => dispatch(requestNotifications()), requestTypes: () => dispatch(requestTypes()), requestRegions: () => dispatch(requestRegions()), requestProfile: () => dispatch(requestProfile()), markAppAsDoneLoading: () => dispatch(handleLoadingDone()), requestLinodeType: (options) => dispatch(requestLinodeType(options)), })
tjdawson/manager
packages/manager/src/components/AuthenticationWrapper/AuthenticationWrapper.tsx
TypeScript
ArrowFunction
() => dispatch(handleInitTokens())
tjdawson/manager
packages/manager/src/components/AuthenticationWrapper/AuthenticationWrapper.tsx
TypeScript
ArrowFunction
() => dispatch(checkAccountSize())
tjdawson/manager
packages/manager/src/components/AuthenticationWrapper/AuthenticationWrapper.tsx
TypeScript
ArrowFunction
() => dispatch(requestLinodes({}))
tjdawson/manager
packages/manager/src/components/AuthenticationWrapper/AuthenticationWrapper.tsx
TypeScript
ArrowFunction
() => dispatch(requestNotifications())
tjdawson/manager
packages/manager/src/components/AuthenticationWrapper/AuthenticationWrapper.tsx
TypeScript
ArrowFunction
() => dispatch(requestTypes())
tjdawson/manager
packages/manager/src/components/AuthenticationWrapper/AuthenticationWrapper.tsx
TypeScript
ArrowFunction
() => dispatch(requestRegions())
tjdawson/manager
packages/manager/src/components/AuthenticationWrapper/AuthenticationWrapper.tsx
TypeScript
ArrowFunction
() => dispatch(requestProfile())
tjdawson/manager
packages/manager/src/components/AuthenticationWrapper/AuthenticationWrapper.tsx
TypeScript
ArrowFunction
() => dispatch(handleLoadingDone())
tjdawson/manager
packages/manager/src/components/AuthenticationWrapper/AuthenticationWrapper.tsx
TypeScript
ArrowFunction
(options) => dispatch(requestLinodeType(options))
tjdawson/manager
packages/manager/src/components/AuthenticationWrapper/AuthenticationWrapper.tsx
TypeScript
ClassDeclaration
export class AuthenticationWrapper extends React.Component<CombinedProps> { state = { showChildren: false, hasEnsuredAllTypes: false, }; static defaultProps = { isAuthenticated: false, }; /** * We make a series of requests for data on app load. The flow is: * 1. App begins load; users see splash screen * 2. Initial requests (in makeInitialRequests) are made (account, profile, etc.) * 3. Initial requests complete; app is marked as done loading * 4. As splash screen goes away, secondary requests (in makeSecondaryRequests -- Linodes, types, regions) * are kicked off */ makeInitialRequests = async () => { // When loading Lish we avoid all this extra data loading if (window.location?.pathname?.match(/linodes\/[0-9]+\/lish/)) { return; } // Initial Requests: Things we need immediately (before rendering the app) const dataFetchingPromises: Promise<any>[] = [ // Fetch user's account information queryClient.prefetchQuery({ queryFn: getAccountInfo, queryKey: accountQueryKey, }), // Username and whether a user is restricted this.props.requestProfile(), // Is a user managed queryClient.prefetchQuery({ queryKey: 'account-settings', queryFn: getAccountSettings, }), // Is this a large account? (should we use API or Redux-based search/pagination) this.props.checkAccountSize(), ]; // Start events polling startEventsInterval(); try { await Promise.all(dataFetchingPromises); } catch { /** We choose to do nothing, relying on the Redux error state. */ } finally { this.props.markAppAsDoneLoading(); this.makeSecondaryRequests(); } }; /** Secondary Requests (non-blocking) * Make these once the user is past the * splash screen, since they aren't needed * for navigation, basic display, etc. */ makeSecondaryRequests = async () => { try { await Promise.all([ this.props.requestTypes(), this.props.requestNotifications(), ]); } catch { /** We choose to do nothing, relying on the Redux error state. */ } }; // Some special types aren't returned from /types or /types-legacy. They are // only available by hitting /types/:id directly. If there are Linodes with // these special types, we have to request each one. ensureAllTypes = () => { const { linodes, types } = this.props; // The types we already know about (from /types and /types-legacy). const knownTypeIds = types.map((thisType) => thisType.id); // The types of each Linode on the account. const linodeTypeIds = uniqBy((thisLinode) => thisLinode.type, linodes).map( (thisLinode) => thisLinode.type ); // The difference between these two, i.e. the types we don't know about. const missingTypeIds = difference(linodeTypeIds, knownTypeIds); // For each type we don't know about, request it. missingTypeIds.forEach((thisMissingTypeId) => { if (thisMissingTypeId !== null) { this.props.requestLinodeType({ typeId: thisMissingTypeId, isShadowPlan: true, }); } }); }; componentDidMount() { const { initSession } = this.props; /** * set redux state to what's in local storage * or expire the tokens if the expiry time is in the past * * if nothing exists in local storage, we get shot off to login */ initSession(); /** * this is the case where we've just come back from login and need * to show the children onMount */ if (this.props.isAuthenticated) { this.setState({ showChildren: true }); this.makeInitialRequests(); } } /** * handles for the case where we've refreshed the page * and redux has now been synced with what is in local storage */ componentDidUpdate(prevProps: CombinedProps) { /** if we were previously not authenticated and now we are */ if ( !prevProps.isAuthenticated && this.props.isAuthenticated && !this.state.showChildren ) { this.makeInitialRequests(); return this.setState({ showChildren: true }); } /** basically handles for the case where our token is expired or we got a 401 error */ if ( prevProps.isAuthenticated && !this.props.isAuthenticated && // Do not redirect to Login if there is a pending image upload. !this.props.pendingUpload ) { redirectToLogin(location.pathname, location.search); } if ( !this.state.hasEnsuredAllTypes && this.props.typesLastUpdated > 0 && this.props.linodesLastUpdated > 0 ) { this.setState({ hasEnsuredAllTypes: true }); this.ensureAllTypes(); } } render() { const { children } = this.props; const { showChildren } = this.state; // eslint-disable-next-line return <React.Fragment>{showChildren ? children : null}</React.Fragment>; } }
tjdawson/manager
packages/manager/src/components/AuthenticationWrapper/AuthenticationWrapper.tsx
TypeScript
InterfaceDeclaration
interface StateProps { isAuthenticated: boolean; linodesLoading: boolean; linodesLastUpdated: number; linodes: Linode[]; pendingUpload: PendingUploadState; types: LinodeType[]; typesLastUpdated: number; }
tjdawson/manager
packages/manager/src/components/AuthenticationWrapper/AuthenticationWrapper.tsx
TypeScript
InterfaceDeclaration
interface DispatchProps { initSession: () => void; checkAccountSize: () => Promise<null>; requestLinodes: () => Promise<GetAllData<Linode>>; requestNotifications: () => Promise<GetAllData<Notification>>; requestTypes: () => Promise<LinodeType[]>; requestRegions: () => Promise<Region[]>; requestProfile: () => Promise<Profile>; markAppAsDoneLoading: () => void; requestLinodeType: (params: GetLinodeTypeParams) => void; }
tjdawson/manager
packages/manager/src/components/AuthenticationWrapper/AuthenticationWrapper.tsx
TypeScript
TypeAliasDeclaration
type CombinedProps = DispatchProps & StateProps;
tjdawson/manager
packages/manager/src/components/AuthenticationWrapper/AuthenticationWrapper.tsx
TypeScript
MethodDeclaration
componentDidMount() { const { initSession } = this.props; /** * set redux state to what's in local storage * or expire the tokens if the expiry time is in the past * * if nothing exists in local storage, we get shot off to login */ initSession(); /** * this is the case where we've just come back from login and need * to show the children onMount */ if (this.props.isAuthenticated) { this.setState({ showChildren: true }); this.makeInitialRequests(); } }
tjdawson/manager
packages/manager/src/components/AuthenticationWrapper/AuthenticationWrapper.tsx
TypeScript
MethodDeclaration
/** * handles for the case where we've refreshed the page * and redux has now been synced with what is in local storage */ componentDidUpdate(prevProps: CombinedProps) { /** if we were previously not authenticated and now we are */ if ( !prevProps.isAuthenticated && this.props.isAuthenticated && !this.state.showChildren ) { this.makeInitialRequests(); return this.setState({ showChildren: true }); } /** basically handles for the case where our token is expired or we got a 401 error */ if ( prevProps.isAuthenticated && !this.props.isAuthenticated && // Do not redirect to Login if there is a pending image upload. !this.props.pendingUpload ) { redirectToLogin(location.pathname, location.search); } if ( !this.state.hasEnsuredAllTypes && this.props.typesLastUpdated > 0 && this.props.linodesLastUpdated > 0 ) { this.setState({ hasEnsuredAllTypes: true }); this.ensureAllTypes(); } }
tjdawson/manager
packages/manager/src/components/AuthenticationWrapper/AuthenticationWrapper.tsx
TypeScript
MethodDeclaration
render() { const { children } = this.props; const { showChildren } = this.state; // eslint-disable-next-line return <React.Fragment>{showChildren ? children : null}</React.Fragment>; }
tjdawson/manager
packages/manager/src/components/AuthenticationWrapper/AuthenticationWrapper.tsx
TypeScript
FunctionDeclaration
function View_Checkbox_1(_l:any):i0.ɵViewDefinition { return i0.ɵvid(0,[(_l()(),i0.ɵeld(0,(null as any),(null as any),3,'label',[['class', 'ui-chkbox-label']],[[1,'for',0]],[[(null as any),'click']],(_v,en,$event) => { var ad:boolean = true; var _co:any = _v.component; if (('click' === en)) { const pd_0:any = ((<any>_co.onClick($event,i0.ɵnov((<any>_v.parent),7),true)) !== false); ad = (pd_0 && ad); } return ad; },(null as any),(null as any))),i0.ɵdid(278528,(null as any),0,i2.NgClass,[i0.IterableDiffers, i0.KeyValueDiffers,i0.ElementRef,i0.Renderer],{klass:[0,'klass'],ngClass:[1, 'ngClass']},(null as any)),i0.ɵpod({'ui-label-active':0,'ui-label-disabled':1, 'ui-label-focus':2}),(_l()(),i0.ɵted((null as any),['','']))],(_ck,_v) => { var _co:any = _v.component; const currVal_1:any = 'ui-chkbox-label'; const currVal_2:any = _ck(_v,2,0,_co.checked,_co.disabled,_co.focused); _ck(_v,1,0,currVal_1,currVal_2); },(_ck,_v) => { var _co:any = _v.component; const currVal_0:any = _co.inputId; _ck(_v,0,0,currVal_0); const currVal_3:any = _co.label; _ck(_v,3,0,currVal_3); }); }
kjetilfjellheim/wordcup
frontend/src/aot/node_modules/primeng/components/checkbox/checkbox.ngfactory.ts
TypeScript
FunctionDeclaration
export function View_Checkbox_0(_l:any):i0.ɵViewDefinition { return i0.ɵvid(0,[(_l()(),i0.ɵted((null as any),['\n '])),(_l()(),i0.ɵeld(0, (null as any),(null as any),19,'div',([] as any[]),(null as any),(null as any), (null as any),(null as any),(null as any))),i0.ɵdid(278528,(null as any),0,i2.NgClass, [i0.IterableDiffers,i0.KeyValueDiffers,i0.ElementRef,i0.Renderer],{klass:[0, 'klass'],ngClass:[1,'ngClass']},(null as any)),i0.ɵdid(278528,(null as any), 0,i2.NgStyle,[i0.KeyValueDiffers,i0.ElementRef,i0.Renderer],{ngStyle:[0,'ngStyle']}, (null as any)),(_l()(),i0.ɵted((null as any),['\n '])),(_l()(),i0.ɵeld(0, (null as any),(null as any),5,'div',[['class','ui-helper-hidden-accessible']], (null as any),(null as any),(null as any),(null as any),(null as any))),(_l()(), i0.ɵted((null as any),['\n '])),(_l()(),i0.ɵeld(0,[['cb',1]], (null as any),2,'input',[['type','checkbox']],[[1,'id',0],[8,'name',0],[8,'value', 0],[8,'checked',0],[8,'disabled',0],[1,'tabindex',0]],[[(null as any),'focus'], [(null as any),'blur'],[(null as any),'change']],(_v,en,$event) => { var ad:boolean = true; var _co:i1.Checkbox = _v.component; if (('focus' === en)) { const pd_0:any = ((<any>_co.onFocus($event)) !== false); ad = (pd_0 && ad); } if (('blur' === en)) { const pd_1:any = ((<any>_co.onBlur($event)) !== false); ad = (pd_1 && ad); } if (('change' === en)) { const pd_2:any = ((<any>_co.handleChange($event)) !== false); ad = (pd_2 && ad); } return ad; },(null as any),(null as any))),i0.ɵdid(278528,(null as any),0,i2.NgClass,[i0.IterableDiffers, i0.KeyValueDiffers,i0.ElementRef,i0.Renderer],{ngClass:[0,'ngClass']},(null as any)), i0.ɵpod({'ui-state-focus':0}),(_l()(),i0.ɵted((null as any),['\n '])), (_l()(),i0.ɵted((null as any),['\n '])),(_l()(),i0.ɵeld(0,(null as any), (null as any),7,'div',[['class','ui-chkbox-box ui-widget ui-corner-all ui-state-default']], (null as any),[[(null as any),'click']],(_v,en,$event) => { var ad:boolean = true; var _co:i1.Checkbox = _v.component; if (('click' === en)) { const pd_0:any = ((<any>_co.onClick($event,i0.ɵnov(_v,7),true)) !== false); ad = (pd_0 && ad); } return ad; },(null as any),(null as any))),i0.ɵdid(278528,(null as any),0,i2.NgClass, [i0.IterableDiffers,i0.KeyValueDiffers,i0.ElementRef,i0.Renderer],{klass:[0, 'klass'],ngClass:[1,'ngClass']},(null as any)),i0.ɵpod({'ui-state-active':0, 'ui-state-disabled':1,'ui-state-focus':2}),(_l()(),i0.ɵted((null as any), ['\n '])),(_l()(),i0.ɵeld(0,(null as any),(null as any),2, 'span',[['class','ui-chkbox-icon ui-clickable']],(null as any),(null as any), (null as any),(null as any),(null as any))),i0.ɵdid(278528,(null as any), 0,i2.NgClass,[i0.IterableDiffers,i0.KeyValueDiffers,i0.ElementRef,i0.Renderer], {klass:[0,'klass'],ngClass:[1,'ngClass']},(null as any)),i0.ɵpod({'fa fa-check':0}), (_l()(),i0.ɵted((null as any),['\n '])),(_l()(),i0.ɵted((null as any), ['\n '])),(_l()(),i0.ɵted((null as any),['\n '])),(_l()(), i0.ɵand(16777216,(null as any),(null as any),1,(null as any),View_Checkbox_1)), i0.ɵdid(16384,(null as any),0,i2.NgIf,[i0.ViewContainerRef,i0.TemplateRef],{ngIf:[0, 'ngIf']},(null as any)),(_l()(),i0.ɵted((null as any),['\n ']))],(_ck, _v) => { var _co:i1.Checkbox = _v.component; const currVal_0:any = _co.styleClass; const currVal_1:any = 'ui-chkbox ui-widget'; _ck(_v,2,0,currVal_0,currVal_1); const currVal_2:any = _co.style; _ck(_v,3,0,currVal_2); const currVal_9:any = _ck(_v,9,0,_co.focused); _ck(_v,8,0,currVal_9); const currVal_10:any = 'ui-chkbox-box ui-widget ui-corner-all ui-state-default'; const currVal_11:any = _ck(_v,14,0,_co.checked,_co.disabled,_co.focused); _ck(_v,13,0,currVal_10,currVal_11); const currVal_12:any = 'ui-chkbox-icon ui-clickable'; const currVal_13:any = _ck(_v,18,0,_co.checked); _ck(_v,17,0,currVal_12,currVal_13); const currVal_14:any = _co.label; _ck(_v,23,0,currVal_14); },(_ck,_v) => { var _co:i1.Checkbox = _v.component; const currVal_3:any = _co.inputId; const currVal_4:any = _co.name; const currVal_5:any = _co.value; const currVal_6:any = _co.checked; const currVal_7:any = _co.disabled; const currVal_8:any = _co.tabindex; _ck(_v,7,0,currVal_3,currVal_4,currVal_5,currVal_6,currVal_7,currVal_8); }); }
kjetilfjellheim/wordcup
frontend/src/aot/node_modules/primeng/components/checkbox/checkbox.ngfactory.ts
TypeScript
FunctionDeclaration
export function View_Checkbox_Host_0(_l:any):i0.ɵViewDefinition { return i0.ɵvid(0,[(_l()(),i0.ɵeld(0,(null as any),(null as any),2,'p-checkbox',([] as any[]), (null as any),(null as any),(null as any),View_Checkbox_0,RenderType_Checkbox)), i0.ɵprd(5120,(null as any),i3.NG_VALUE_ACCESSOR,(p0_0:any) => { return [p0_0]; },[i1.Checkbox]),i0.ɵdid(49152,(null as any),0,i1.Checkbox,[i0.ChangeDetectorRef], (null as any),(null as any))],(null as any),(null as any)); }
kjetilfjellheim/wordcup
frontend/src/aot/node_modules/primeng/components/checkbox/checkbox.ngfactory.ts
TypeScript
ArrowFunction
(_l:any) => { return i0.ɵmod([i0.ɵmpd(512,i0.ComponentFactoryResolver,i0.ɵCodegenComponentFactoryResolver, [[8,([] as any[])],[3,i0.ComponentFactoryResolver],i0.NgModuleRef]),i0.ɵmpd(4608, i2.NgLocalization,i2.NgLocaleLocalization,[i0.LOCALE_ID]),i0.ɵmpd(512,i2.CommonModule, i2.CommonModule,([] as any[])),i0.ɵmpd(512,i1.CheckboxModule,i1.CheckboxModule, ([] as any[]))]); }
kjetilfjellheim/wordcup
frontend/src/aot/node_modules/primeng/components/checkbox/checkbox.ngfactory.ts
TypeScript
ArrowFunction
(_v,en,$event) => { var ad:boolean = true; var _co:any = _v.component; if (('click' === en)) { const pd_0:any = ((<any>_co.onClick($event,i0.ɵnov((<any>_v.parent),7),true)) !== false); ad = (pd_0 && ad); } return ad; }
kjetilfjellheim/wordcup
frontend/src/aot/node_modules/primeng/components/checkbox/checkbox.ngfactory.ts
TypeScript
ArrowFunction
(_ck,_v) => { var _co:any = _v.component; const currVal_1:any = 'ui-chkbox-label'; const currVal_2:any = _ck(_v,2,0,_co.checked,_co.disabled,_co.focused); _ck(_v,1,0,currVal_1,currVal_2); }
kjetilfjellheim/wordcup
frontend/src/aot/node_modules/primeng/components/checkbox/checkbox.ngfactory.ts
TypeScript
ArrowFunction
(_ck,_v) => { var _co:any = _v.component; const currVal_0:any = _co.inputId; _ck(_v,0,0,currVal_0); const currVal_3:any = _co.label; _ck(_v,3,0,currVal_3); }
kjetilfjellheim/wordcup
frontend/src/aot/node_modules/primeng/components/checkbox/checkbox.ngfactory.ts
TypeScript
ArrowFunction
(_v,en,$event) => { var ad:boolean = true; var _co:i1.Checkbox = _v.component; if (('focus' === en)) { const pd_0:any = ((<any>_co.onFocus($event)) !== false); ad = (pd_0 && ad); } if (('blur' === en)) { const pd_1:any = ((<any>_co.onBlur($event)) !== false); ad = (pd_1 && ad); } if (('change' === en)) { const pd_2:any = ((<any>_co.handleChange($event)) !== false); ad = (pd_2 && ad); } return ad; }
kjetilfjellheim/wordcup
frontend/src/aot/node_modules/primeng/components/checkbox/checkbox.ngfactory.ts
TypeScript
ArrowFunction
(_v,en,$event) => { var ad:boolean = true; var _co:i1.Checkbox = _v.component; if (('click' === en)) { const pd_0:any = ((<any>_co.onClick($event,i0.ɵnov(_v,7),true)) !== false); ad = (pd_0 && ad); } return ad; }
kjetilfjellheim/wordcup
frontend/src/aot/node_modules/primeng/components/checkbox/checkbox.ngfactory.ts
TypeScript
ArrowFunction
(_ck, _v) => { var _co:i1.Checkbox = _v.component; const currVal_0:any = _co.styleClass; const currVal_1:any = 'ui-chkbox ui-widget'; _ck(_v,2,0,currVal_0,currVal_1); const currVal_2:any = _co.style; _ck(_v,3,0,currVal_2); const currVal_9:any = _ck(_v,9,0,_co.focused); _ck(_v,8,0,currVal_9); const currVal_10:any = 'ui-chkbox-box ui-widget ui-corner-all ui-state-default'; const currVal_11:any = _ck(_v,14,0,_co.checked,_co.disabled,_co.focused); _ck(_v,13,0,currVal_10,currVal_11); const currVal_12:any = 'ui-chkbox-icon ui-clickable'; const currVal_13:any = _ck(_v,18,0,_co.checked); _ck(_v,17,0,currVal_12,currVal_13); const currVal_14:any = _co.label; _ck(_v,23,0,currVal_14); }
kjetilfjellheim/wordcup
frontend/src/aot/node_modules/primeng/components/checkbox/checkbox.ngfactory.ts
TypeScript
ArrowFunction
(_ck,_v) => { var _co:i1.Checkbox = _v.component; const currVal_3:any = _co.inputId; const currVal_4:any = _co.name; const currVal_5:any = _co.value; const currVal_6:any = _co.checked; const currVal_7:any = _co.disabled; const currVal_8:any = _co.tabindex; _ck(_v,7,0,currVal_3,currVal_4,currVal_5,currVal_6,currVal_7,currVal_8); }
kjetilfjellheim/wordcup
frontend/src/aot/node_modules/primeng/components/checkbox/checkbox.ngfactory.ts
TypeScript
ArrowFunction
(p0_0:any) => { return [p0_0]; }
kjetilfjellheim/wordcup
frontend/src/aot/node_modules/primeng/components/checkbox/checkbox.ngfactory.ts
TypeScript
ClassDeclaration
export default class RecipeImplementation implements RecipeInterface { recipeImplementation: ThirdPartyEmailPasswordRecipeInterface; constructor(recipeImplementation: ThirdPartyEmailPasswordRecipeInterface); signUp: ({ email, password, }: { email: string; password: string; }) => Promise< | { status: "OK"; user: User; } | { status: "EMAIL_ALREADY_EXISTS_ERROR"; } >; signIn: ({ email, password, }: { email: string; password: string; }) => Promise< | { status: "OK"; user: User; } | { status: "WRONG_CREDENTIALS_ERROR"; } >; getUserById: ({ userId }: { userId: string }) => Promise<User | undefined>; getUserByEmail: ({ email }: { email: string }) => Promise<User | undefined>; createResetPasswordToken: ({ userId, }: { userId: string; }) => Promise< | { status: "OK"; token: string; } | { status: "UNKNOWN_USER_ID_ERROR"; } >; resetPasswordUsingToken: ({ token, newPassword, }: { token: string; newPassword: string; }) => Promise<{ status: "OK" | "RESET_PASSWORD_INVALID_TOKEN_ERROR"; }>; /** * @deprecated * */ getUsersOldestFirst: (_: { limit?: number | undefined; nextPaginationToken?: string | undefined; }) => Promise<never>; /** * @deprecated * */ getUsersNewestFirst: (_: { limit?: number | undefined; nextPaginationToken?: string | undefined; }) => Promise<never>; /** * @deprecated * */ getUserCount: () => Promise<never>; updateEmailOrPassword: (input: { userId: string; email?: string | undefined; password?: string | undefined; }) => Promise<{ status: "OK" | "EMAIL_ALREADY_EXISTS_ERROR" | "UNKNOWN_USER_ID_ERROR"; }>; }
jscyo/supertokens-node
lib/build/recipe/thirdpartyemailpassword/recipeImplementation/emailPasswordRecipeImplementation.d.ts
TypeScript
FunctionDeclaration
export function assertIsArray(input: any): asserts input is Array<any> { if (!Array.isArray(input)) throw new AssertionError(`${input} is not Array.`) }
Aleksan107/LbrX
spec/__test__/functions/assert-is-array.ts
TypeScript
ArrowFunction
() => { return useContext(AccessTokenContext); }
sirpaulmcd/Task-App
frontend/src/shared/contexts/AccessTokenContext.tsx
TypeScript
ArrowFunction
({ children, }: { children: ReactNode; }) => { //#region Access token management ------------------------------------------- const [accessToken, setAccessToken] = useState(""); const [authenticated, setAuthenticated] = useState(false); /** * Automatically set access token in Auth header and enable cookies */ axios.defaults.headers.common["Authorization"] = accessToken; axios.defaults.withCredentials = true; /** * Signs user in by setting access token. */ const login = useCallback((value: string): void => { setAccessToken(value); }, []); /** * Authentication is toggled whenever the state of the access token changes. * The `authenticated` boolean is used to tell the rest of the react * components whether or not the user is authenticated. */ useEffect(() => { if (accessToken) { setAuthenticated(true); } else { setAuthenticated(false); } }, [accessToken]); /** * Signs user out by erasing the session's refresh token from the database * and setting the local access token state to an empty string. */ const logout = useCallback(async () => { await axios .post(`${process.env.REACT_APP_BACKEND_URI}/users/logout`, {}) .then((res) => { setAccessToken(""); window.location.reload(); }) .catch((error) => { console.log(error); }); }, []); //#endregion //#region Periodically renewing tokens -------------------------------------- const [loading, setLoading] = useState(true); /** * Renews access/refresh tokens. Note that access tokens are stored in react * state and refresh tokens are stored in HTTPOnly browser cookies. */ const renewTokensMutation = useCallback(async () => { setLoading(true); await axios .post(`${process.env.REACT_APP_BACKEND_URI}/users/refresh`) .then((res) => { if (res.status === 200) { login(res.data.accessToken); } else { logout(); } }) .catch((error) => { // console.log(error); }); setLoading(false); }, [login, logout]); /** * Renew tokens is ran when a user initially loads the app (or after * refreshing). If the user's refresh token is valid, their access/refresh * tokens are renewed. This allows users to remain authenticated after * refreshing the page or after the browser has been closed. Afterwards, * tokens are renewed every 14.5 minutes to ensure that the access token is * replaced before its 15 minute expiration time. This is known as silent * authentication. */ useEffect(() => { renewTokensMutation(); setInterval(renewTokensMutation, 870000); }, [renewTokensMutation]); //#endregion //#region TSX --------------------------------------------------------------- return ( <AccessTokenContext.Provider value={{ authenticated, login, logout, loading, }}
sirpaulmcd/Task-App
frontend/src/shared/contexts/AccessTokenContext.tsx
TypeScript
ArrowFunction
(value: string): void => { setAccessToken(value); }
sirpaulmcd/Task-App
frontend/src/shared/contexts/AccessTokenContext.tsx
TypeScript
ArrowFunction
() => { if (accessToken) { setAuthenticated(true); } else { setAuthenticated(false); } }
sirpaulmcd/Task-App
frontend/src/shared/contexts/AccessTokenContext.tsx
TypeScript
ArrowFunction
async () => { await axios .post(`${process.env.REACT_APP_BACKEND_URI}/users/logout`, {}) .then((res) => { setAccessToken(""); window.location.reload(); }) .catch((error) => { console.log(error); }); }
sirpaulmcd/Task-App
frontend/src/shared/contexts/AccessTokenContext.tsx
TypeScript
ArrowFunction
(res) => { setAccessToken(""); window.location.reload(); }
sirpaulmcd/Task-App
frontend/src/shared/contexts/AccessTokenContext.tsx
TypeScript
ArrowFunction
(error) => { console.log(error); }
sirpaulmcd/Task-App
frontend/src/shared/contexts/AccessTokenContext.tsx
TypeScript
ArrowFunction
async () => { setLoading(true); await axios .post(`${process.env.REACT_APP_BACKEND_URI}/users/refresh`) .then((res) => { if (res.status === 200) { login(res.data.accessToken); } else { logout(); } }) .catch((error) => { // console.log(error); }); setLoading(false); }
sirpaulmcd/Task-App
frontend/src/shared/contexts/AccessTokenContext.tsx
TypeScript
ArrowFunction
(res) => { if (res.status === 200) { login(res.data.accessToken); } else { logout(); } }
sirpaulmcd/Task-App
frontend/src/shared/contexts/AccessTokenContext.tsx
TypeScript
ArrowFunction
(error) => { // console.log(error); }
sirpaulmcd/Task-App
frontend/src/shared/contexts/AccessTokenContext.tsx
TypeScript
ArrowFunction
() => { renewTokensMutation(); setInterval(renewTokensMutation, 870000); }
sirpaulmcd/Task-App
frontend/src/shared/contexts/AccessTokenContext.tsx
TypeScript
FunctionDeclaration
function listToString(list: Array<string>, indentLevel: number) { const space = " ".repeat(indentLevel * 2) return list.join(`\n${space}`) }
Eshva/electron-builder
packages/app-builder-lib/src/targets/MsiTarget.ts
TypeScript