type
stringclasses
7 values
content
stringlengths
4
9.55k
repo
stringlengths
7
96
path
stringlengths
4
178
language
stringclasses
1 value
InterfaceDeclaration
export interface IContinueLearningDataReq { request: { userId: string | undefined, courseId: string, contentIds: string[], batchId: string | undefined | null fields?: string[] } }
aastarurmika/sunbird-cb-adminportal
project/ws/app/src/lib/head/_services/widget-content.model.ts
TypeScript
InterfaceDeclaration
export interface IContent { platform?: any addedOn: string appIcon: string artifactUrl: string averageRating?: any body?: string certificationList?: IRelatedContentMeta[] certificationStatus?: TCertificationStatus certificationSubmissionDate?: string certificationUrl: string children: IContent[] childrenClassifiers?: string[] clients?: IClient[] collections?: IContent[] complexityLevel: string contentId: string contentType: EContentTypes contentUrlAtSource: string creatorContacts: ICreator[] creatorDetails: ICreator[] creatorLogo: string creatorPosterImage: string creatorThumbnail: string curatedTags: string[] description: string displayContentType: EDisplayContentTypes // For UI downloadUrl?: string duration: number exclusiveContent?: boolean expiryDate?: string equivalentCertifications?: IRelatedContentMeta[] hasAccess: boolean hasAssessment?: string idealScreenSize?: string identifier: string introductoryVideo?: string introductoryVideoIcon?: string learningTrack?: string isExternal: boolean isIframeSupported: 'Yes' | 'No' | 'Maybe' isInIntranet?: boolean keywords?: string[] kArtifacts?: IRelatedContentMeta[] lastUpdatedOn: string learningMode?: TLearningMode learningObjective: string labels?: string[] locale?: string hasTranslations?: { identifier: string; locale: string }[] isTranslationOf?: { identifier: string; locale: string }[] me_totalSessionsCount: number mediaType: string mimeType: EMimeTypes msArtifactDetails?: IMSArtifactDetails mode?: ETagType name: string nextCertificationAttemptDate?: string playgroundInstructions?: string playgroundResources?: IResourcePlayground[] postContents?: IPrePostContent[] posterImage?: string preContents?: IPrePostContent[] preRequisites: string price?: { currency: string value: number } primaryCategory: string, proctorUrl?: string progress?: IMarkAsCompleteProgress publishedOn: string recentCertificationAttemptScore?: number recommendationReasons?: string[] region?: string[] registrationUrl?: string registrationInstructions?: string resourceCategory?: string[] resourceType: string size?: number skills: ISkill[] softwareRequirements?: IResourceDetail[] sourceName: string sourceShortName: string sourceIconUrl?: string sourceUrl?: string ssoEnabled?: boolean status: | 'Draft' | 'Review' | 'InReview' | 'QualityReview' | 'Reviewed' | 'Processing' | 'Live' | 'Deleted' | 'MarkedForDeletion' | 'Expired' subTitle?: string subTitles?: ISubtitle[] studyMaterials?: IRelatedContentMeta[] systemRequirements?: string[] tags: ITag[] topics: IContentTopic[] totalLikes?: { [key: string]: number } totalRating?: number track: ITrack[] uniqueLearners?: number viewCount?: { [key: string]: number } reason?: string // required for Knowledge board trainingLHubCount?: number // for LHub trainings verifiers?: { // required for External Certifications name: string email: string id: string }[] references?: { url: string; title: string }[] resumePage?: number // For player WebModule in UI [key: string]: any }
aastarurmika/sunbird-cb-adminportal
project/ws/app/src/lib/head/_services/widget-content.model.ts
TypeScript
InterfaceDeclaration
export interface IContentResponse { id: string, params: any, responseCode: string, result: { content: IContent }, ts: string, ver: string }
aastarurmika/sunbird-cb-adminportal
project/ws/app/src/lib/head/_services/widget-content.model.ts
TypeScript
InterfaceDeclaration
export interface IBatch { batchId: string, createdBy: string, endDate: string | null, enrollmentType: string, identifier: string, name: string, startDate: string, status: number cert_templates: null collectionId: string courseId: string createdDate: string createdFor: string[] description: null enrollmentEndDate: string | null id: string mentors: string[] | null tandc: null updatedDate: string | null }
aastarurmika/sunbird-cb-adminportal
project/ws/app/src/lib/head/_services/widget-content.model.ts
TypeScript
InterfaceDeclaration
export interface IBatchListResponse { content?: IBatch[] count?: number, enrolled?: boolean, }
aastarurmika/sunbird-cb-adminportal
project/ws/app/src/lib/head/_services/widget-content.model.ts
TypeScript
InterfaceDeclaration
export interface ICourse { active: true addedBy: string batch: IBatch batchId: string certificates: [] collectionId: string completedOn: string | null completionPercentage: number | null content: IContent contentId: string contentStatus: any courseId: string courseLogoUrl: string courseName: string dateTime: number description: string enrolledDate: string issuedCertificates: [] lastReadContentId: string | null lastReadContentStatus: string | null leafNodesCount: number progress: number status: number userId: string }
aastarurmika/sunbird-cb-adminportal
project/ws/app/src/lib/head/_services/widget-content.model.ts
TypeScript
InterfaceDeclaration
export interface IContentMinimal { appIcon: string artifactUrl: string complexityLevel: string contentType: EContentTypes description: string displayContentType?: EDisplayContentTypes duration: number identifier: string hasAccess?: boolean isInIntranet?: boolean learningMode?: TLearningMode mimeType: EMimeTypes name: string creatorDetails: ICreator[] creatorContacts: ICreator[] PosterImage: string resourceType?: string totalRating?: number }
aastarurmika/sunbird-cb-adminportal
project/ws/app/src/lib/head/_services/widget-content.model.ts
TypeScript
InterfaceDeclaration
export interface ICollectionHierarchyResponse { data: IContent hasMore: boolean totalContents: number }
aastarurmika/sunbird-cb-adminportal
project/ws/app/src/lib/head/_services/widget-content.model.ts
TypeScript
InterfaceDeclaration
export interface IRelatedContentMeta { identifier: string name: string }
aastarurmika/sunbird-cb-adminportal
project/ws/app/src/lib/head/_services/widget-content.model.ts
TypeScript
InterfaceDeclaration
interface IMarkAsCompleteProgress { progressStatus: 'open' | 'started' | 'completed' showMarkAsComplete: boolean markAsCompleteReason: string progressSupported: boolean progress: number | null }
aastarurmika/sunbird-cb-adminportal
project/ws/app/src/lib/head/_services/widget-content.model.ts
TypeScript
InterfaceDeclaration
interface ITag { id: string type: string value: string }
aastarurmika/sunbird-cb-adminportal
project/ws/app/src/lib/head/_services/widget-content.model.ts
TypeScript
InterfaceDeclaration
interface IMSArtifactDetails { channelId: string videoId: string }
aastarurmika/sunbird-cb-adminportal
project/ws/app/src/lib/head/_services/widget-content.model.ts
TypeScript
InterfaceDeclaration
interface IClient { displayName: string id: string name: string }
aastarurmika/sunbird-cb-adminportal
project/ws/app/src/lib/head/_services/widget-content.model.ts
TypeScript
InterfaceDeclaration
interface ISubtitle { srclang: string label: string url: string }
aastarurmika/sunbird-cb-adminportal
project/ws/app/src/lib/head/_services/widget-content.model.ts
TypeScript
InterfaceDeclaration
interface IPrePostContent { identifier: string name: string }
aastarurmika/sunbird-cb-adminportal
project/ws/app/src/lib/head/_services/widget-content.model.ts
TypeScript
InterfaceDeclaration
interface IResourceDetail { title?: string url?: string }
aastarurmika/sunbird-cb-adminportal
project/ws/app/src/lib/head/_services/widget-content.model.ts
TypeScript
InterfaceDeclaration
interface IResourcePlayground { appIcon: string artifactUrl: string identifier: string name: string }
aastarurmika/sunbird-cb-adminportal
project/ws/app/src/lib/head/_services/widget-content.model.ts
TypeScript
InterfaceDeclaration
interface ITrack { id: string name: string status: string visibility: string }
aastarurmika/sunbird-cb-adminportal
project/ws/app/src/lib/head/_services/widget-content.model.ts
TypeScript
InterfaceDeclaration
interface ISkill { id: string category: string skill: string name: string }
aastarurmika/sunbird-cb-adminportal
project/ws/app/src/lib/head/_services/widget-content.model.ts
TypeScript
InterfaceDeclaration
export interface ICreator { id: string name: string email: string }
aastarurmika/sunbird-cb-adminportal
project/ws/app/src/lib/head/_services/widget-content.model.ts
TypeScript
InterfaceDeclaration
export interface IContentTopic { identifier: string name: string }
aastarurmika/sunbird-cb-adminportal
project/ws/app/src/lib/head/_services/widget-content.model.ts
TypeScript
InterfaceDeclaration
// API Based export interface IContact { id: string name: string email: string }
aastarurmika/sunbird-cb-adminportal
project/ws/app/src/lib/head/_services/widget-content.model.ts
TypeScript
InterfaceDeclaration
export interface IViewerContinueLearningRequest { resourceId: string contextPathId: string data: string dateAccessed: number contextType?: string }
aastarurmika/sunbird-cb-adminportal
project/ws/app/src/lib/head/_services/widget-content.model.ts
TypeScript
EnumDeclaration
export enum EContentTypes { PROGRAM = 'Learning Path', CHANNEL = 'Channel', COURSE = 'Course', KNOWLEDGE_ARTIFACT = 'Knowledge Artifact', KNOWLEDGE_BOARD = 'Knowledge Board', LEARNING_JOURNEY = 'Learning Journeys', MODULE = 'Collection', RESOURCE = 'Resource', }
aastarurmika/sunbird-cb-adminportal
project/ws/app/src/lib/head/_services/widget-content.model.ts
TypeScript
EnumDeclaration
export enum EResourcePrimaryCategories { LEARNING_RESOURCE = 'Learning Resource', }
aastarurmika/sunbird-cb-adminportal
project/ws/app/src/lib/head/_services/widget-content.model.ts
TypeScript
EnumDeclaration
export enum EMiscPlayerSupportedCollectionTypes { PLAYLIST = 'Playlist', }
aastarurmika/sunbird-cb-adminportal
project/ws/app/src/lib/head/_services/widget-content.model.ts
TypeScript
EnumDeclaration
export enum EMimeTypes { COLLECTION = 'application/vnd.ekstep.content-collection', HTML = 'application/html', HTML_TEXT = 'text/html', ILP_FP = 'application/ilpfp', IAP = 'application/iap-assessment', M4A = 'audio/m4a', MP3 = 'audio/mpeg', MP4 = 'video/mp4', M3U8 = 'application/x-mpegURL', INTERACTION = 'video/interactive', PDF = 'application/pdf', QUIZ = 'application/quiz', DRAG_DROP = 'application/drag-drop', HTML_PICKER = 'application/htmlpicker', WEB_MODULE = 'application/web-module', WEB_MODULE_EXERCISE = 'application/web-module-exercise', YOUTUBE = 'video/x-youtube', HANDS_ON = 'application/integrated-hands-on', RDBMS_HANDS_ON = 'application/rdbms', CLASS_DIAGRAM = 'application/class-diagram', CHANNEL = 'application/channel', COLLECTION_RESOURCE = 'resource/collection', // Added on UI Only CERTIFICATION = 'application/certification', PLAYLIST = 'application/playlist', UNKNOWN = 'application/unknown', }
aastarurmika/sunbird-cb-adminportal
project/ws/app/src/lib/head/_services/widget-content.model.ts
TypeScript
EnumDeclaration
export enum EDisplayContentTypes { ASSESSMENT = 'ASSESSMENT', AUDIO = 'AUDIO', CERTIFICATION = 'CERTIFICATION', CHANNEL = 'Channel', CLASS_DIAGRAM = 'CLASS_DIAGRAM', COURSE = 'COURSE', DEFAULT = 'DEFAULT', DRAG_DROP = 'DRAG_DROP', EXTERNAL_CERTIFICATION = 'EXTERNAL_CERTIFICATION', EXTERNAL_COURSE = 'EXTERNAL_COURSE', GOALS = 'GOALS', HANDS_ON = 'HANDS_ON', IAP = 'IAP', INSTRUCTOR_LED = 'INSTRUCTOR_LED', INTERACTIVE_VIDEO = 'INTERACTIVE_VIDEO', KNOWLEDGE_ARTIFACT = 'KNOWLEDGE_ARTIFACT', MODULE = 'MODULE', PDF = 'PDF', PLAYLIST = 'PLAYLIST', PROGRAM = 'PROGRAM', QUIZ = 'QUIZ', RESOURCE = 'RESOURCE', RDBMS_HANDS_ON = 'RDBMS_HANDS_ON', VIDEO = 'VIDEO', WEB_MODULE = 'WEB_MODULE', WEB_PAGE = 'WEB_PAGE', YOUTUBE = 'YOUTUBE', KNOWLEDGE_BOARD = 'Knowledge Board', LEARNING_JOURNEY = 'Learning Journeys', }
aastarurmika/sunbird-cb-adminportal
project/ws/app/src/lib/head/_services/widget-content.model.ts
TypeScript
EnumDeclaration
// for UI export enum EFilterCategory { ALL = 'ALL', LEARN = 'LEARN', PRACTICE = 'PRACTICE', ASSESS = 'ASSESS', }
aastarurmika/sunbird-cb-adminportal
project/ws/app/src/lib/head/_services/widget-content.model.ts
TypeScript
EnumDeclaration
// for UI export enum ETagType { NEWLY_ADDED = 'NEWLY ADDED', }
aastarurmika/sunbird-cb-adminportal
project/ws/app/src/lib/head/_services/widget-content.model.ts
TypeScript
TypeAliasDeclaration
type TCertificationStatus = 'ongoing' | 'passed' | 'canAttempt' | 'cannotAttempt'
aastarurmika/sunbird-cb-adminportal
project/ws/app/src/lib/head/_services/widget-content.model.ts
TypeScript
TypeAliasDeclaration
export type TLearningMode = 'Self-Paced' | 'Instructor-Led' | 'Open' | 'Closed'
aastarurmika/sunbird-cb-adminportal
project/ws/app/src/lib/head/_services/widget-content.model.ts
TypeScript
ArrowFunction
async (method: string, params: any): Promise<any> => { try { const uri = `${CHAT_API_URL}/${method}?token=${CHAT_API_TOKEN}`; const jsonResponse = await rp({ uri, method: 'POST', headers: { 'Content-Type': 'application/json' }, body: params, json: true, }); return jsonResponse; } catch (err) { logger.error(`apiChatApi error: ${err.message}`); } }
Shtokarev/NodeBackend
src/modules/chatApi/chatBot.ts
TypeScript
ArrowFunction
async (message: WhatsAppMessage): Promise<void> => { const { body, chatId } = message; try { const matchResult = body.match(imgRegex); if (matchResult) { const url = matchResult[0]; const upload = await uploadImage2S3Bucket(url); if (upload.success) { await apiChatApi('sendMessage', { chatId, body: 'uploaded' }); const moderationStr = await getAwsModerationLabels(upload.uri).catch(err => err); const body = moderationStr ? `AWS Recogngition: ${moderationStr}` : 'AWS Recogngition: pass'; await apiChatApi('sendMessage', { chatId, body }); } else { await apiChatApi('sendMessage', { chatId, body: upload.error?.message }); } } } catch (error) { logger.error(`botWorker error: ${error.message}`); await apiChatApi('sendMessage', { chatId, body: error.message }); } }
Shtokarev/NodeBackend
src/modules/chatApi/chatBot.ts
TypeScript
ArrowFunction
err => err
Shtokarev/NodeBackend
src/modules/chatApi/chatBot.ts
TypeScript
InterfaceDeclaration
export interface WhatsAppMessage { author: string; body: string; chatId: string; senderName: string; fromMe: boolean; }
Shtokarev/NodeBackend
src/modules/chatApi/chatBot.ts
TypeScript
FunctionDeclaration
export function sortRequests<T>(requests: Request<T>[]): Request<T>[] { // In order to keep consistency between runs, requests are sorted by the following criteria: // // 1. Block number (ascending) // 2. Transaction hash (ascending) return orderBy(requests, ['metadata.blockNumber', 'metadata.transactionHash']); }
aquarat/airnode
packages/airnode-node/src/requests/sorting.ts
TypeScript
FunctionDeclaration
export function sortGroupedRequests(requests: GroupedRequests): GroupedRequests { return { apiCalls: sortRequests(requests.apiCalls), withdrawals: sortRequests(requests.withdrawals), }; }
aquarat/airnode
packages/airnode-node/src/requests/sorting.ts
TypeScript
ClassDeclaration
class CreateUserService { public async execute({ name, email, password }: RequestDTO): Promise<User> { const userRepository = getRepository(User); const userExists = await userRepository.findOne({ where: { email }, }); if (userExists) { throw new Error(`Email "${email}" already used`); } const hashedPassword = await hash(password, 8); const user = userRepository.create({ name, email, password: hashedPassword, }); await userRepository.save(user); return user; } }
varejaodfav/gobarber
src/services/users/CreateUserService.ts
TypeScript
InterfaceDeclaration
interface RequestDTO { name: string; email: string; password: string; }
varejaodfav/gobarber
src/services/users/CreateUserService.ts
TypeScript
MethodDeclaration
public async execute({ name, email, password }: RequestDTO): Promise<User> { const userRepository = getRepository(User); const userExists = await userRepository.findOne({ where: { email }, }); if (userExists) { throw new Error(`Email "${email}" already used`); } const hashedPassword = await hash(password, 8); const user = userRepository.create({ name, email, password: hashedPassword, }); await userRepository.save(user); return user; }
varejaodfav/gobarber
src/services/users/CreateUserService.ts
TypeScript
ArrowFunction
() => ( <svg className="a-svg-icon a-svg-icon--bold"
futurelearn/markdown-editor
src/Icons/Bold.tsx
TypeScript
InterfaceDeclaration
export interface BinanceArticle { title: string releaseDate: number // ... other non relevant fields }
colxi/crypto-announcements-observer
src/bot/data-sources/binance-zh/types.ts
TypeScript
InterfaceDeclaration
export interface BinanceResponse { data: { catalogs: [ { articles: BinanceArticle[] } ] } // ... other non relevant fields }
colxi/crypto-announcements-observer
src/bot/data-sources/binance-zh/types.ts
TypeScript
ArrowFunction
contractName => { return snapshotAddresses[contractName]; }
SetProtocol/set-protocol-oracles
utils/snapshotUtils.ts
TypeScript
ArrowFunction
() => { let component: EditShotsFormComponent; let fixture: ComponentFixture<EditShotsFormComponent>; beforeEach(async(() => { TestBed.configureTestingModule({ declarations: [ EditShotsFormComponent ] }) .compileComponents(); })); beforeEach(() => { fixture = TestBed.createComponent(EditShotsFormComponent); component = fixture.componentInstance; fixture.detectChanges(); }); it('should create', () => { expect(component).toBeTruthy(); }); }
sakmanal/ArmyUnit-HR-App
src/app/memberfile/edit/edit-shots-form/edit-shots-form.component.spec.ts
TypeScript
ArrowFunction
() => { TestBed.configureTestingModule({ declarations: [ EditShotsFormComponent ] }) .compileComponents(); }
sakmanal/ArmyUnit-HR-App
src/app/memberfile/edit/edit-shots-form/edit-shots-form.component.spec.ts
TypeScript
ArrowFunction
() => { fixture = TestBed.createComponent(EditShotsFormComponent); component = fixture.componentInstance; fixture.detectChanges(); }
sakmanal/ArmyUnit-HR-App
src/app/memberfile/edit/edit-shots-form/edit-shots-form.component.spec.ts
TypeScript
ArrowFunction
(r: MessageReaction) => r.emoji.name == EmojiConstants.PIN
Sheepolution/pin-it-bot
code/src/Handlers/PinHandler.ts
TypeScript
ArrowFunction
(a, b) => { return a.createdTimestamp - b.createdTimestamp; }
Sheepolution/pin-it-bot
code/src/Handlers/PinHandler.ts
TypeScript
ArrowFunction
(a, b) => { return b.createdTimestamp - a.createdTimestamp; }
Sheepolution/pin-it-bot
code/src/Handlers/PinHandler.ts
TypeScript
ClassDeclaration
export default class PinHandler { public static async OnReaction(obj: any, reaction: MessageReaction) { if (reaction.emoji.name == EmojiConstants.PIN) { if (!await DiscordService.CheckPermission(obj.messageInfo, 'MANAGE_MESSAGES', 'unpin your message', false)) { return; } obj.messageInfo.message.reactions.cache.find((r: MessageReaction) => r.emoji.name == EmojiConstants.PIN).remove(); await PinHandler.PinMessage(obj.messageInfo, obj.values.guild); } } public static async AddPinReaction(messageInfo: IMessageInfo, guild: Guild) { if (!await DiscordService.CheckPermission(messageInfo, 'ADD_REACTIONS')) { return; } if (messageInfo.message == null) { return; } messageInfo?.message.react(EmojiConstants.PIN); ReactionManager.AddMessage(messageInfo?.message, PinHandler.OnReaction, messageInfo, { guild: guild }, 1); } public static async PinMessage(messageInfo: IMessageInfo, guild: Guild) { if (!await DiscordService.CheckPermission(messageInfo, 'MANAGE_MESSAGES', 'pin your message')) { return; } const pinned = await (<TextChannel>messageInfo.channel).messages.fetchPinned(true); const pinnedArray = pinned.array(); if (pinnedArray.length >= SettingsConstants.MAX_PINS) { pinnedArray.sort((a, b) => { return a.createdTimestamp - b.createdTimestamp; }); await pinnedArray[0].unpin(); } await Utils.Sleep(1); await messageInfo.message?.pin(); LogService.Log(LogType.MessagePinned, guild); } public static OnCommand(messageInfo: IMessageInfo, guild: Guild) { const commands = CommandConstants.COMMANDS; switch (messageInfo.commandInfo.commands) { case commands.UNPIN: this.OnUnpin(messageInfo, guild); break; default: return false; } return true; } private static async OnUnpin(messageInfo: IMessageInfo, guild: Guild) { if (!await DiscordService.CheckPermission(messageInfo, 'MANAGE_MESSAGES', 'unpin your message')) { return; } const pinned = await (<TextChannel>messageInfo.channel).messages.fetchPinned(true); const pinnedArray = pinned.array(); if (pinnedArray.length > 0) { pinnedArray.sort((a, b) => { return b.createdTimestamp - a.createdTimestamp; }); for (const message of pinnedArray) { if (message.author.id == messageInfo.user.id) { message.unpin(); messageInfo.message.react(EmojiConstants.STATUS.GOOD).catch(); LogService.Log(LogType.MessageUnpinned, guild); return; } } messageInfo.message.react(EmojiConstants.STATUS.BAD).catch(); } CommandManager.SetCooldown(messageInfo, 10); } }
Sheepolution/pin-it-bot
code/src/Handlers/PinHandler.ts
TypeScript
MethodDeclaration
public static async OnReaction(obj: any, reaction: MessageReaction) { if (reaction.emoji.name == EmojiConstants.PIN) { if (!await DiscordService.CheckPermission(obj.messageInfo, 'MANAGE_MESSAGES', 'unpin your message', false)) { return; } obj.messageInfo.message.reactions.cache.find((r: MessageReaction) => r.emoji.name == EmojiConstants.PIN).remove(); await PinHandler.PinMessage(obj.messageInfo, obj.values.guild); } }
Sheepolution/pin-it-bot
code/src/Handlers/PinHandler.ts
TypeScript
MethodDeclaration
public static async AddPinReaction(messageInfo: IMessageInfo, guild: Guild) { if (!await DiscordService.CheckPermission(messageInfo, 'ADD_REACTIONS')) { return; } if (messageInfo.message == null) { return; } messageInfo?.message.react(EmojiConstants.PIN); ReactionManager.AddMessage(messageInfo?.message, PinHandler.OnReaction, messageInfo, { guild: guild }, 1); }
Sheepolution/pin-it-bot
code/src/Handlers/PinHandler.ts
TypeScript
MethodDeclaration
public static async PinMessage(messageInfo: IMessageInfo, guild: Guild) { if (!await DiscordService.CheckPermission(messageInfo, 'MANAGE_MESSAGES', 'pin your message')) { return; } const pinned = await (<TextChannel>messageInfo.channel).messages.fetchPinned(true); const pinnedArray = pinned.array(); if (pinnedArray.length >= SettingsConstants.MAX_PINS) { pinnedArray.sort((a, b) => { return a.createdTimestamp - b.createdTimestamp; }); await pinnedArray[0].unpin(); } await Utils.Sleep(1); await messageInfo.message?.pin(); LogService.Log(LogType.MessagePinned, guild); }
Sheepolution/pin-it-bot
code/src/Handlers/PinHandler.ts
TypeScript
MethodDeclaration
public static OnCommand(messageInfo: IMessageInfo, guild: Guild) { const commands = CommandConstants.COMMANDS; switch (messageInfo.commandInfo.commands) { case commands.UNPIN: this.OnUnpin(messageInfo, guild); break; default: return false; } return true; }
Sheepolution/pin-it-bot
code/src/Handlers/PinHandler.ts
TypeScript
MethodDeclaration
private static async OnUnpin(messageInfo: IMessageInfo, guild: Guild) { if (!await DiscordService.CheckPermission(messageInfo, 'MANAGE_MESSAGES', 'unpin your message')) { return; } const pinned = await (<TextChannel>messageInfo.channel).messages.fetchPinned(true); const pinnedArray = pinned.array(); if (pinnedArray.length > 0) { pinnedArray.sort((a, b) => { return b.createdTimestamp - a.createdTimestamp; }); for (const message of pinnedArray) { if (message.author.id == messageInfo.user.id) { message.unpin(); messageInfo.message.react(EmojiConstants.STATUS.GOOD).catch(); LogService.Log(LogType.MessageUnpinned, guild); return; } } messageInfo.message.react(EmojiConstants.STATUS.BAD).catch(); } CommandManager.SetCooldown(messageInfo, 10); }
Sheepolution/pin-it-bot
code/src/Handlers/PinHandler.ts
TypeScript
FunctionDeclaration
/** * Main function which calls the methods and refreshes the blockchain explorer box each time that it runs succesfully. * This will be used in other files to call the command to package a smart contract project. */ export async function packageSmartContract(workspace?: vscode.WorkspaceFolder, overrideName?: string, overrideVersion?: string): Promise<PackageRegistryEntry> { const outputAdapter: VSCodeBlockchainOutputAdapter = VSCodeBlockchainOutputAdapter.instance(); outputAdapter.log(LogType.INFO, undefined, 'packageSmartContract'); let resolvedPkgDir: string; let properties: { workspacePackageName: string, workspacePackageVersion: string }; let language: ChaincodeType; try { // Determine the directory that will contain the packages and ensure it exists. const extDir: string = vscode.workspace.getConfiguration().get(SettingConfigurations.EXTENSION_DIRECTORY); const pkgDir: string = path.join(extDir, 'packages'); resolvedPkgDir = UserInputUtil.getDirPath(pkgDir); await fs.ensureDir(resolvedPkgDir); // Choose the workspace directory. if (!workspace) { workspace = await chooseWorkspace(); if (!workspace) { // User cancelled. return; } } checkForProjectErrors(workspace); // Build the workspace. await buildWorkspace(workspace); // Determine the language. language = await getLanguage(workspace); // Determine the package name and version. if (language === 'golang') { properties = await golangPackageAndVersion(overrideName, overrideVersion); } else if (language === 'java') { properties = await javaPackageAndVersion(overrideName, overrideVersion); } else { properties = await packageJsonNameAndVersion(workspace, overrideName, overrideVersion); } if (!properties) { // User cancelled. return; } } catch (err) { outputAdapter.log(LogType.ERROR, err.message, err.toString()); return; } return vscode.window.withProgress({ location: vscode.ProgressLocation.Notification, title: 'IBM Blockchain Platform Extension', cancellable: false }, async (progress: vscode.Progress<{ message: string }>) => { progress.report({ message: `Packaging Smart Contract` }); try { // Determine the filename of the new package. const pkgFile: string = path.join(resolvedPkgDir, `${properties.workspacePackageName}@${properties.workspacePackageVersion}.cds`); const pkgFileExists: boolean = await fs.pathExists(pkgFile); if (pkgFileExists) { if (language === 'golang') { throw new Error('Package with name and version already exists. Please input a different name or version for your Go project.'); } else if (language === 'java') { throw new Error('Package with name and version already exists. Please input a different name or version for your Java project.'); } else { throw new Error('Package with name and version already exists. Please change the name and/or the version of the project in your package.json file.'); } } // Determine the path argument. let pkgPath: string = workspace.uri.fsPath; if (language === 'golang') { if (!process.env.GOPATH) { // The path is relative to $GOPATH/src for Go smart contracts. const srcPath: string = path.join(pkgPath, '..', '..', 'src'); pkgPath = path.basename(pkgPath); const exists: boolean = await fs.pathExists(srcPath); if (!exists) { // Project path is not under GOPATH. throw new Error('The enviroment variable GOPATH has not been set, and the extension was not able to automatically detect the correct value. You cannot package a Go smart contract without setting the environment variable GOPATH.'); } else { process.env.GOPATH = path.join(srcPath, '..'); } } else { // The path is relative to $GOPATH/src for Go smart contracts. const srcPath: string = path.join(process.env.GOPATH, 'src'); pkgPath = path.relative(srcPath, pkgPath); if (!pkgPath || pkgPath.startsWith('..') || path.isAbsolute(pkgPath)) { // Project path is not under GOPATH. throw new Error('The Go smart contract is not a subdirectory of the path specified by the environment variable GOPATH. Please correct the environment variable GOPATH.'); } } } // Determine if there is a metadata path. const metadataPath: string = path.join(workspace.uri.fsPath, 'META-INF'); const metadataPathExists: boolean = await fs.pathExists(metadataPath); // Create the package. Need to dynamically load the package class // from the Fabric SDK to avoid early native module loading. const { Package } = await import('fabric-client'); const pkg: any = await Package.fromDirectory({ name: properties.workspacePackageName, version: properties.workspacePackageVersion, path: pkgPath, type: language, metadataPath: metadataPathExists ? metadataPath : null }); const pkgBuffer: any = await pkg.toBuffer(); await fs.writeFile(pkgFile, pkgBuffer); Reporter.instance().sendTelemetryEvent('packageCommand'); await vscode.commands.executeCommand(ExtensionCommands.REFRESH_PACKAGES); outputAdapter.log(LogType.SUCCESS, `Smart Contract packaged: ${pkgFile}`); const fileNames: string[] = pkg.fileNames; outputAdapter.log(LogType.INFO, undefined, `${fileNames.length} file(s) packaged:`); for (const file of fileNames) { outputAdapter.log(LogType.INFO, undefined, `- ${file}`); } const packageEntry: PackageRegistryEntry = new PackageRegistryEntry(); packageEntry.name = properties.workspacePackageName; packageEntry.version = properties.workspacePackageVersion; packageEntry.path = pkgFile; return packageEntry; } catch (err) { outputAdapter.log(LogType.ERROR, err.message, err.toString()); return; } }); }
kant/blockchain-vscode-extension
client/src/commands/packageSmartContractCommand.ts
TypeScript
FunctionDeclaration
/** * Method to determine if there are multiple smart contracts within the active workspace. If so, it will provide a quick pick box * to have the developer choose which smart contract he wishes to package and get its path. If not, it will automatically get the path of the only smart contract project there is. * @returns Returns the path of the workspace to be used in packaging process. */ async function chooseWorkspace(): Promise<vscode.WorkspaceFolder> { let workspaceFolderOptions: Array<vscode.WorkspaceFolder>; let workspaceFolder: vscode.WorkspaceFolder; workspaceFolderOptions = await UserInputUtil.getWorkspaceFolders(); if (workspaceFolderOptions.length === 0) { const message: string = `Issue determining available smart contracts. Please open the smart contract you want to be packaged.`; throw new Error(message); } if (workspaceFolderOptions.length > 1) { const chosenFolder: IBlockchainQuickPickItem<vscode.WorkspaceFolder> = await UserInputUtil.showWorkspaceQuickPickBox('Choose a workspace folder to package'); if (!chosenFolder) { return; } workspaceFolder = chosenFolder.data; } else { workspaceFolder = workspaceFolderOptions[0]; } return workspaceFolder; }
kant/blockchain-vscode-extension
client/src/commands/packageSmartContractCommand.ts
TypeScript
FunctionDeclaration
/** * Method to determine the language used in the development of the smart contract project, which will be used to determine the correct directories * to package the projects. * @param workspaceDir {String} workspaceDir A string containing the path to the current active workspace (the workspace of the project the user is packaging). * @returns {string} The language used in the development of this smart contract project. Used to package in the correct respective directory. */ async function getLanguage(workspaceDir: vscode.WorkspaceFolder): Promise<ChaincodeType> { // Is this a Node.js smart contract (JavaScript, TypeScript, etc)? const packageJsonFile: string = path.join(workspaceDir.uri.fsPath, 'package.json'); const packageJsonFileExists: boolean = await fs.pathExists(packageJsonFile); if (packageJsonFileExists) { return 'node'; } // Is this a Java smart contract (Java, Kotlin, etc)? const gradleFile: string = path.join(workspaceDir.uri.fsPath, 'build.gradle'); const gradleFileExists: boolean = await fs.pathExists(gradleFile); const mavenFile: string = path.join(workspaceDir.uri.fsPath, 'pom.xml'); const mavenFileExists: boolean = await fs.pathExists(mavenFile); if (gradleFileExists || mavenFileExists) { return 'java'; } // Is this a Go smart contract? const goFiles: vscode.Uri[] = await vscode.workspace.findFiles( new vscode.RelativePattern(workspaceDir, '**/*.go'), null, 1 ); if (goFiles.length > 0) { return 'golang'; } // Its not java/node/go contract, so error const message: string = `Failed to determine workspace language type, supported languages are JavaScript, TypeScript, Go and Java. Please ensure your contract's root-level directory is open in the Explorer.`; throw new Error(message); }
kant/blockchain-vscode-extension
client/src/commands/packageSmartContractCommand.ts
TypeScript
FunctionDeclaration
/** * Method to retrieve the package name and version from the projects package.json file, and returns them to be used in the getFinalDirectory() method. * @param workspaceDir {String} workspaceDir A string containing the path to the current active workspace (the workspace of the project the user is packaging). * @returns {string, string}An object with the workspacePackageName and workspacePackageVersion which will be used in the createPackageDir() method. */ async function packageJsonNameAndVersion(workspaceDir: vscode.WorkspaceFolder, overrideName?: string, overrideVersion?: string): Promise<{ workspacePackageName: string, workspacePackageVersion: string }> { const workspacePackage: string = path.join(workspaceDir.uri.fsPath, '/package.json'); const workspacePackageContents: Buffer = await fs.readFile(workspacePackage); const workspacePackageObj: any = JSON.parse(workspacePackageContents.toString('utf8')); let workspacePackageName: string = workspacePackageObj.name; let workspacePackageVersion: string = workspacePackageObj.version; if (overrideName) { workspacePackageName = overrideName; } if (overrideVersion) { workspacePackageVersion = overrideVersion; } if (!workspacePackageName || !workspacePackageVersion) { const message: string = 'Please enter a package name and/or package version into your package.json'; throw new Error(message); } return { workspacePackageName, workspacePackageVersion }; }
kant/blockchain-vscode-extension
client/src/commands/packageSmartContractCommand.ts
TypeScript
FunctionDeclaration
/** * Method which calls an input box should the project be coded in java, which asks the user for a package name and version * (as java projects do not contain a package.json file), and returns an object containing both these values. * @returns {string, string} Returns an object with the workspacePackageName and workspacePackageVersion which will be used in the createPackageDir() method */ async function javaPackageAndVersion(overrideName?: string, overrideVersion?: string): Promise<{ workspacePackageName: string, workspacePackageVersion: string }> { let workspacePackageName: string = overrideName; if (!workspacePackageName) { workspacePackageName = await UserInputUtil.showInputBox('Enter a name for your Java package'); // Getting the specified name and package from the user if (!workspacePackageName) { // User has cancelled the input box return; } } let workspacePackageVersion: string = overrideVersion; if (!workspacePackageVersion) { workspacePackageVersion = await UserInputUtil.showInputBox('Enter a version for your Java package'); // Getting the specified name and package from the user if (!workspacePackageVersion) { // User has cancelled the input box return; } } return { workspacePackageName, workspacePackageVersion }; }
kant/blockchain-vscode-extension
client/src/commands/packageSmartContractCommand.ts
TypeScript
FunctionDeclaration
/** * Method which calls an input box should the project be coded in golang, which asks the user for a package name and version * (as golang projects do not contain a package.json file), and returns an object containing both these values. * @returns {string, string} Returns an object with the workspacePackageName and workspacePackageVersion which will be used in the createPackageDir() method */ async function golangPackageAndVersion(overrideName?: string, overrideVersion?: string): Promise<{ workspacePackageName: string, workspacePackageVersion: string }> { let workspacePackageName: string = overrideName; if (!workspacePackageName) { workspacePackageName = await UserInputUtil.showInputBox('Enter a name for your Go package'); // Getting the specified name and package from the user if (!workspacePackageName) { // User has cancelled the input box return; } } let workspacePackageVersion: string = overrideVersion; if (!workspacePackageVersion) { workspacePackageVersion = await UserInputUtil.showInputBox('Enter a version for your Go package'); // Getting the specified name and package from the user if (!workspacePackageVersion) { // User has cancelled the input box return; } } return { workspacePackageName, workspacePackageVersion }; }
kant/blockchain-vscode-extension
client/src/commands/packageSmartContractCommand.ts
TypeScript
FunctionDeclaration
function checkForProjectErrors(workspaceDir: vscode.WorkspaceFolder): void { const collections: [vscode.Uri, vscode.Diagnostic[]][] = vscode.languages.getDiagnostics(); for (const collection of collections) { for (const thing of collection) { if (thing instanceof vscode.Uri) { const uri: vscode.Uri = thing as vscode.Uri; const relativePath: string = path.relative(workspaceDir.uri.fsPath, uri.fsPath); if (!relativePath || relativePath.startsWith('..') || path.isAbsolute(relativePath)) { // not in this project must have another project open in the workspace break; } } else { const diagnostics: vscode.Diagnostic[] = thing as vscode.Diagnostic[]; for (const diagnostic of diagnostics) { // only check for errors if (diagnostic.severity === 0) { throw new Error('Smart contract project has errors please fix them before packaging'); } } } } } }
kant/blockchain-vscode-extension
client/src/commands/packageSmartContractCommand.ts
TypeScript
FunctionDeclaration
async function buildWorkspace(workspaceDir: vscode.WorkspaceFolder): Promise<void> { // Find all of the tasks. const tasks: vscode.Task[] = await vscode.tasks.fetchTasks(); // Then limit the tasks to build tasks that we can actually use. const buildTasks: vscode.Task[] = tasks.filter((task: vscode.Task) => { if (!task.scope || task.scope === vscode.TaskScope.Global || task.scope === vscode.TaskScope.Workspace) { // We don't want unscoped tasks, global tasks, or workspace tasks. return false; } else if (task.scope.uri.fsPath !== workspaceDir.uri.fsPath) { // We only want tasks for our smart contract project. return false; } else if (task.group !== vscode.TaskGroup.Build) { // We only want build tasks. return false; } else if (task.isBackground) { // We only want foreground tasks (not "npm watch"). return false; } else if (task.name.match(/watch/i)) { // We don't want anything with "watch" in the name! return false; } else { return true; } }); // If we have a set of build tasks, then execute the first one. if (buildTasks.length > 0) { const buildTask: vscode.Task = buildTasks[0]; const buildTaskExecution: vscode.TaskExecution = await vscode.tasks.executeTask(buildTask); await new Promise((resolve: any): any => { const buildTaskListener: vscode.Disposable = vscode.tasks.onDidEndTask((e: vscode.TaskEndEvent) => { if (e.execution === buildTaskExecution) { buildTaskListener.dispose(); resolve(); } }); }); } }
kant/blockchain-vscode-extension
client/src/commands/packageSmartContractCommand.ts
TypeScript
ArrowFunction
async (progress: vscode.Progress<{ message: string }>) => { progress.report({ message: `Packaging Smart Contract` }); try { // Determine the filename of the new package. const pkgFile: string = path.join(resolvedPkgDir, `${properties.workspacePackageName}@${properties.workspacePackageVersion}.cds`); const pkgFileExists: boolean = await fs.pathExists(pkgFile); if (pkgFileExists) { if (language === 'golang') { throw new Error('Package with name and version already exists. Please input a different name or version for your Go project.'); } else if (language === 'java') { throw new Error('Package with name and version already exists. Please input a different name or version for your Java project.'); } else { throw new Error('Package with name and version already exists. Please change the name and/or the version of the project in your package.json file.'); } } // Determine the path argument. let pkgPath: string = workspace.uri.fsPath; if (language === 'golang') { if (!process.env.GOPATH) { // The path is relative to $GOPATH/src for Go smart contracts. const srcPath: string = path.join(pkgPath, '..', '..', 'src'); pkgPath = path.basename(pkgPath); const exists: boolean = await fs.pathExists(srcPath); if (!exists) { // Project path is not under GOPATH. throw new Error('The enviroment variable GOPATH has not been set, and the extension was not able to automatically detect the correct value. You cannot package a Go smart contract without setting the environment variable GOPATH.'); } else { process.env.GOPATH = path.join(srcPath, '..'); } } else { // The path is relative to $GOPATH/src for Go smart contracts. const srcPath: string = path.join(process.env.GOPATH, 'src'); pkgPath = path.relative(srcPath, pkgPath); if (!pkgPath || pkgPath.startsWith('..') || path.isAbsolute(pkgPath)) { // Project path is not under GOPATH. throw new Error('The Go smart contract is not a subdirectory of the path specified by the environment variable GOPATH. Please correct the environment variable GOPATH.'); } } } // Determine if there is a metadata path. const metadataPath: string = path.join(workspace.uri.fsPath, 'META-INF'); const metadataPathExists: boolean = await fs.pathExists(metadataPath); // Create the package. Need to dynamically load the package class // from the Fabric SDK to avoid early native module loading. const { Package } = await import('fabric-client'); const pkg: any = await Package.fromDirectory({ name: properties.workspacePackageName, version: properties.workspacePackageVersion, path: pkgPath, type: language, metadataPath: metadataPathExists ? metadataPath : null }); const pkgBuffer: any = await pkg.toBuffer(); await fs.writeFile(pkgFile, pkgBuffer); Reporter.instance().sendTelemetryEvent('packageCommand'); await vscode.commands.executeCommand(ExtensionCommands.REFRESH_PACKAGES); outputAdapter.log(LogType.SUCCESS, `Smart Contract packaged: ${pkgFile}`); const fileNames: string[] = pkg.fileNames; outputAdapter.log(LogType.INFO, undefined, `${fileNames.length} file(s) packaged:`); for (const file of fileNames) { outputAdapter.log(LogType.INFO, undefined, `- ${file}`); } const packageEntry: PackageRegistryEntry = new PackageRegistryEntry(); packageEntry.name = properties.workspacePackageName; packageEntry.version = properties.workspacePackageVersion; packageEntry.path = pkgFile; return packageEntry; } catch (err) { outputAdapter.log(LogType.ERROR, err.message, err.toString()); return; } }
kant/blockchain-vscode-extension
client/src/commands/packageSmartContractCommand.ts
TypeScript
ArrowFunction
(task: vscode.Task) => { if (!task.scope || task.scope === vscode.TaskScope.Global || task.scope === vscode.TaskScope.Workspace) { // We don't want unscoped tasks, global tasks, or workspace tasks. return false; } else if (task.scope.uri.fsPath !== workspaceDir.uri.fsPath) { // We only want tasks for our smart contract project. return false; } else if (task.group !== vscode.TaskGroup.Build) { // We only want build tasks. return false; } else if (task.isBackground) { // We only want foreground tasks (not "npm watch"). return false; } else if (task.name.match(/watch/i)) { // We don't want anything with "watch" in the name! return false; } else { return true; } }
kant/blockchain-vscode-extension
client/src/commands/packageSmartContractCommand.ts
TypeScript
ArrowFunction
(resolve: any): any => { const buildTaskListener: vscode.Disposable = vscode.tasks.onDidEndTask((e: vscode.TaskEndEvent) => { if (e.execution === buildTaskExecution) { buildTaskListener.dispose(); resolve(); } }); }
kant/blockchain-vscode-extension
client/src/commands/packageSmartContractCommand.ts
TypeScript
ArrowFunction
(e: vscode.TaskEndEvent) => { if (e.execution === buildTaskExecution) { buildTaskListener.dispose(); resolve(); } }
kant/blockchain-vscode-extension
client/src/commands/packageSmartContractCommand.ts
TypeScript
ArrowFunction
({ classes }) => ( <svg role="presentation"
Adloya/fluentui
packages/fluentui/react-icons-northstar/src/components/PhoneClockIcon.tsx
TypeScript
MethodDeclaration
cx(iconClassNames
Adloya/fluentui
packages/fluentui/react-icons-northstar/src/components/PhoneClockIcon.tsx
TypeScript
ArrowFunction
() => ({ popover: { display: "flex", flexDirection: "column", }, })
essence-community/core-frontend
packages/@essence/essence-constructor-classes/src/AuditInfo/containers/AuditInfoContainer.styles.ts
TypeScript
FunctionDeclaration
function IconUndo(props: Props) { return ( <svg {...props} viewBox="0 0 24 24"> <path d="M12.466 8c-2.65 0-5.05.99-6.9 2.6l-1.89-1.89c-.63-.63-1.71-.19-1.71.7V15c0 .55.45 1 1 1h5.59c.89 0 1.34-1.08.71-1.71l-1.91-1.91c1.39-1.16 3.16-1.88 5.12-1.88 3.16 0 5.89 1.84 7.19 4.5.27.56.91.84 1.5.64.71-.23 1.07-1.04.75-1.72-1.72-3.5-5.3-5.92-9.45-5.92z" /> </svg> ); }
Alphy11/lunar
packages/icons/src/interface/IconUndo.tsx
TypeScript
ClassDeclaration
@Component({ selector: 'app-footer', templateUrl: './footer.component.html', styleUrls: ['./footer.component.scss'] }) export class FooterComponent implements OnInit { constructor() { } ngOnInit(): void { } }
rajeshverma1996/konarkdryfruits
src/app/footer/footer.component.ts
TypeScript
MethodDeclaration
ngOnInit(): void { }
rajeshverma1996/konarkdryfruits
src/app/footer/footer.component.ts
TypeScript
ClassDeclaration
export class Bottle extends Material { name:string; units: number; constructor(units:number){ super(units); this.name = 'Bottle'; } }
EagleLizard/FactorySimulator
Material/Bottle.ts
TypeScript
InterfaceDeclaration
export interface YafeFormDefinition { name: string; title: string; groups: YafeFormGroup[]; }
tobiasbruns/yafe
frontend/yafe-forms/libs/core/src/lib/yafe-form.model.ts
TypeScript
InterfaceDeclaration
export interface YafeFormItem { itemType: 'section' | 'field'; name: string; condition?: string; }
tobiasbruns/yafe
frontend/yafe-forms/libs/core/src/lib/yafe-form.model.ts
TypeScript
InterfaceDeclaration
export interface YafeFormGroup extends YafeFormItem { title?: string; items: YafeFormItem[]; }
tobiasbruns/yafe
frontend/yafe-forms/libs/core/src/lib/yafe-form.model.ts
TypeScript
InterfaceDeclaration
export interface YafeFieldDefinition extends YafeFormItem { type: 'text' | 'select' | 'checkbox'; subType?: string; label: string; defaultValue?: string | number | boolean; tip?: string; description?: string; validators: YafeValidator[]; properties?: [{ [name: string]: string | number | any }] }
tobiasbruns/yafe
frontend/yafe-forms/libs/core/src/lib/yafe-form.model.ts
TypeScript
InterfaceDeclaration
export interface YafeValidator { type: 'BuildIn'; name: 'required'; errorText?: string; }
tobiasbruns/yafe
frontend/yafe-forms/libs/core/src/lib/yafe-form.model.ts
TypeScript
InterfaceDeclaration
export interface FormFieldComponent { definition: YafeFieldDefinition; formControl: AbstractControl; }
tobiasbruns/yafe
frontend/yafe-forms/libs/core/src/lib/yafe-form.model.ts
TypeScript
InterfaceDeclaration
export interface FormSectionComponent { definition: YafeFormGroup; }
tobiasbruns/yafe
frontend/yafe-forms/libs/core/src/lib/yafe-form.model.ts
TypeScript
ArrowFunction
(_, _1) => true
mythwind/datahub
datahub-web-react/src/app/entity/shared/containers/profile/EntityProfile.tsx
TypeScript
ArrowFunction
<T, U>({ urn, useEntityQuery, useUpdateQuery, entityType, getOverrideProperties, tabs, sidebarSections, }: Props<T, U>): JSX.Element => { const isLineageMode = useIsLineageMode(); const entityRegistry = useEntityRegistry(); const history = useHistory(); const isCompact = React.useContext(CompactContext); const tabsWithDefaults = tabs.map((tab) => ({ ...tab, display: { ...defaultTabDisplayConfig, ...tab.display } })); const sideBarSectionsWithDefaults = sidebarSections.map((sidebarSection) => ({ ...sidebarSection, display: { ...defaultSidebarSection, ...sidebarSection.display }, })); const routeToTab = useCallback( ({ tabName, tabParams, method = 'push', }: { tabName: string; tabParams?: Record<string, any>; method?: 'push' | 'replace'; }) => { analytics.event({ type: EventType.EntitySectionViewEvent, entityType, entityUrn: urn, section: tabName.toLowerCase(), }); history[method](getEntityPath(entityType, urn, entityRegistry, false, tabName, tabParams)); }, [history, entityType, urn, entityRegistry], ); const { loading, error, data, refetch } = useEntityQuery({ variables: { urn }, }); const maybeUpdateEntity = useUpdateQuery?.({ onCompleted: () => refetch(), }); let updateEntity; if (maybeUpdateEntity) { [updateEntity] = maybeUpdateEntity; } const entityData = (data && getDataForEntityType({ data: data[Object.keys(data)[0]], entityType, getOverrideProperties })) || null; const lineage = entityData ? entityRegistry.getLineageVizConfig(entityType, entityData) : undefined; const autoRenderTabs: EntityTab[] = entityData?.autoRenderAspects?.map((aspect) => ({ name: aspect.renderSpec?.displayName || aspect.aspectName, component: () => ( <DynamicTab renderSpec={aspect.renderSpec} type={aspect.renderSpec?.displayType} payload={aspect.payload} /> ), display: { visible: () => true, enabled: () => true, }, }
mythwind/datahub
datahub-web-react/src/app/entity/shared/containers/profile/EntityProfile.tsx
TypeScript
ArrowFunction
(tab) => ({ ...tab, display: { ...defaultTabDisplayConfig, ...tab.display } })
mythwind/datahub
datahub-web-react/src/app/entity/shared/containers/profile/EntityProfile.tsx
TypeScript
ArrowFunction
(sidebarSection) => ({ ...sidebarSection, display: { ...defaultSidebarSection, ...sidebarSection.display }, })
mythwind/datahub
datahub-web-react/src/app/entity/shared/containers/profile/EntityProfile.tsx
TypeScript
ArrowFunction
({ tabName, tabParams, method = 'push', }: { tabName: string; tabParams?: Record<string, any>; method?: 'push' | 'replace'; }) => { analytics.event({ type: EventType.EntitySectionViewEvent, entityType, entityUrn: urn, section: tabName.toLowerCase(), }); history[method](getEntityPath(entityType, urn, entityRegistry, false, tabName, tabParams)); }
mythwind/datahub
datahub-web-react/src/app/entity/shared/containers/profile/EntityProfile.tsx
TypeScript
ArrowFunction
() => refetch()
mythwind/datahub
datahub-web-react/src/app/entity/shared/containers/profile/EntityProfile.tsx
TypeScript
ArrowFunction
(aspect) => ({ name: aspect.renderSpec?.displayName || aspect.aspectName, component: () => ( <DynamicTab renderSpec={aspect.renderSpec} type={aspect.renderSpec?.displayType} payload={aspect.payload} /> )
mythwind/datahub
datahub-web-react/src/app/entity/shared/containers/profile/EntityProfile.tsx
TypeScript
ArrowFunction
() => ( <DynamicTab renderSpec={aspect.renderSpec}
mythwind/datahub
datahub-web-react/src/app/entity/shared/containers/profile/EntityProfile.tsx
TypeScript
TypeAliasDeclaration
type Props<T, U> = { urn: string; entityType: EntityType; useEntityQuery: ( baseOptions: QueryHookOptions< T, Exact<{ urn: string; }> >, ) => QueryResult< T, Exact<{ urn: string; }> >; useUpdateQuery?: ( baseOptions?: MutationHookOptions<U, { urn: string; input: GenericEntityUpdate }> | undefined, ) => MutationTuple<U, { urn: string; input: GenericEntityUpdate }>; getOverrideProperties: (T) => GenericEntityProperties; tabs: EntityTab[]; sidebarSections: EntitySidebarSection[]; };
mythwind/datahub
datahub-web-react/src/app/entity/shared/containers/profile/EntityProfile.tsx
TypeScript
MethodDeclaration
isLineageMode ? ( <LineageExplorer type={entityType} urn={urn} /> ) : ( <SplitPane split="vertical" minSize={window.innerWidth
mythwind/datahub
datahub-web-react/src/app/entity/shared/containers/profile/EntityProfile.tsx
TypeScript
ArrowFunction
async () => await disposeTestDocumentStore(store)
Or-Geva/ravendb-nodejs-client
test/Ported/Issues/RDBC_316.ts
TypeScript
ArrowFunction
async () => { { const session = store.openSession(); const user1 = Object.assign(new User(), { name: "Marcin" }); const user2 = Object.assign(new User(), { name: "Marcin" }); await session.store(user1, "users/1"); await session.store(user2, "users/2"); await session.saveChanges(); } { const session = store.openSession(); const user1 = await session.load("users/1", User); const user2 = await session.load("users/2", User); assertThat(user1) .isNotNull(); assertThat(user2) .isNotNull(); assertThat(user1 === user2) .isFalse(); } }
Or-Geva/ravendb-nodejs-client
test/Ported/Issues/RDBC_316.ts
TypeScript
ClassDeclaration
class User { public name: string; }
Or-Geva/ravendb-nodejs-client
test/Ported/Issues/RDBC_316.ts
TypeScript
ArrowFunction
geneItem => geneItem.getValue("id") === gene.id ? suggestedGene : geneItem
fossabot/reaction-1
src/Components/Onboarding/Steps/Genes/GeneSearchResults.tsx
TypeScript
ArrowFunction
(store, data) => this.onGeneFollowed(gene, store, data)
fossabot/reaction-1
src/Components/Onboarding/Steps/Genes/GeneSearchResults.tsx
TypeScript
ArrowFunction
(item, index) => { const imageUrl = get(item, i => i.image.cropped.url) return ( <LinkContainer key={`gene-search-results-${index}`}
fossabot/reaction-1
src/Components/Onboarding/Steps/Genes/GeneSearchResults.tsx
TypeScript
ArrowFunction
i => i.image.cropped.url
fossabot/reaction-1
src/Components/Onboarding/Steps/Genes/GeneSearchResults.tsx
TypeScript