type stringclasses 7
values | content stringlengths 4 9.55k | repo stringlengths 7 96 | path stringlengths 4 178 | language stringclasses 1
value |
|---|---|---|---|---|
MethodDeclaration |
protected calcTimeout(storedAt: number, expiration: number): number {
const now = Date.now();
const delta = (expiration - storedAt) * this.timeoutFactor - (now - storedAt);
return Math.max(0, delta);
} | vadjs/angular-oauth2-oidc | projects/lib/src/oauth-service.ts | TypeScript |
MethodDeclaration | /**
* DEPRECATED. Use a provider for OAuthStorage instead:
*
* { provide: OAuthStorage, useFactory: oAuthStorageFactory }
* export function oAuthStorageFactory(): OAuthStorage { return localStorage; }
* Sets a custom storage used to store the received
* tokens on client side. By default, t... | vadjs/angular-oauth2-oidc | projects/lib/src/oauth-service.ts | TypeScript |
MethodDeclaration | /**
* Loads the discovery document to configure most
* properties of this service. The url of the discovery
* document is infered from the issuer's url according
* to the OpenId Connect spec. To use another url you
* can pass it to to optional parameter fullUrl.
*
* @param fullUrl
... | vadjs/angular-oauth2-oidc | projects/lib/src/oauth-service.ts | TypeScript |
MethodDeclaration |
protected loadJwks(): Promise<object> {
return new Promise<object>((resolve, reject) => {
if (this.jwksUri) {
this.http.get(this.jwksUri).subscribe(
jwks => {
this.jwks = jwks;
this.eventsSubject.next(
... | vadjs/angular-oauth2-oidc | projects/lib/src/oauth-service.ts | TypeScript |
MethodDeclaration |
protected validateDiscoveryDocument(doc: OidcDiscoveryDoc): boolean {
let errors: string[];
if (!this.skipIssuerCheck && doc.issuer !== this.issuer) {
this.logger.error(
'invalid issuer in discovery document',
'expected: ' + this.issuer,
'cur... | vadjs/angular-oauth2-oidc | projects/lib/src/oauth-service.ts | TypeScript |
MethodDeclaration | /**
* Uses password flow to exchange userName and password for an
* access_token. After receiving the access_token, this method
* uses it to query the userinfo endpoint in order to get information
* about the user in question.
*
* When using this, make sure that the property oidc is set to... | vadjs/angular-oauth2-oidc | projects/lib/src/oauth-service.ts | TypeScript |
MethodDeclaration | /**
* Loads the user profile by accessing the user info endpoint defined by OpenId Connect.
*
* When using this with OAuth2 password flow, make sure that the property oidc is set to false.
* Otherwise stricter validations take place that make this operation fail.
*/
public loadUserProfile(): Pr... | vadjs/angular-oauth2-oidc | projects/lib/src/oauth-service.ts | TypeScript |
MethodDeclaration | /**
* Uses password flow to exchange userName and password for an access_token.
* @param userName
* @param password
* @param headers Optional additional http-headers.
*/
public fetchTokenUsingPasswordFlow(
userName: string,
password: string,
headers: HttpHeaders = new Ht... | vadjs/angular-oauth2-oidc | projects/lib/src/oauth-service.ts | TypeScript |
MethodDeclaration | /**
* Refreshes the token using a refresh_token.
* This does not work for implicit flow, b/c
* there is no refresh_token in this flow.
* A solution for this is provided by the
* method silentRefresh.
*/
public refreshToken(): Promise<TokenResponse> {
if (!this.validateUrlForHttps(... | vadjs/angular-oauth2-oidc | projects/lib/src/oauth-service.ts | TypeScript |
MethodDeclaration |
protected removeSilentRefreshEventListener(): void {
if (this.silentRefreshPostMessageEventListener) {
window.removeEventListener(
'message',
this.silentRefreshPostMessageEventListener
);
this.silentRefreshPostMessageEventListener = null;
... | vadjs/angular-oauth2-oidc | projects/lib/src/oauth-service.ts | TypeScript |
MethodDeclaration |
protected setupSilentRefreshEventListener(): void {
this.removeSilentRefreshEventListener();
this.silentRefreshPostMessageEventListener = (e: MessageEvent) => {
const message = this.processMessageEventMessage(e);
this.tryLogin({
customHashFragment: message,
... | vadjs/angular-oauth2-oidc | projects/lib/src/oauth-service.ts | TypeScript |
MethodDeclaration | /**
* Performs a silent refresh for implicit flow.
* Use this method to get new tokens when/before
* the existing tokens expire.
*/
public silentRefresh(params: object = {}, noPrompt = true): Promise<OAuthEvent> {
const claims: object = this.getIdentityClaims() || {};
if (this.useId... | vadjs/angular-oauth2-oidc | projects/lib/src/oauth-service.ts | TypeScript |
MethodDeclaration |
public initImplicitFlowInPopup(options?: { height?: number, width?: number }) {
options = options || {};
return this.createLoginUrl(null, null, this.silentRefreshRedirectUri, false, {
display: 'popup'
}).then(url => {
return new Promise((resolve, reject) => {
... | vadjs/angular-oauth2-oidc | projects/lib/src/oauth-service.ts | TypeScript |
MethodDeclaration |
protected calculatePopupFeatures(options: { height?: number, width?: number }): string {
// Specify an static height and width and calculate centered position
const height = options.height || 470;
const width = options.width || 500;
const left = (screen.width / 2) - (width / 2);
... | vadjs/angular-oauth2-oidc | projects/lib/src/oauth-service.ts | TypeScript |
MethodDeclaration |
protected processMessageEventMessage(e: MessageEvent): string {
let expectedPrefix = '#';
if (this.silentRefreshMessagePrefix) {
expectedPrefix += this.silentRefreshMessagePrefix;
}
if (!e || !e.data || typeof e.data !== 'string') {
return;
}
c... | vadjs/angular-oauth2-oidc | projects/lib/src/oauth-service.ts | TypeScript |
MethodDeclaration |
protected canPerformSessionCheck(): boolean {
if (!this.sessionChecksEnabled) {
return false;
}
if (!this.sessionCheckIFrameUrl) {
console.warn(
'sessionChecksEnabled is activated but there is no sessionCheckIFrameUrl'
);
return fa... | vadjs/angular-oauth2-oidc | projects/lib/src/oauth-service.ts | TypeScript |
MethodDeclaration |
protected setupSessionCheckEventListener(): void {
this.removeSessionCheckEventListener();
this.sessionCheckEventListener = (e: MessageEvent) => {
const origin = e.origin.toLowerCase();
const issuer = this.issuer.toLowerCase();
this.debug('sessionCheckEventListener... | vadjs/angular-oauth2-oidc | projects/lib/src/oauth-service.ts | TypeScript |
MethodDeclaration |
protected handleSessionUnchanged(): void {
this.debug('session check', 'session unchanged');
} | vadjs/angular-oauth2-oidc | projects/lib/src/oauth-service.ts | TypeScript |
MethodDeclaration |
protected handleSessionChange(): void {
/* events: session_changed, relogin, stopTimer, logged_out*/
this.eventsSubject.next(new OAuthInfoEvent('session_changed'));
this.stopSessionCheckTimer();
if (this.silentRefreshRedirectUri) {
this.silentRefresh().catch(_ =>
... | vadjs/angular-oauth2-oidc | projects/lib/src/oauth-service.ts | TypeScript |
MethodDeclaration |
protected waitForSilentRefreshAfterSessionChange(): void {
this.events
.pipe(
filter(
(e: OAuthEvent) =>
e.type === 'silently_refreshed' ||
e.type === 'silent_refresh_timeout' ||
e.type === '... | vadjs/angular-oauth2-oidc | projects/lib/src/oauth-service.ts | TypeScript |
MethodDeclaration |
protected handleSessionError(): void {
this.stopSessionCheckTimer();
this.eventsSubject.next(new OAuthInfoEvent('session_error'));
} | vadjs/angular-oauth2-oidc | projects/lib/src/oauth-service.ts | TypeScript |
MethodDeclaration |
protected removeSessionCheckEventListener(): void {
if (this.sessionCheckEventListener) {
window.removeEventListener('message', this.sessionCheckEventListener);
this.sessionCheckEventListener = null;
}
} | vadjs/angular-oauth2-oidc | projects/lib/src/oauth-service.ts | TypeScript |
MethodDeclaration |
protected initSessionCheck(): void {
if (!this.canPerformSessionCheck()) {
return;
}
const existingIframe = document.getElementById(this.sessionCheckIFrameName);
if (existingIframe) {
document.body.removeChild(existingIframe);
}
const iframe = d... | vadjs/angular-oauth2-oidc | projects/lib/src/oauth-service.ts | TypeScript |
MethodDeclaration |
protected startSessionCheckTimer(): void {
this.stopSessionCheckTimer();
this.ngZone.runOutsideAngular(() => {
this.sessionCheckTimer = setInterval(
this.checkSession.bind(this),
this.sessionCheckIntervall
);
});
} | vadjs/angular-oauth2-oidc | projects/lib/src/oauth-service.ts | TypeScript |
MethodDeclaration |
protected stopSessionCheckTimer(): void {
if (this.sessionCheckTimer) {
clearInterval(this.sessionCheckTimer);
this.sessionCheckTimer = null;
}
} | vadjs/angular-oauth2-oidc | projects/lib/src/oauth-service.ts | TypeScript |
MethodDeclaration |
protected checkSession(): void {
const iframe: any = document.getElementById(this.sessionCheckIFrameName);
if (!iframe) {
this.logger.warn(
'checkSession did not find iframe',
this.sessionCheckIFrameName
);
}
const sessionState =... | vadjs/angular-oauth2-oidc | projects/lib/src/oauth-service.ts | TypeScript |
MethodDeclaration |
protected async createLoginUrl(
state = '',
loginHint = '',
customRedirectUri = '',
noPrompt = false,
params: object = {}
): Promise<string> {
const that = this;
let redirectUri: string;
if (customRedirectUri) {
redirectUri = customRedir... | vadjs/angular-oauth2-oidc | projects/lib/src/oauth-service.ts | TypeScript |
MethodDeclaration |
initImplicitFlowInternal(
additionalState = '',
params: string | object = ''
): void {
if (this.inImplicitFlow) {
return;
}
this.inImplicitFlow = true;
if (!this.validateUrlForHttps(this.loginUrl)) {
throw new Error(
'loginUr... | vadjs/angular-oauth2-oidc | projects/lib/src/oauth-service.ts | TypeScript |
MethodDeclaration | /**
* Starts the implicit flow and redirects to user to
* the auth servers' login url.
*
* @param additionalState Optional state that is passed around.
* You'll find this state in the property `state` after `tryLogin` logged in the user.
* @param params Hash with additional parameter. If ... | vadjs/angular-oauth2-oidc | projects/lib/src/oauth-service.ts | TypeScript |
MethodDeclaration | /**
* Reset current implicit flow
*
* @description This method allows resetting the current implict flow in order to be initialized again.
*/
public resetImplicitFlow(): void {
this.inImplicitFlow = false;
} | vadjs/angular-oauth2-oidc | projects/lib/src/oauth-service.ts | TypeScript |
MethodDeclaration |
protected callOnTokenReceivedIfExists(options: LoginOptions): void {
const that = this;
if (options.onTokenReceived) {
const tokenParams = {
idClaims: that.getIdentityClaims(),
idToken: that.getIdToken(),
accessToken: that.getAccessToken(),
... | vadjs/angular-oauth2-oidc | projects/lib/src/oauth-service.ts | TypeScript |
MethodDeclaration |
protected storeAccessTokenResponse(
accessToken: string,
refreshToken: string,
expiresIn: number,
grantedScopes: String
): void {
this._storage.setItem('access_token', accessToken);
if (grantedScopes) {
this._storage.setItem('granted_scopes', JSON.stringi... | vadjs/angular-oauth2-oidc | projects/lib/src/oauth-service.ts | TypeScript |
MethodDeclaration | /**
* Delegates to tryLoginImplicitFlow for the sake of competability
* @param options Optional options.
*/
public tryLogin(options: LoginOptions = null): Promise<boolean> {
if (this.config.responseType === 'code') {
return this.tryLoginCodeFlow().then(_ => true);
}
el... | vadjs/angular-oauth2-oidc | projects/lib/src/oauth-service.ts | TypeScript |
MethodDeclaration |
private parseQueryString(queryString: string): object {
if (!queryString || queryString.length === 0) {
return {};
}
if (queryString.charAt(0) === '?') {
queryString = queryString.substr(1);
}
return this.urlHelper.parseQueryString(queryString);
} | vadjs/angular-oauth2-oidc | projects/lib/src/oauth-service.ts | TypeScript |
MethodDeclaration |
public tryLoginCodeFlow(): Promise<void> {
const parts = this.parseQueryString(window.location.search)
const code = parts['code'];
const state = parts['state'];
const href = location.href
.replace(/[&\?]code=[^&\$]*/, '')
.replace(/[&\?... | vadjs/angular-oauth2-oidc | projects/lib/src/oauth-service.ts | TypeScript |
MethodDeclaration | /**
* Get token using an intermediate code. Works for the Authorization Code flow.
*/
private getTokenFromCode(code: string): Promise<TokenResponse> {
let params = new HttpParams()
.set('grant_type', 'authorization_code')
.set('code', code)
.set('redirect_uri', this... | vadjs/angular-oauth2-oidc | projects/lib/src/oauth-service.ts | TypeScript |
MethodDeclaration |
private fetchAndProcessToken(params: HttpParams): Promise<TokenResponse> {
let headers = new HttpHeaders()
.set('Content-Type', 'application/x-www-form-urlencoded');
if (!this.validateUrlForHttps(this.tokenEndpoint)) {
throw new Error('tokenEndpoint must us... | vadjs/angular-oauth2-oidc | projects/lib/src/oauth-service.ts | TypeScript |
MethodDeclaration | /**
* Checks whether there are tokens in the hash fragment
* as a result of the implicit flow. These tokens are
* parsed, validated and used to sign the user in to the
* current client.
*
* @param options Optional options.
*/
public tryLoginImplicitFlow(options: LoginOptions = null): ... | vadjs/angular-oauth2-oidc | projects/lib/src/oauth-service.ts | TypeScript |
MethodDeclaration |
private parseState(state: string): [string, string] {
let nonce = state;
let userState = '';
if (state) {
const idx = state.indexOf(this.config.nonceStateSeparator);
if (idx > -1) {
nonce = state.substr(0, idx);
userState = state.substr(i... | vadjs/angular-oauth2-oidc | projects/lib/src/oauth-service.ts | TypeScript |
MethodDeclaration |
protected validateNonce(
nonceInState: string
): boolean {
const savedNonce = this._storage.getItem('nonce');
if (savedNonce !== nonceInState) {
const err = 'Validating access_token failed, wrong state/nonce.';
console.error(err, savedNonce, nonceInState... | vadjs/angular-oauth2-oidc | projects/lib/src/oauth-service.ts | TypeScript |
MethodDeclaration |
protected storeIdToken(idToken: ParsedIdToken): void {
this._storage.setItem('id_token', idToken.idToken);
this._storage.setItem('id_token_claims_obj', idToken.idTokenClaimsJson);
this._storage.setItem('id_token_expires_at', '' + idToken.idTokenExpiresAt);
this._storage.setItem('id_toke... | vadjs/angular-oauth2-oidc | projects/lib/src/oauth-service.ts | TypeScript |
MethodDeclaration |
protected storeSessionState(sessionState: string): void {
this._storage.setItem('session_state', sessionState);
} | vadjs/angular-oauth2-oidc | projects/lib/src/oauth-service.ts | TypeScript |
MethodDeclaration |
protected getSessionState(): string {
return this._storage.getItem('session_state');
} | vadjs/angular-oauth2-oidc | projects/lib/src/oauth-service.ts | TypeScript |
MethodDeclaration |
protected handleLoginError(options: LoginOptions, parts: object): void {
if (options.onLoginError) {
options.onLoginError(parts);
}
if (this.clearHashAfterLogin) {
location.hash = '';
}
} | vadjs/angular-oauth2-oidc | projects/lib/src/oauth-service.ts | TypeScript |
MethodDeclaration | /**
* @ignore
*/
public processIdToken(
idToken: string,
accessToken: string,
skipNonceCheck = false
): Promise<ParsedIdToken> {
const tokenParts = idToken.split('.');
const headerBase64 = this.padBase64(tokenParts[0]);
const headerJson = b64DecodeUnicode(he... | vadjs/angular-oauth2-oidc | projects/lib/src/oauth-service.ts | TypeScript |
MethodDeclaration | /**
* Returns the received claims about the user.
*/
public getIdentityClaims(): object {
const claims = this._storage.getItem('id_token_claims_obj');
if (!claims) {
return null;
}
return JSON.parse(claims);
} | vadjs/angular-oauth2-oidc | projects/lib/src/oauth-service.ts | TypeScript |
MethodDeclaration | /**
* Returns the granted scopes from the server.
*/
public getGrantedScopes(): object {
const scopes = this._storage.getItem('granted_scopes');
if (!scopes) {
return null;
}
return JSON.parse(scopes);
} | vadjs/angular-oauth2-oidc | projects/lib/src/oauth-service.ts | TypeScript |
MethodDeclaration | /**
* Returns the current id_token.
*/
public getIdToken(): string {
return this._storage
? this._storage.getItem('id_token')
: null;
} | vadjs/angular-oauth2-oidc | projects/lib/src/oauth-service.ts | TypeScript |
MethodDeclaration |
protected padBase64(base64data): string {
while (base64data.length % 4 !== 0) {
base64data += '=';
}
return base64data;
} | vadjs/angular-oauth2-oidc | projects/lib/src/oauth-service.ts | TypeScript |
MethodDeclaration | /**
* Returns the current access_token.
*/
public getAccessToken(): string {
return this._storage
? this._storage.getItem('access_token')
: null;
} | vadjs/angular-oauth2-oidc | projects/lib/src/oauth-service.ts | TypeScript |
MethodDeclaration |
public getRefreshToken(): string {
return this._storage
? this._storage.getItem('refresh_token')
: null;
} | vadjs/angular-oauth2-oidc | projects/lib/src/oauth-service.ts | TypeScript |
MethodDeclaration | /**
* Returns the expiration date of the access_token
* as milliseconds since 1970.
*/
public getAccessTokenExpiration(): number {
if (!this._storage.getItem('expires_at')) {
return null;
}
return parseInt(this._storage.getItem('expires_at'), 10);
} | vadjs/angular-oauth2-oidc | projects/lib/src/oauth-service.ts | TypeScript |
MethodDeclaration |
protected getAccessTokenStoredAt(): number {
return parseInt(this._storage.getItem('access_token_stored_at'), 10);
} | vadjs/angular-oauth2-oidc | projects/lib/src/oauth-service.ts | TypeScript |
MethodDeclaration |
protected getIdTokenStoredAt(): number {
return parseInt(this._storage.getItem('id_token_stored_at'), 10);
} | vadjs/angular-oauth2-oidc | projects/lib/src/oauth-service.ts | TypeScript |
MethodDeclaration | /**
* Returns the expiration date of the id_token
* as milliseconds since 1970.
*/
public getIdTokenExpiration(): number {
if (!this._storage.getItem('id_token_expires_at')) {
return null;
}
return parseInt(this._storage.getItem('id_token_expires_at'), 10);
} | vadjs/angular-oauth2-oidc | projects/lib/src/oauth-service.ts | TypeScript |
MethodDeclaration | /**
* Checkes, whether there is a valid access_token.
*/
public hasValidAccessToken(): boolean {
if (this.getAccessToken()) {
const expiresAt = this._storage.getItem('expires_at');
const now = new Date();
if (expiresAt && parseInt(expiresAt, 10) < now.getTime()) {
... | vadjs/angular-oauth2-oidc | projects/lib/src/oauth-service.ts | TypeScript |
MethodDeclaration | /**
* Checks whether there is a valid id_token.
*/
public hasValidIdToken(): boolean {
if (this.getIdToken()) {
const expiresAt = this._storage.getItem('id_token_expires_at');
const now = new Date();
if (expiresAt && parseInt(expiresAt, 10) < now.getTime()) {
... | vadjs/angular-oauth2-oidc | projects/lib/src/oauth-service.ts | TypeScript |
MethodDeclaration | /**
* Returns the auth-header that can be used
* to transmit the access_token to a service
*/
public authorizationHeader(): string {
return 'Bearer ' + this.getAccessToken();
} | vadjs/angular-oauth2-oidc | projects/lib/src/oauth-service.ts | TypeScript |
MethodDeclaration | /**
* Removes all tokens and logs the user out.
* If a logout url is configured, the user is
* redirected to it.
* @param noRedirectToLogoutUrl
*/
public logOut(noRedirectToLogoutUrl = false): void {
const id_token = this.getIdToken();
this._storage.removeItem('access_token');
... | vadjs/angular-oauth2-oidc | projects/lib/src/oauth-service.ts | TypeScript |
MethodDeclaration | /**
* @ignore
*/
public createAndSaveNonce(): Promise<string> {
const that = this;
return this.createNonce().then(function (nonce: any) {
that._storage.setItem('nonce', nonce);
return nonce;
});
} | vadjs/angular-oauth2-oidc | projects/lib/src/oauth-service.ts | TypeScript |
MethodDeclaration | /**
* @ignore
*/
public ngOnDestroy(): void {
this.clearAccessTokenTimer();
this.clearIdTokenTimer();
} | vadjs/angular-oauth2-oidc | projects/lib/src/oauth-service.ts | TypeScript |
MethodDeclaration |
protected createNonce(): Promise<string> {
return new Promise((resolve) => {
if (this.rngUrl) {
throw new Error(
'createNonce with rng-web-api has not been implemented so far'
);
}
/*
* This alphabet uses a-z ... | vadjs/angular-oauth2-oidc | projects/lib/src/oauth-service.ts | TypeScript |
MethodDeclaration |
protected async checkAtHash(params: ValidationParams): Promise<boolean> {
if (!this.tokenValidationHandler) {
this.logger.warn(
'No tokenValidationHandler configured. Cannot check at_hash.'
);
return true;
}
return this.tokenValidationHandler.... | vadjs/angular-oauth2-oidc | projects/lib/src/oauth-service.ts | TypeScript |
MethodDeclaration |
protected checkSignature(params: ValidationParams): Promise<any> {
if (!this.tokenValidationHandler) {
this.logger.warn(
'No tokenValidationHandler configured. Cannot check signature.'
);
return Promise.resolve(null);
}
return this.tokenValida... | vadjs/angular-oauth2-oidc | projects/lib/src/oauth-service.ts | TypeScript |
MethodDeclaration | /**
* Start the implicit flow or the code flow,
* depending on your configuration.
*/
public initLoginFlow(
additionalState = '',
params = {}
): void {
if (this.responseType === 'code') {
return this.initCodeFlow(additionalState, params);
} else {
... | vadjs/angular-oauth2-oidc | projects/lib/src/oauth-service.ts | TypeScript |
MethodDeclaration | /**
* Starts the authorization code flow and redirects to user to
* the auth servers login url.
*/
public initCodeFlow(
additionalState = '',
params = {}
): void {
if (this.loginUrl !== '') {
this.initCodeFlowInternal(additionalState, params);
} else {
... | vadjs/angular-oauth2-oidc | projects/lib/src/oauth-service.ts | TypeScript |
MethodDeclaration |
private initCodeFlowInternal(
additionalState = '',
params = {}
): void {
if (!this.validateUrlForHttps(this.loginUrl)) {
throw new Error('loginUrl must use Http. Also check property requireHttps.');
}
this.createLoginUrl(additionalState, '', null, false, param... | vadjs/angular-oauth2-oidc | projects/lib/src/oauth-service.ts | TypeScript |
MethodDeclaration |
protected async createChallangeVerifierPairForPKCE(): Promise<[string, string]> {
if (!this.crypto) {
throw new Error('PKCI support for code flow needs a CryptoHander. Did you import the OAuthModule using forRoot() ?');
}
const verifier = await this.createNonce();
const c... | vadjs/angular-oauth2-oidc | projects/lib/src/oauth-service.ts | TypeScript |
ArrowFunction |
({ hover }) => ({
textDecoration: hover ? 'underline' : 'none',
textDecorationColor: 'black',
cursor: 'pointer',
}) | torin-asakura/drum-in | ui/link/src/link.styles.ts | TypeScript |
ClassDeclaration |
@NgModule({
declarations:[AuthComponent],
imports:[FormsModule,CommonModule,SharedModule,RouterModule.forChild([
{ path: '', component: AuthComponent }
])],
exports:[AuthComponent,FormsModule]
})
export class AuthModule{
} | pradeepjava/recipe-book | src/app/auth/auth.module.ts | TypeScript |
ClassDeclaration |
export class CreateAccountDTO {
@ApiProperty()
@Length(MIN_EMAIL_LEN, MAX_EMAIL_LEN)
// @IsEmail()
public email: string;
@ApiProperty()
@Length(MIN_PW_LEN, MAX_PW_LEN)
@IsString()
public password: string;
@ApiProperty()
@Length(MIN_NAME_LEN, MAX_NAME_LEN)
@IsOptional()
@IsString()
public name: string | ... | TeamArchive/Archive_SNS | server/src/account/dtos/createAccount.dto.ts | TypeScript |
MethodDeclaration |
public static toEntity( accountDTO: CreateAccountDTO ): Account {
const {
email,
password,
name,
status_msg
} = accountDTO;
const new_account = new Account;
new_account.email = sanitizeHtml(email);
new_account.name = sanitizeHtml(name);
new_account.password = sanitizeHtml(password);
new_... | TeamArchive/Archive_SNS | server/src/account/dtos/createAccount.dto.ts | TypeScript |
FunctionDeclaration |
export function NumberOfItems() {
return (
<CountItems>
<NumberItem>1</NumberItem>
</CountItems>
);
} | joaovictor3g/submarino-mobile-clone | src/components/NumberOfItems/index.tsx | TypeScript |
FunctionDeclaration | /**
*
* @param app
* @param siteKeyOrProvider - optional custom attestation provider
* or reCAPTCHA siteKey
* @param isTokenAutoRefreshEnabled - if true, enables auto refresh
* of appCheck token.
*/
export function activate(
app: FirebaseApp,
siteKeyOrProvider: string | AppCheckProvider,
isTokenAutoRefresh... | ChaseKnowlden/firebase-js-sdk | packages/app-check/src/api.ts | TypeScript |
FunctionDeclaration |
export function setTokenAutoRefreshEnabled(
app: FirebaseApp,
isTokenAutoRefreshEnabled: boolean
): void {
const state = getState(app);
// This will exist if any product libraries have called
// `addTokenListener()`
if (state.tokenRefresher) {
if (isTokenAutoRefreshEnabled === true) {
state.token... | ChaseKnowlden/firebase-js-sdk | packages/app-check/src/api.ts | TypeScript |
ArrowFunction |
() => {
/* we don't care about the initialization result in activate() */
} | ChaseKnowlden/firebase-js-sdk | packages/app-check/src/api.ts | TypeScript |
FunctionDeclaration |
function defaultCache<Result>(): ILoadAndCompileCache<MakeComponentFromServer<Result>> {
return ({
debug(s: string){console.log(s)},
loadFromBlob(jsonBlob: any) {throw Error('ComponentCacheContext.Provider probably not created')},
getFromCache(url: string) {throw Error('ComponentCacheCo... | focuson-ts/focuson | modules/codeondemand/src/ComponentCacheContext.tsx | TypeScript |
MethodDeclaration |
debug(s: string){console.log(s)} | focuson-ts/focuson | modules/codeondemand/src/ComponentCacheContext.tsx | TypeScript |
MethodDeclaration |
loadFromBlob(jsonBlob: any) {throw Error('ComponentCacheContext.Provider probably not created')} | focuson-ts/focuson | modules/codeondemand/src/ComponentCacheContext.tsx | TypeScript |
MethodDeclaration |
getFromCache(url: string) {throw Error('ComponentCacheContext.Provider probably not created')} | focuson-ts/focuson | modules/codeondemand/src/ComponentCacheContext.tsx | TypeScript |
ClassDeclaration |
export class DemoSharedFirebaseFirestore extends DemoSharedBase {
testIt() {
console.log('test firebase-firestore!');
}
} | Langers8/firebase | tools/demo/firebase-firestore/index.ts | TypeScript |
MethodDeclaration |
testIt() {
console.log('test firebase-firestore!');
} | Langers8/firebase | tools/demo/firebase-firestore/index.ts | TypeScript |
FunctionDeclaration |
export async function expectPipeResult<I, O>(
source: I[],
operator: OperatorFunction<I, O>,
result: O[],
): Promise<void> {
expect(await pipeAndCollect(source, operator)).toEqual(result);
} | simontonsoftware/s-rxjs-utils | projects/s-rxjs-utils/src/test-helpers/misc-helpers.ts | TypeScript |
FunctionDeclaration |
export function pipeAndCollect<I, O>(
source: I[],
operator: OperatorFunction<I, O>,
): Promise<O[]> {
return of(...source)
.pipe(operator, toArray())
.toPromise();
} | simontonsoftware/s-rxjs-utils | projects/s-rxjs-utils/src/test-helpers/misc-helpers.ts | TypeScript |
FunctionDeclaration |
export function testUserFunctionError(
buildOperator: (thrower: () => never) => OperatorFunction<any, any>,
upstreamValue: any,
): () => void {
return marbleTest(({ hot, expectObservable, expectSubscriptions }) => {
const thrower = () => {
// this is the error TestScheduler expects when it sees "#"
... | simontonsoftware/s-rxjs-utils | projects/s-rxjs-utils/src/test-helpers/misc-helpers.ts | TypeScript |
FunctionDeclaration |
export function testUnsubscribePropagation(
buildOperator: () => OperatorFunction<any, any>,
): () => void {
return marbleTest(({ hot, expectObservable, expectSubscriptions }) => {
const source = hot('-');
const sub1 = '-^---! ';
const sub2 = '---^---!';
expectObservable(source.pipe(buildOperator... | simontonsoftware/s-rxjs-utils | projects/s-rxjs-utils/src/test-helpers/misc-helpers.ts | TypeScript |
FunctionDeclaration |
export function testErrorPropagation(
buildOperator: () => OperatorFunction<any, any>,
): () => void {
return marbleTest(({ hot, expectObservable, expectSubscriptions }) => {
const source = hot('-#');
const subs = ' ^!';
const expected = ' -#';
expectObservable(source.pipe(buildOperator())).... | simontonsoftware/s-rxjs-utils | projects/s-rxjs-utils/src/test-helpers/misc-helpers.ts | TypeScript |
FunctionDeclaration |
export function testCompletionPropagation(
buildOperator: () => OperatorFunction<any, any>,
): () => void {
return marbleTest(({ hot, expectObservable, expectSubscriptions }) => {
const source = hot('----|');
const sub1 = ' ^----';
const sourceSub1 = '^---!';
const sub2 = ' --^--';
co... | simontonsoftware/s-rxjs-utils | projects/s-rxjs-utils/src/test-helpers/misc-helpers.ts | TypeScript |
FunctionDeclaration |
export function subscribeWithStubs(
observable: Observable<any>,
): StubbedSubscriber {
const subscriber = new StubbedSubscriber();
observable.subscribe(subscriber);
return subscriber;
} | simontonsoftware/s-rxjs-utils | projects/s-rxjs-utils/src/test-helpers/misc-helpers.ts | TypeScript |
ArrowFunction |
({ hot, expectObservable, expectSubscriptions }) => {
const thrower = () => {
// this is the error TestScheduler expects when it sees "#"
// tslint:disable-next-line:no-string-throw
throw 'error';
};
const source = hot('-1-', { 1: upstreamValue });
const expect1 = ' -# ';
const ... | simontonsoftware/s-rxjs-utils | projects/s-rxjs-utils/src/test-helpers/misc-helpers.ts | TypeScript |
ArrowFunction |
() => {
// this is the error TestScheduler expects when it sees "#"
// tslint:disable-next-line:no-string-throw
throw 'error';
} | simontonsoftware/s-rxjs-utils | projects/s-rxjs-utils/src/test-helpers/misc-helpers.ts | TypeScript |
ArrowFunction |
() => new BehaviorSubject('a') | simontonsoftware/s-rxjs-utils | projects/s-rxjs-utils/src/test-helpers/misc-helpers.ts | TypeScript |
ArrowFunction |
({ hot, expectObservable, expectSubscriptions }) => {
const source = hot('-');
const sub1 = '-^---! ';
const sub2 = '---^---!';
expectObservable(source.pipe(buildOperator()), sub1).toBe('-');
expectObservable(source.pipe(buildOperator()), sub2).toBe('-');
expectSubscriptions(source.subscripti... | simontonsoftware/s-rxjs-utils | projects/s-rxjs-utils/src/test-helpers/misc-helpers.ts | TypeScript |
ArrowFunction |
({ hot, expectObservable, expectSubscriptions }) => {
const source = hot('-#');
const subs = ' ^!';
const expected = ' -#';
expectObservable(source.pipe(buildOperator())).toBe(expected);
expectObservable(source.pipe(buildOperator())).toBe(expected);
expectSubscriptions(source.subscriptio... | simontonsoftware/s-rxjs-utils | projects/s-rxjs-utils/src/test-helpers/misc-helpers.ts | TypeScript |
ArrowFunction |
({ hot, expectObservable, expectSubscriptions }) => {
const source = hot('----|');
const sub1 = ' ^----';
const sourceSub1 = '^---!';
const sub2 = ' --^--';
const sourceSub2 = '--^-!';
const expected = ' ----|';
expectObservable(source.pipe(buildOperator()), sub1).toBe(expected)... | simontonsoftware/s-rxjs-utils | projects/s-rxjs-utils/src/test-helpers/misc-helpers.ts | TypeScript |
ArrowFunction |
(config: Config) =>
new DataMapper({
client: new DynamoDB(config.dynamoDB),
tableNamePrefix: config.dynamoDBTablePrefix,
}) | AtifKhokhar/office-booker | server/db/officeBookings.ts | TypeScript |
ArrowFunction |
async (
config: Config,
office: OfficeQuota,
date: string,
includeParking: boolean
) => {
const mapper = buildMapper(config);
try {
await mapper.put(
Object.assign(new OfficeBookingModel(), {
name: office.id,
date,
bookingCount: 0,
parkingCount: 0,
ttl: ge... | AtifKhokhar/office-booker | server/db/officeBookings.ts | TypeScript |
ArrowFunction |
async (
config: Config,
officeId: string,
date: string,
includeParking: boolean
) => {
const attributes = new ExpressionAttributes();
const updateExpression = new UpdateExpression();
updateExpression.set(
'bookingCount',
new MathematicalExpression(new AttributePath('bookingCount'), '-', 1)
);
... | AtifKhokhar/office-booker | server/db/officeBookings.ts | TypeScript |
ArrowFunction |
async (
config: Config,
officeId: string,
dates: string[]
): Promise<OfficeBookingModel[]> => {
const mapper = buildMapper(config);
const resultKey = (model: OfficeBookingModel) => model.date;
const resultsMap = new Map(
dates.map((date) => {
const model = Object.assign(new OfficeBookingModel(), ... | AtifKhokhar/office-booker | server/db/officeBookings.ts | TypeScript |
ArrowFunction |
(model: OfficeBookingModel) => model.date | AtifKhokhar/office-booker | server/db/officeBookings.ts | TypeScript |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.