type
stringclasses
7 values
content
stringlengths
4
9.55k
repo
stringlengths
7
96
path
stringlengths
4
178
language
stringclasses
1 value
ClassDeclaration
export class SessionContextClass implements SessionContext { private _req: BlitzApiRequest private _res: MiddlewareResponse private _kernel: SessionKernel constructor(req: BlitzApiRequest, res: MiddlewareResponse, kernel: SessionKernel) { this._req = req this._res = res this._kernel = kernel } ...
alii/blitz
packages/server/src/supertokens.ts
TypeScript
TypeAliasDeclaration
type SimpleRolesIsAuthorizedArgs = { ctx: any args: [roleOrRoles?: string | string[]] }
alii/blitz
packages/server/src/supertokens.ts
TypeScript
TypeAliasDeclaration
type JwtPayload = AnonymousSessionPayload | null
alii/blitz
packages/server/src/supertokens.ts
TypeScript
TypeAliasDeclaration
type AnonSessionKernel = { handle: string publicData: PublicData jwtPayload: JwtPayload antiCSRFToken: string anonymousSessionToken: string }
alii/blitz
packages/server/src/supertokens.ts
TypeScript
TypeAliasDeclaration
type AuthedSessionKernel = { handle: string publicData: PublicData jwtPayload: JwtPayload antiCSRFToken: string sessionToken: string }
alii/blitz
packages/server/src/supertokens.ts
TypeScript
TypeAliasDeclaration
type SessionKernel = AnonSessionKernel | AuthedSessionKernel
alii/blitz
packages/server/src/supertokens.ts
TypeScript
TypeAliasDeclaration
export type AnonymousSessionPayload = { isAnonymous: true handle: string publicData: PublicData antiCSRFToken: string }
alii/blitz
packages/server/src/supertokens.ts
TypeScript
MethodDeclaration
get(target, prop, receiver) { if (prop in target || prop === "then") { return Reflect.get(target, prop, receiver) } else { return Reflect.get(target.$publicData, prop, receiver) } }
alii/blitz
packages/server/src/supertokens.ts
TypeScript
MethodDeclaration
$authorize(...args: IsAuthorizedArgs) { const e = new AuthenticationError() Error.captureStackTrace(e, this.$authorize) if (!this.userId) throw e if (!this.$isAuthorized(...args)) { const e = new AuthorizationError() Error.captureStackTrace(e, this.$authorize) throw e } }
alii/blitz
packages/server/src/supertokens.ts
TypeScript
MethodDeclaration
$isAuthorized(...args: IsAuthorizedArgs) { if (!this.userId) return false return config.isAuthorized({ctx: this._res.blitzCtx, args}) }
alii/blitz
packages/server/src/supertokens.ts
TypeScript
MethodDeclaration
async $create(publicData: PublicData, privateData?: Record<any, any>) { this._kernel = await createNewSession(this._req, this._res, publicData, privateData, { jwtPayload: this._kernel.jwtPayload, }) }
alii/blitz
packages/server/src/supertokens.ts
TypeScript
MethodDeclaration
$revoke() { return revokeSession(this._req, this._res, this.$handle) }
alii/blitz
packages/server/src/supertokens.ts
TypeScript
MethodDeclaration
async $revokeAll() { if (!this.$publicData.userId) { throw new Error("session.revokeAll() cannot be used with anonymous sessions") } await revokeAllSessionsForUser(this._req, this._res, this.$publicData.userId) return }
alii/blitz
packages/server/src/supertokens.ts
TypeScript
MethodDeclaration
async $setPublicData(data: Record<any, any>) { if (this.userId && data.roles) { await updateAllPublicDataRolesForUser(this.userId, data.roles) } this._kernel.publicData = await setPublicData(this._req, this._res, this._kernel, data) }
alii/blitz
packages/server/src/supertokens.ts
TypeScript
MethodDeclaration
async $getPrivateData() { return (await getPrivateData(this.$handle)) || {} }
alii/blitz
packages/server/src/supertokens.ts
TypeScript
MethodDeclaration
$setPrivateData(data: Record<any, any>) { return setPrivateData(this._kernel, data) }
alii/blitz
packages/server/src/supertokens.ts
TypeScript
FunctionDeclaration
export function solution(record: string[]) { const answer: string[] = [] for (const message of record) { const splited = message.split(' ') as message if (isEdit[splited[method]]) uid2Name[splited[uid]] = splited[name] } for (const message of record) { const splited = message.split(' ') as messa...
x86chi/problem-solving
programmers.com/learn/courses/30/lessons/42888.ts
TypeScript
TypeAliasDeclaration
type message = ['Enter' | 'Change' | 'Leave', string, string]
x86chi/problem-solving
programmers.com/learn/courses/30/lessons/42888.ts
TypeScript
FunctionDeclaration
/** * Shorthand function to display a simple SweetAlert modal. * * ex. * import swal from 'sweetalert2'; * swal('The Internet?', 'That thing is still around?', 'question'); */ function swal(title: string, message?: string, type?: SweetAlertType): Promise<SweetAlertResult>;
Kuzcoo/sweetalert2
sweetalert2.d.ts
TypeScript
FunctionDeclaration
/** * Function to display a SweetAlert modal, with an object of options, all being optional. * See the SweetAlertOptions interface for the list of accepted fields and values. * * ex. * import swal from 'sweetalert2'; * swal({ * title: 'Auto close alert!', * text: 'I w...
Kuzcoo/sweetalert2
sweetalert2.d.ts
TypeScript
FunctionDeclaration
/** * @deprecated * swal() overload for legacy alerts that use { useRejections: true }. */ function swal(settings: SweetAlertOptions & { useRejections: true }): Promise<any>;
Kuzcoo/sweetalert2
sweetalert2.d.ts
TypeScript
FunctionDeclaration
/** * Determine if modal is shown. * Be aware that the library returns a trueish or falsy value, not a real boolean. */ function isVisible(): boolean;
Kuzcoo/sweetalert2
sweetalert2.d.ts
TypeScript
FunctionDeclaration
/** * If you end up using a lot of the same settings when calling SweetAlert2, * you can use setDefaults at the start of your program to set them once and for all! */ function setDefaults(defaultOptions: SweetAlertOptions): void;
Kuzcoo/sweetalert2
sweetalert2.d.ts
TypeScript
FunctionDeclaration
/** * Resets settings to their default value. */ function resetDefaults(): void;
Kuzcoo/sweetalert2
sweetalert2.d.ts
TypeScript
FunctionDeclaration
/** * Close the currently open SweetAlert2 modal programmatically. */ function close(onComplete?: (modalElement: HTMLElement) => void): void;
Kuzcoo/sweetalert2
sweetalert2.d.ts
TypeScript
FunctionDeclaration
/** * Get the modal title. */ function getTitle(): HTMLElement;
Kuzcoo/sweetalert2
sweetalert2.d.ts
TypeScript
FunctionDeclaration
/** * Get the modal content. */ function getContent(): HTMLElement;
Kuzcoo/sweetalert2
sweetalert2.d.ts
TypeScript
FunctionDeclaration
/** * Get the image. */ function getImage(): HTMLElement;
Kuzcoo/sweetalert2
sweetalert2.d.ts
TypeScript
FunctionDeclaration
/** * Get the "Confirm" button. */ function getConfirmButton(): HTMLElement;
Kuzcoo/sweetalert2
sweetalert2.d.ts
TypeScript
FunctionDeclaration
/** * Get the "Cancel" button. */ function getCancelButton(): HTMLElement;
Kuzcoo/sweetalert2
sweetalert2.d.ts
TypeScript
FunctionDeclaration
/** * Get the buttons wrapper. */ function getButtonsWrapper(): HTMLElement;
Kuzcoo/sweetalert2
sweetalert2.d.ts
TypeScript
FunctionDeclaration
/** * Get actions (buttons) wrapper. */ function getActions(): HTMLElement;
Kuzcoo/sweetalert2
sweetalert2.d.ts
TypeScript
FunctionDeclaration
/** * Get the modal footer. */ function getFooter(): HTMLElement;
Kuzcoo/sweetalert2
sweetalert2.d.ts
TypeScript
FunctionDeclaration
/** * Enable "Confirm" and "Cancel" buttons. */ function enableButtons(): void;
Kuzcoo/sweetalert2
sweetalert2.d.ts
TypeScript
FunctionDeclaration
/** * Disable "Confirm" and "Cancel" buttons. */ function disableButtons(): void;
Kuzcoo/sweetalert2
sweetalert2.d.ts
TypeScript
FunctionDeclaration
/** * Enable the "Confirm"-button only. */ function enableConfirmButton(): void;
Kuzcoo/sweetalert2
sweetalert2.d.ts
TypeScript
FunctionDeclaration
/** * Disable the "Confirm"-button only. */ function disableConfirmButton(): void;
Kuzcoo/sweetalert2
sweetalert2.d.ts
TypeScript
FunctionDeclaration
/** * Disable buttons and show loader. This is useful with AJAX requests. */ function showLoading(): void;
Kuzcoo/sweetalert2
sweetalert2.d.ts
TypeScript
FunctionDeclaration
/** * Enable buttons and hide loader. */ function hideLoading(): void;
Kuzcoo/sweetalert2
sweetalert2.d.ts
TypeScript
FunctionDeclaration
/** * Determine if modal is in the loading state. */ function isLoading(): boolean;
Kuzcoo/sweetalert2
sweetalert2.d.ts
TypeScript
FunctionDeclaration
/** * Click the "Confirm"-button programmatically. */ function clickConfirm(): void;
Kuzcoo/sweetalert2
sweetalert2.d.ts
TypeScript
FunctionDeclaration
/** * Click the "Cancel"-button programmatically. */ function clickCancel(): void;
Kuzcoo/sweetalert2
sweetalert2.d.ts
TypeScript
FunctionDeclaration
/** * Show validation error message. */ function showValidationError(error: string): void;
Kuzcoo/sweetalert2
sweetalert2.d.ts
TypeScript
FunctionDeclaration
/** * Hide validation error message. */ function resetValidationError(): void;
Kuzcoo/sweetalert2
sweetalert2.d.ts
TypeScript
FunctionDeclaration
/** * Get the input DOM node, this method works with input parameter. */ function getInput(): HTMLElement;
Kuzcoo/sweetalert2
sweetalert2.d.ts
TypeScript
FunctionDeclaration
/** * Disable input. A disabled input element is unusable and un-clickable. */ function disableInput(): void;
Kuzcoo/sweetalert2
sweetalert2.d.ts
TypeScript
FunctionDeclaration
/** * Enable input. */ function enableInput(): void;
Kuzcoo/sweetalert2
sweetalert2.d.ts
TypeScript
FunctionDeclaration
/** * Provide array of SweetAlert2 parameters to show multiple modals, one modal after another. */ function queue(steps: Array<SweetAlertOptions | string>): Promise<any>;
Kuzcoo/sweetalert2
sweetalert2.d.ts
TypeScript
FunctionDeclaration
/** * Get the index of current modal in queue. When there's no active queue, null will be returned. */ function getQueueStep(): string | null;
Kuzcoo/sweetalert2
sweetalert2.d.ts
TypeScript
FunctionDeclaration
/** * Insert a modal to queue, you can specify modal positioning with second parameter. * By default a modal will be added to the end of a queue. */ function insertQueueStep(step: SweetAlertOptions, index?: number): number;
Kuzcoo/sweetalert2
sweetalert2.d.ts
TypeScript
FunctionDeclaration
/** * Delete a modal at index from queue. */ function deleteQueueStep(index: number): void;
Kuzcoo/sweetalert2
sweetalert2.d.ts
TypeScript
FunctionDeclaration
/** * Progress steps getter. */ function getProgressSteps(): string[];
Kuzcoo/sweetalert2
sweetalert2.d.ts
TypeScript
FunctionDeclaration
/** * Progress steps setter. */ function setProgressSteps(steps: string[]): void;
Kuzcoo/sweetalert2
sweetalert2.d.ts
TypeScript
FunctionDeclaration
/** * Show progress steps. */ function showProgressSteps(): void;
Kuzcoo/sweetalert2
sweetalert2.d.ts
TypeScript
FunctionDeclaration
/** * Hide progress steps. */ function hideProgressSteps(): void;
Kuzcoo/sweetalert2
sweetalert2.d.ts
TypeScript
FunctionDeclaration
/** * Determine if parameter name is valid. */ function isValidParameter(paramName: string): boolean;
Kuzcoo/sweetalert2
sweetalert2.d.ts
TypeScript
FunctionDeclaration
/** * An utility function to make SweetAlert rejections silencious (no error in the console when clicking Cancel). * ex. swal(...).catch(swal.noop) */ function noop(): void;
Kuzcoo/sweetalert2
sweetalert2.d.ts
TypeScript
InterfaceDeclaration
export interface SweetAlertResult { value?: any; dismiss?: swal.DismissReason; }
Kuzcoo/sweetalert2
sweetalert2.d.ts
TypeScript
InterfaceDeclaration
/** * These interfaces aren't provided by SweetAlert2, but its definitions use them. * They will be merged with 'true' definitions. */ // tslint:disable:no-empty-interface interface JQuery { }
Kuzcoo/sweetalert2
sweetalert2.d.ts
TypeScript
InterfaceDeclaration
interface Promise<T> { }
Kuzcoo/sweetalert2
sweetalert2.d.ts
TypeScript
InterfaceDeclaration
interface Map<K, V> { }
Kuzcoo/sweetalert2
sweetalert2.d.ts
TypeScript
EnumDeclaration
/** * An enum of possible reasons that can explain an alert dismissal. */ enum DismissReason { cancel, backdrop, close, esc, timer }
Kuzcoo/sweetalert2
sweetalert2.d.ts
TypeScript
TypeAliasDeclaration
export type SweetAlertType = 'success' | 'error' | 'warning' | 'info' | 'question';
Kuzcoo/sweetalert2
sweetalert2.d.ts
TypeScript
TypeAliasDeclaration
type SyncOrAsync<T> = T | Promise<T>;
Kuzcoo/sweetalert2
sweetalert2.d.ts
TypeScript
TypeAliasDeclaration
type ValueOrThunk<T> = T | (() => T);
Kuzcoo/sweetalert2
sweetalert2.d.ts
TypeScript
ArrowFunction
() => this.versionCheckerService.updateVersion()
Bhanditz/echoes-player
src/app/core/effects/app-settings.effects.ts
TypeScript
ArrowFunction
() => this.versionCheckerService.checkForVersion()
Bhanditz/echoes-player
src/app/core/effects/app-settings.effects.ts
TypeScript
ClassDeclaration
@Injectable() export class AppSettingsEffects { constructor( public actions$: Actions, public store: Store<EchoesState>, public versionCheckerService: VersionCheckerService ) { } @Effect({ dispatch: false }) updateAppVersion$ = this.actions$ .ofType(AppLayout.ActionTypes.APP_UPDATE_VERSION) ...
Bhanditz/echoes-player
src/app/core/effects/app-settings.effects.ts
TypeScript
ArrowFunction
id => ( <Timeline.Item key={id}> <code>{id}</code> </Timeline.Item>
Groestlcoin/joule-extension
src/app/components/TransactionInfo/index.tsx
TypeScript
ArrowFunction
state => ({ account: state.account.account, node: state.node.nodeInfo, })
Groestlcoin/joule-extension
src/app/components/TransactionInfo/index.tsx
TypeScript
ClassDeclaration
class TransactionInfo extends React.Component<Props> { componentWillMount() { if (!this.props.account) { this.props.getAccountInfo(); } } render() { const { tx, account, node } = this.props; if (!account) { return null; } const isTestnet = node ? node.testnet : false; co...
Groestlcoin/joule-extension
src/app/components/TransactionInfo/index.tsx
TypeScript
InterfaceDeclaration
interface StateProps { account: AppState['account']['account']; node: AppState['node']['nodeInfo']; }
Groestlcoin/joule-extension
src/app/components/TransactionInfo/index.tsx
TypeScript
InterfaceDeclaration
interface DispatchProps { getAccountInfo: typeof getAccountInfo; }
Groestlcoin/joule-extension
src/app/components/TransactionInfo/index.tsx
TypeScript
InterfaceDeclaration
interface OwnProps { tx: AnyTransaction; }
Groestlcoin/joule-extension
src/app/components/TransactionInfo/index.tsx
TypeScript
TypeAliasDeclaration
type Props = StateProps & DispatchProps & OwnProps;
Groestlcoin/joule-extension
src/app/components/TransactionInfo/index.tsx
TypeScript
MethodDeclaration
componentWillMount() { if (!this.props.account) { this.props.getAccountInfo(); } }
Groestlcoin/joule-extension
src/app/components/TransactionInfo/index.tsx
TypeScript
MethodDeclaration
render() { const { tx, account, node } = this.props; if (!account) { return null; } const isTestnet = node ? node.testnet : false; const chain = node ? node.chains[0] : ''; let to: TransferParty | undefined; let from: TransferParty | undefined; let primaryCode; let pathEl; ...
Groestlcoin/joule-extension
src/app/components/TransactionInfo/index.tsx
TypeScript
MethodDeclaration
makeBlockUrl(tx
Groestlcoin/joule-extension
src/app/components/TransactionInfo/index.tsx
TypeScript
MethodDeclaration
makeTxUrl(tx
Groestlcoin/joule-extension
src/app/components/TransactionInfo/index.tsx
TypeScript
MethodDeclaration
ellipsisSandwich(tx
Groestlcoin/joule-extension
src/app/components/TransactionInfo/index.tsx
TypeScript
ArrowFunction
() => { let mySandBox: sinon.SinonSandbox; let errorSpy: sinon.SinonSpy; let blockchainPackageExplorerProvider: BlockchainPackageExplorerProvider; const rootPath: string = path.dirname(__dirname); const testDir: string = path.join(rootPath, '../../test/data/packageDir'); before(async () => { ...
lehors/blockchain-vscode-extension
client/test/explorer/blockchainPackageExplorer.test.ts
TypeScript
ArrowFunction
async () => { await TestUtil.setupTests(); await TestUtil.storeExtensionDirectoryConfig(); await TestUtil.storeGatewaysConfig(); await TestUtil.storeRuntimesConfig(); }
lehors/blockchain-vscode-extension
client/test/explorer/blockchainPackageExplorer.test.ts
TypeScript
ArrowFunction
async () => { await TestUtil.restoreExtensionDirectoryConfig(); await TestUtil.restoreGatewaysConfig(); await TestUtil.restoreRuntimesConfig(); }
lehors/blockchain-vscode-extension
client/test/explorer/blockchainPackageExplorer.test.ts
TypeScript
ArrowFunction
async () => { mySandBox = sinon.createSandbox(); errorSpy = mySandBox.spy(vscode.window, 'showErrorMessage'); blockchainPackageExplorerProvider = myExtension.getBlockchainPackageExplorerProvider(); }
lehors/blockchain-vscode-extension
client/test/explorer/blockchainPackageExplorer.test.ts
TypeScript
ArrowFunction
async () => { mySandBox.restore(); }
lehors/blockchain-vscode-extension
client/test/explorer/blockchainPackageExplorer.test.ts
TypeScript
ArrowFunction
async () => { await vscode.workspace.getConfiguration().update('blockchain.ext.directory', testDir, true); blockchainPackageExplorerProvider = myExtension.getBlockchainPackageExplorerProvider(); const testPackages: Array<PackageTreeItem> = await blockchainPackageExplorerProvider.getChildren() ...
lehors/blockchain-vscode-extension
client/test/explorer/blockchainPackageExplorer.test.ts
TypeScript
ArrowFunction
async () => { const onDidChangeTreeDataSpy: sinon.SinonSpy = mySandBox.spy(blockchainPackageExplorerProvider['_onDidChangeTreeData'], 'fire'); await vscode.commands.executeCommand(ExtensionCommands.REFRESH_PACKAGES); onDidChangeTreeDataSpy.should.have.been.called; errorSpy.should.not.h...
lehors/blockchain-vscode-extension
client/test/explorer/blockchainPackageExplorer.test.ts
TypeScript
ArrowFunction
async () => { await vscode.workspace.getConfiguration().update('blockchain.ext.directory', testDir, true); const testPackages: Array<PackageTreeItem> = await blockchainPackageExplorerProvider.getChildren() as Array<PackageTreeItem>; const firstTestPackage: PackageTreeItem = blockchainPackageE...
lehors/blockchain-vscode-extension
client/test/explorer/blockchainPackageExplorer.test.ts
TypeScript
ArrowFunction
() => import(/* webpackChunkName: "login" */ '@/pages/Login.vue')
Tosuke/player
src/router/index.ts
TypeScript
ArrowFunction
() => import(/* webpackChunkName: "works" */ '@/pages/Works.vue')
Tosuke/player
src/router/index.ts
TypeScript
ArrowFunction
_ => store.state.user === null ? '/login' : '/works'
Tosuke/player
src/router/index.ts
TypeScript
ClassDeclaration
class App extends Component { componentDidMount() {} componentDidShow() {} componentDidHide() {} componentDidCatchError() {} // this.props.children 是将要会渲染的页面 render() { return ( <QueryClientProvider client={queryClient}> {this.props.children} </QueryClientProvider> ); } }
goldEli/guess-number-rn
src/app.tsx
TypeScript
MethodDeclaration
componentDidMount() {}
goldEli/guess-number-rn
src/app.tsx
TypeScript
MethodDeclaration
componentDidShow() {}
goldEli/guess-number-rn
src/app.tsx
TypeScript
MethodDeclaration
componentDidHide() {}
goldEli/guess-number-rn
src/app.tsx
TypeScript
MethodDeclaration
componentDidCatchError() {}
goldEli/guess-number-rn
src/app.tsx
TypeScript
MethodDeclaration
// this.props.children 是将要会渲染的页面 render() { return ( <QueryClientProvider client={queryClient}> {this.props.children} </QueryClientProvider> ); }
goldEli/guess-number-rn
src/app.tsx
TypeScript
ArrowFunction
data => { this.workers = data.filter((node) => { return node.roles.includes('worker'); }); }
cclauss/KubeOperator
ui/src/app/overview/cluster-status/cluster-status.component.ts
TypeScript
ArrowFunction
(node) => { return node.roles.includes('worker'); }
cclauss/KubeOperator
ui/src/app/overview/cluster-status/cluster-status.component.ts
TypeScript
ArrowFunction
() => { this.redirect('deploy'); }
cclauss/KubeOperator
ui/src/app/overview/cluster-status/cluster-status.component.ts
TypeScript