type
stringclasses
7 values
content
stringlengths
4
9.55k
repo
stringlengths
7
96
path
stringlengths
4
178
language
stringclasses
1 value
ArrowFunction
() => { node1.data = 'a long night' node1.replaceData(2, 4, 'starry') expect(node1.data).toBe('a starry night') node1.data = 'data' }
oozcitak/dom
test/dom/CharacterData.test.ts
TypeScript
ArrowFunction
() => { node1.data = 'a long night' expect(node1.substringData(2, 4)).toBe('long') expect(() => node1.substringData(20, 4)).toThrow() expect(node1.substringData(2, 40)).toBe('long night') node1.data = 'data' }
oozcitak/dom
test/dom/CharacterData.test.ts
TypeScript
ArrowFunction
() => node1.substringData(20, 4)
oozcitak/dom
test/dom/CharacterData.test.ts
TypeScript
ArrowFunction
(done) => { node1.data = 'a long night' const callback = (mutations: MutationRecord[]) => { try { for (let mutation of mutations) { if (mutation.type === 'characterData') { expect(mutation.target).toBe(node1) expect([...mutation.addedNodes]).toEqual([]) expect([...mutation.removedNodes]).toEqual([]) expect(mutation.previousSibling).toBeNull() expect(mutation.nextSibling).toBeNull() expect(mutation.oldValue).toBe('a long night') done() } } done() } catch (e) { done(e) } } const observer = new $$.MutationObserver(callback) observer.observe(node1, { characterData: true, characterDataOldValue: true }) node1.deleteData(2, 5) const records = observer.takeRecords() if (records) callback(records) observer.disconnect() node1.data = 'data' }
oozcitak/dom
test/dom/CharacterData.test.ts
TypeScript
ArrowFunction
(mutations: MutationRecord[]) => { try { for (let mutation of mutations) { if (mutation.type === 'characterData') { expect(mutation.target).toBe(node1) expect([...mutation.addedNodes]).toEqual([]) expect([...mutation.removedNodes]).toEqual([]) expect(mutation.previousSibling).toBeNull() expect(mutation.nextSibling).toBeNull() expect(mutation.oldValue).toBe('a long night') done() } } done() } catch (e) { done(e) } }
oozcitak/dom
test/dom/CharacterData.test.ts
TypeScript
ArrowFunction
(done) => { node1.data = 'a long night' let fired = false const callback = (mutations: MutationRecord[]) => { for (let mutation of mutations) { if (mutation.type === 'characterData' && mutation.target === node1) { fired = true } } done() } const observer = new $$.MutationObserver(callback) observer.observe(node1, { characterData: true, characterDataOldValue: true }) dom.setFeatures(false) node1.deleteData(2, 5) dom.setFeatures(true) const records = observer.takeRecords() if (records) callback(records) observer.disconnect() node1.data = 'data' expect(fired).toBe(false) }
oozcitak/dom
test/dom/CharacterData.test.ts
TypeScript
ArrowFunction
(mutations: MutationRecord[]) => { for (let mutation of mutations) { if (mutation.type === 'characterData' && mutation.target === node1) { fired = true } } done() }
oozcitak/dom
test/dom/CharacterData.test.ts
TypeScript
ArrowFunction
([name,value]) => inner.setAttribute(name, value as string)
cam-narzt/st-feather
src/components/copyright.tsx
TypeScript
ArrowFunction
(acc, prop) => { if(this[prop] !== undefined && this[prop] !== null) { acc[prop] = this[prop]; } return acc; }
cam-narzt/st-feather
src/components/copyright.tsx
TypeScript
ClassDeclaration
@Component({ tag: 'icon-copyright' }) export class IconCopyright { @Element() el: any; @Prop({ attribute: 'alignment-baseline' }) alignmentBaseline: any; @Prop({ attribute: 'baseline-shift' }) baselineShift: any; @Prop({ attribute: 'clip-path' }) clipPath: any; @Prop({ attribute: 'clip-rule' }) clipRule: any; @Prop({ attribute: 'color' }) color: any; @Prop({ attribute: 'color-interpolation' }) colorInterpolation: any; @Prop({ attribute: 'color-interpolation-filters' }) colorInterpolationFilters: any; @Prop({ attribute: 'color-rendering' }) colorRendering: any; @Prop({ attribute: 'cursor' }) cursor: any; @Prop({ attribute: 'cx' }) cx: any; @Prop({ attribute: 'cy' }) cy: any; @Prop({ attribute: 'd' }) d: any; @Prop({ attribute: 'direction' }) direction: any; @Prop({ attribute: 'display' }) display: any; @Prop({ attribute: 'dominant-baseline' }) dominantBaseline: any; @Prop({ attribute: 'fill' }) fill: any; @Prop({ attribute: 'fill-opacity' }) fillOpacity: any; @Prop({ attribute: 'fill-rule' }) fillRule: any; @Prop({ attribute: 'filter' }) filter: any; @Prop({ attribute: 'flood-color' }) floodColor: any; @Prop({ attribute: 'flood-opacity' }) floodOpacity: any; @Prop({ attribute: 'font' }) font: any; @Prop({ attribute: 'font-family' }) fontFamily: any; @Prop({ attribute: 'font-kerning' }) fontKerning: any; @Prop({ attribute: 'font-size' }) fontSize: any; @Prop({ attribute: 'font-size-adjust' }) fontSizeAdjust: any; @Prop({ attribute: 'font-stretch' }) fontStretch: any; @Prop({ attribute: 'font-style' }) fontStyle: any; @Prop({ attribute: 'font-variant' }) fontVariant: any; @Prop({ attribute: 'font-weight' }) fontWeight: any; @Prop({ attribute: 'height' }) height: any; @Prop({ attribute: 'image-rendering' }) imageRendering: any; @Prop({ attribute: 'isolation' }) isolation: any; @Prop({ attribute: 'letter-spacing' }) letterSpacing: any; @Prop({ attribute: 'lighting-color' }) lightingColor: any; @Prop({ attribute: 'marker' }) marker: any; @Prop({ attribute: 'marker-end' }) markerEnd: any; @Prop({ attribute: 'marker-mid' }) markerMid: any; @Prop({ attribute: 'marker-start' }) markerStart: any; @Prop({ attribute: 'mask' }) mask: any; @Prop({ attribute: 'mask-clip' }) maskClip: any; @Prop({ attribute: 'mask-composite' }) maskComposite: any; @Prop({ attribute: 'mask-image' }) maskImage: any; @Prop({ attribute: 'mask-mode' }) maskMode: any; @Prop({ attribute: 'mask-origin' }) maskOrigin: any; @Prop({ attribute: 'mask-position' }) maskPosition: any; @Prop({ attribute: 'mask-repeat' }) maskRepeat: any; @Prop({ attribute: 'mask-size' }) maskSize: any; @Prop({ attribute: 'mask-type' }) maskType: any; @Prop({ attribute: 'opacity' }) opacity: any; @Prop({ attribute: 'overflow' }) overflow: any; @Prop({ attribute: 'pointer-events' }) pointerEvents: any; @Prop({ attribute: 'r' }) r: any; @Prop({ attribute: 'rx' }) rx: any; @Prop({ attribute: 'ry' }) ry: any; @Prop({ attribute: 'shape-rendering' }) shapeRendering: any; @Prop({ attribute: 'stop-color' }) stopColor: any; @Prop({ attribute: 'stop-opacity' }) stopOpacity: any; @Prop({ attribute: 'stroke' }) stroke: any; @Prop({ attribute: 'stroke-dasharray' }) strokeDasharray: any; @Prop({ attribute: 'stroke-dashoffset' }) strokeDashoffset: any; @Prop({ attribute: 'stroke-linecap' }) strokeLinecap: any; @Prop({ attribute: 'stroke-linejoin' }) strokeLinejoin: any; @Prop({ attribute: 'stroke-miterlimit' }) strokeMiterlimit: any; @Prop({ attribute: 'stroke-opacity' }) strokeOpacity: any; @Prop({ attribute: 'stroke-width' }) strokeWidth: any; @Prop({ attribute: 'text-anchor' }) textAnchor: any; @Prop({ attribute: 'text-decoration' }) textDecoration: any; @Prop({ attribute: 'text-orientation' }) textOrientation: any; @Prop({ attribute: 'text-rendering' }) textRendering: any; @Prop({ attribute: 'transform' }) transform: any; @Prop({ attribute: 'transform-box' }) transformBox: any; @Prop({ attribute: 'transform-origin' }) transformOrigin: any; @Prop({ attribute: 'unicode-bidi' }) unicodeBidi: any; @Prop({ attribute: 'visibility' }) visibility: any; @Prop({ attribute: 'width' }) width: any; @Prop({ attribute: 'word-spacing' }) wordSpacing: any; @Prop({ attribute: 'writing-mode' }) writingMode: any; @Prop({ attribute: 'x' }) x: any; @Prop({ attribute: 'y' }) y: any; render() { const inner = createElement(Copyright); Object.entries(Object.assign({},attributesToObject(this.el), this.getProps())).forEach(([name,value]) => inner.setAttribute(name, value as string) ); return <Host innerHTML={inner.outerHTML} class="st-lucide-icon"></Host>; } private getProps() { const props = ['color','cursor','cx','cy','d','direction','display','fill','filter','font','height','isolation','marker','mask','opacity','overflow','r','rx','ry','stroke','transform','visibility','width','x','y']; return props.reduce((acc, prop) => { if(this[prop] !== undefined && this[prop] !== null) { acc[prop] = this[prop]; } return acc; }, {}); } }
cam-narzt/st-feather
src/components/copyright.tsx
TypeScript
MethodDeclaration
render() { const inner = createElement(Copyright); Object.entries(Object.assign({},attributesToObject(this.el), this.getProps())).forEach(([name,value]) => inner.setAttribute(name, value as string) ); return <Host innerHTML={inner.outerHTML} class="st-lucide-icon"></Host>; }
cam-narzt/st-feather
src/components/copyright.tsx
TypeScript
MethodDeclaration
private getProps() { const props = ['color','cursor','cx','cy','d','direction','display','fill','filter','font','height','isolation','marker','mask','opacity','overflow','r','rx','ry','stroke','transform','visibility','width','x','y']; return props.reduce((acc, prop) => { if(this[prop] !== undefined && this[prop] !== null) { acc[prop] = this[prop]; } return acc; }, {}); }
cam-narzt/st-feather
src/components/copyright.tsx
TypeScript
ArrowFunction
( value ) => is.array( value ) && is.string( value[ 0 ] )
mojule/dom-components
src/is-node-tuple.ts
TypeScript
MethodDeclaration
/** * Returns a [paginated](https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/#pagination) list of the * screens a field is used in. * * **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/#permissions) required:** * *Administer Jira* [global permission](https://confluence.atlassian.com/x/x4dKLg). */ async getScreensForField<T = Models.PageBeanScreenWithTab>( parameters: Parameters.GetScreensForField, callback: Callback<T> ): Promise<void>;
balaprasanna/jira.js
src/version3/screens.ts
TypeScript
MethodDeclaration
/** * Returns a [paginated](https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/#pagination) list of the * screens a field is used in. * * **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/#permissions) required:** * *Administer Jira* [global permission](https://confluence.atlassian.com/x/x4dKLg). */ async getScreensForField<T = Models.PageBeanScreenWithTab>( parameters: Parameters.GetScreensForField, callback?: never ): Promise<T>;
balaprasanna/jira.js
src/version3/screens.ts
TypeScript
MethodDeclaration
async getScreensForField<T = Models.PageBeanScreenWithTab>( parameters: Parameters.GetScreensForField, callback?: Callback<T>, ): Promise<void | T> { const config: RequestConfig = { url: `/rest/api/3/field/${parameters.fieldId}/screens`, method: 'GET', params: { startAt: parameters.startAt, maxResults: parameters.maxResults, expand: parameters.expand, }, }; return this.client.sendRequest(config, callback, { methodName: 'version3.screens.getScreensForField' }); }
balaprasanna/jira.js
src/version3/screens.ts
TypeScript
MethodDeclaration
/** * Returns a [paginated](https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/#pagination) list of all * screens or those specified by one or more screen IDs. * * **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/#permissions) required:** * *Administer Jira* [global permission](https://confluence.atlassian.com/x/x4dKLg). */ async getScreens<T = Models.PageBeanScreen>( parameters: Parameters.GetScreens | undefined, callback: Callback<T> ): Promise<void>;
balaprasanna/jira.js
src/version3/screens.ts
TypeScript
MethodDeclaration
/** * Returns a [paginated](https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/#pagination) list of all * screens or those specified by one or more screen IDs. * * **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/#permissions) required:** * *Administer Jira* [global permission](https://confluence.atlassian.com/x/x4dKLg). */ async getScreens<T = Models.PageBeanScreen>(parameters?: Parameters.GetScreens, callback?: never): Promise<T>;
balaprasanna/jira.js
src/version3/screens.ts
TypeScript
MethodDeclaration
async getScreens<T = Models.PageBeanScreen>( parameters?: Parameters.GetScreens, callback?: Callback<T>, ): Promise<void | T> { const config: RequestConfig = { url: '/rest/api/3/screens', method: 'GET', params: { startAt: parameters?.startAt, maxResults: parameters?.maxResults, id: parameters?.id, }, }; return this.client.sendRequest(config, callback, { methodName: 'version3.screens.getScreens' }); }
balaprasanna/jira.js
src/version3/screens.ts
TypeScript
MethodDeclaration
/** * Creates a screen with a default field tab. * * **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/#permissions) required:** * *Administer Jira* [global permission](https://confluence.atlassian.com/x/x4dKLg). */ async createScreen<T = Models.Screen>( parameters: Parameters.CreateScreen | undefined, callback: Callback<T> ): Promise<void>;
balaprasanna/jira.js
src/version3/screens.ts
TypeScript
MethodDeclaration
/** * Creates a screen with a default field tab. * * **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/#permissions) required:** * *Administer Jira* [global permission](https://confluence.atlassian.com/x/x4dKLg). */ async createScreen<T = Models.Screen>(parameters?: Parameters.CreateScreen, callback?: never): Promise<T>;
balaprasanna/jira.js
src/version3/screens.ts
TypeScript
MethodDeclaration
async createScreen<T = Models.Screen>( parameters?: Parameters.CreateScreen, callback?: Callback<T>, ): Promise<void | T> { const config: RequestConfig = { url: '/rest/api/3/screens', method: 'POST', data: { name: parameters?.name, description: parameters?.description, }, }; return this.client.sendRequest(config, callback, { methodName: 'version3.screens.createScreen' }); }
balaprasanna/jira.js
src/version3/screens.ts
TypeScript
MethodDeclaration
/** * Adds a field to the default tab of the default screen. * * **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/#permissions) required:** * *Administer Jira* [global permission](https://confluence.atlassian.com/x/x4dKLg). */ async addFieldToDefaultScreen<T = unknown>( parameters: Parameters.AddFieldToDefaultScreen, callback: Callback<T> ): Promise<void>;
balaprasanna/jira.js
src/version3/screens.ts
TypeScript
MethodDeclaration
/** * Adds a field to the default tab of the default screen. * * **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/#permissions) required:** * *Administer Jira* [global permission](https://confluence.atlassian.com/x/x4dKLg). */ async addFieldToDefaultScreen<T = unknown>( parameters: Parameters.AddFieldToDefaultScreen, callback?: never ): Promise<T>;
balaprasanna/jira.js
src/version3/screens.ts
TypeScript
MethodDeclaration
async addFieldToDefaultScreen<T = unknown>( parameters: Parameters.AddFieldToDefaultScreen, callback?: Callback<T>, ): Promise<void | T> { const config: RequestConfig = { url: `/rest/api/3/screens/addToDefault/${parameters.fieldId}`, method: 'POST', }; return this.client.sendRequest(config, callback, { methodName: 'version3.screens.addFieldToDefaultScreen' }); }
balaprasanna/jira.js
src/version3/screens.ts
TypeScript
MethodDeclaration
/** * Updates a screen. Only screens used in classic projects can be updated. * * **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/#permissions) required:** * *Administer Jira* [global permission](https://confluence.atlassian.com/x/x4dKLg). */ async updateScreen<T = Models.Screen>(parameters: Parameters.UpdateScreen, callback: Callback<T>): Promise<void>;
balaprasanna/jira.js
src/version3/screens.ts
TypeScript
MethodDeclaration
/** * Updates a screen. Only screens used in classic projects can be updated. * * **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/#permissions) required:** * *Administer Jira* [global permission](https://confluence.atlassian.com/x/x4dKLg). */ async updateScreen<T = Models.Screen>(parameters: Parameters.UpdateScreen, callback?: never): Promise<T>;
balaprasanna/jira.js
src/version3/screens.ts
TypeScript
MethodDeclaration
async updateScreen<T = Models.Screen>( parameters: Parameters.UpdateScreen, callback?: Callback<T>, ): Promise<void | T> { const config: RequestConfig = { url: `/rest/api/3/screens/${parameters.screenId}`, method: 'PUT', data: { name: parameters.name, description: parameters.description, }, }; return this.client.sendRequest(config, callback, { methodName: 'version3.screens.updateScreen' }); }
balaprasanna/jira.js
src/version3/screens.ts
TypeScript
MethodDeclaration
/** * Deletes a screen. A screen cannot be deleted if it is used in a screen scheme, workflow, or workflow draft. * * Only screens used in classic projects can be deleted. */ async deleteScreen<T = void>(parameters: Parameters.DeleteScreen, callback: Callback<T>): Promise<void>;
balaprasanna/jira.js
src/version3/screens.ts
TypeScript
MethodDeclaration
/** * Deletes a screen. A screen cannot be deleted if it is used in a screen scheme, workflow, or workflow draft. * * Only screens used in classic projects can be deleted. */ async deleteScreen<T = void>(parameters: Parameters.DeleteScreen, callback?: never): Promise<T>;
balaprasanna/jira.js
src/version3/screens.ts
TypeScript
MethodDeclaration
async deleteScreen<T = void>(parameters: Parameters.DeleteScreen, callback?: Callback<T>): Promise<void | T> { const config: RequestConfig = { url: `/rest/api/3/screens/${parameters.screenId}`, method: 'DELETE', }; return this.client.sendRequest(config, callback, { methodName: 'version3.screens.deleteScreen' }); }
balaprasanna/jira.js
src/version3/screens.ts
TypeScript
MethodDeclaration
/** * Returns the fields that can be added to a tab on a screen. * * **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/#permissions) required:** * *Administer Jira* [global permission](https://confluence.atlassian.com/x/x4dKLg). */ async getAvailableScreenFields<T = Models.ScreenableField[]>( parameters: Parameters.GetAvailableScreenFields, callback: Callback<T> ): Promise<void>;
balaprasanna/jira.js
src/version3/screens.ts
TypeScript
MethodDeclaration
/** * Returns the fields that can be added to a tab on a screen. * * **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/#permissions) required:** * *Administer Jira* [global permission](https://confluence.atlassian.com/x/x4dKLg). */ async getAvailableScreenFields<T = Models.ScreenableField[]>( parameters: Parameters.GetAvailableScreenFields, callback?: never ): Promise<T>;
balaprasanna/jira.js
src/version3/screens.ts
TypeScript
MethodDeclaration
async getAvailableScreenFields<T = Models.ScreenableField[]>( parameters: Parameters.GetAvailableScreenFields, callback?: Callback<T>, ): Promise<void | T> { const config: RequestConfig = { url: `/rest/api/3/screens/${parameters.screenId}/availableFields`, method: 'GET', }; return this.client.sendRequest(config, callback, { methodName: 'version3.screens.getAvailableScreenFields' }); }
balaprasanna/jira.js
src/version3/screens.ts
TypeScript
FunctionDeclaration
/** * Fades child elements in and out as they mount/unmount. * * This file is tightly coupled with `transition.css`, specifically * around timing + classNames. More info: https://reactjs.org/docs/animation.html */ function FadeTransitioner({ locationKey, children }: Props) { return ( <TransitionGroup style={transitionGroupStyles}> <CSSTransition key={locationKey} timeout={timeoutConfig} classNames="fade"> {/* Placing the Suspense boundary here (within the TransitionGroup) allows the scroll position to remain uninterrupted upon navigation */} <Suspense fallback={<FullPageLoader />}
gallery-so/gallery
src/components/FadeTransitioner/FadeTransitioner.tsx
TypeScript
TypeAliasDeclaration
type Props = { locationKey?: string; children: React.ReactNode; };
gallery-so/gallery
src/components/FadeTransitioner/FadeTransitioner.tsx
TypeScript
ArrowFunction
data => { this.items = [ { title: data[0], component: SchedulePage }, { title: data[1], note: '(Big)', component: List1Page }, { title: data[2], note: '(Mini)', component: List2Page }, { title: data[3], component: GridPage }, { title: data[4], component: NotificationsPage }, { title: data[5], component: ProfilePage }, ]; }
Shasthojoy/Ecommerce-Json-Ionic-3-Template
src/pages/layouts/layouts.ts
TypeScript
ClassDeclaration
@Component({ selector: 'layouts-page', templateUrl: 'layouts.html' }) export class LayoutsPage { items: Array<{title: string, note?: string, component: any}>; constructor( public nav: NavController, public translate: TranslateService ) { } ionViewWillEnter(){ Observable.forkJoin( this.translate.get('SCHEDULE'), this.translate.get('LISTS'), this.translate.get('LISTS'), this.translate.get('GRID'), this.translate.get('NOTIFICATIONS'), this.translate.get('PROFILE'), ).subscribe(data => { this.items = [ { title: data[0], component: SchedulePage }, { title: data[1], note: '(Big)', component: List1Page }, { title: data[2], note: '(Mini)', component: List2Page }, { title: data[3], component: GridPage }, { title: data[4], component: NotificationsPage }, { title: data[5], component: ProfilePage }, ]; }); } itemTapped(event, item) { this.nav.push(item.component); } }
Shasthojoy/Ecommerce-Json-Ionic-3-Template
src/pages/layouts/layouts.ts
TypeScript
MethodDeclaration
ionViewWillEnter(){ Observable.forkJoin( this.translate.get('SCHEDULE'), this.translate.get('LISTS'), this.translate.get('LISTS'), this.translate.get('GRID'), this.translate.get('NOTIFICATIONS'), this.translate.get('PROFILE'), ).subscribe(data => { this.items = [ { title: data[0], component: SchedulePage }, { title: data[1], note: '(Big)', component: List1Page }, { title: data[2], note: '(Mini)', component: List2Page }, { title: data[3], component: GridPage }, { title: data[4], component: NotificationsPage }, { title: data[5], component: ProfilePage }, ]; }); }
Shasthojoy/Ecommerce-Json-Ionic-3-Template
src/pages/layouts/layouts.ts
TypeScript
MethodDeclaration
itemTapped(event, item) { this.nav.push(item.component); }
Shasthojoy/Ecommerce-Json-Ionic-3-Template
src/pages/layouts/layouts.ts
TypeScript
FunctionDeclaration
function getSetupEntities() { const accountEntity = getMockAccountEntity(configFromEnv); return { accountEntity }; }
Creativice-Oy/graph-azure
src/steps/resource-manager/databases/sql/index.test.ts
TypeScript
FunctionDeclaration
async function getSetupEntities() { const accountEntity = getMockAccountEntity(configFromEnv); const setupContext = createMockAzureStepExecutionContext({ instanceConfig: configFromEnv, setData: { [ACCOUNT_ENTITY_TYPE]: accountEntity, }, }); await fetchSQLServers(setupContext); const j1devSqlServerEntities = setupContext.jobState.collectedEntities.filter( (e) => e._type === entities.SERVER._type && e.displayName === 'example-sql-server-02', ); expect(j1devSqlServerEntities.length).toBe(1); const sqlServerEntity = j1devSqlServerEntities[0]; return { accountEntity, sqlServerEntity }; }
Creativice-Oy/graph-azure
src/steps/resource-manager/databases/sql/index.test.ts
TypeScript
ArrowFunction
async () => { if (recording) { await recording.stop(); } }
Creativice-Oy/graph-azure
src/steps/resource-manager/databases/sql/index.test.ts
TypeScript
ArrowFunction
() => { function getSetupEntities() { const accountEntity = getMockAccountEntity(configFromEnv); return { accountEntity }; } test('step', async () => { recording = setupAzureRecording({ directory: __dirname, name: 'rm-database-sql-servers', options: { matchRequestsBy: getMatchRequestsBy({ config: configFromEnv }), }, }); const { accountEntity } = getSetupEntities(); const context = createMockAzureStepExecutionContext({ instanceConfig: configFromEnv, entities: [], setData: { [ACCOUNT_ENTITY_TYPE]: accountEntity, }, }); await fetchSQLServers(context); const sqlServerEntities = context.jobState.collectedEntities; expect(sqlServerEntities.length).toBeGreaterThan(0); expect(sqlServerEntities).toMatchGraphObjectSchema({ _class: entities.SERVER._class, }); const resourceGroupSqlServerRelationships = context.jobState.collectedRelationships; // We have not fetched the resource groups these point to, so they may not exist in the job state. // expect(resourceGroupSqlServerRelationships.length).toBe(sqlServerEntities.length); expect(resourceGroupSqlServerRelationships).toMatchDirectRelationshipSchema( { schema: { properties: { _type: { const: relationships.RESOURCE_GROUP_HAS_SQL_SERVER._type }, }, }, }, ); }); }
Creativice-Oy/graph-azure
src/steps/resource-manager/databases/sql/index.test.ts
TypeScript
ArrowFunction
async () => { recording = setupAzureRecording({ directory: __dirname, name: 'rm-database-sql-servers', options: { matchRequestsBy: getMatchRequestsBy({ config: configFromEnv }), }, }); const { accountEntity } = getSetupEntities(); const context = createMockAzureStepExecutionContext({ instanceConfig: configFromEnv, entities: [], setData: { [ACCOUNT_ENTITY_TYPE]: accountEntity, }, }); await fetchSQLServers(context); const sqlServerEntities = context.jobState.collectedEntities; expect(sqlServerEntities.length).toBeGreaterThan(0); expect(sqlServerEntities).toMatchGraphObjectSchema({ _class: entities.SERVER._class, }); const resourceGroupSqlServerRelationships = context.jobState.collectedRelationships; // We have not fetched the resource groups these point to, so they may not exist in the job state. // expect(resourceGroupSqlServerRelationships.length).toBe(sqlServerEntities.length); expect(resourceGroupSqlServerRelationships).toMatchDirectRelationshipSchema( { schema: { properties: { _type: { const: relationships.RESOURCE_GROUP_HAS_SQL_SERVER._type }, }, }, }, ); }
Creativice-Oy/graph-azure
src/steps/resource-manager/databases/sql/index.test.ts
TypeScript
ArrowFunction
() => { async function getSetupEntities() { const accountEntity = getMockAccountEntity(configFromEnv); const setupContext = createMockAzureStepExecutionContext({ instanceConfig: configFromEnv, setData: { [ACCOUNT_ENTITY_TYPE]: accountEntity, }, }); await fetchSQLServers(setupContext); const j1devSqlServerEntities = setupContext.jobState.collectedEntities.filter( (e) => e._type === entities.SERVER._type && e.displayName === 'example-sql-server-02', ); expect(j1devSqlServerEntities.length).toBe(1); const sqlServerEntity = j1devSqlServerEntities[0]; return { accountEntity, sqlServerEntity }; } test('step', async () => { recording = setupAzureRecording({ directory: __dirname, name: 'rm-sql-server-diagnostic-settings', options: { matchRequestsBy: getMatchRequestsBy({ config: configFromEnv }), }, }); const { sqlServerEntity, accountEntity } = await getSetupEntities(); const context = createMockAzureStepExecutionContext({ instanceConfig: configFromEnv, entities: [sqlServerEntity], setData: { [ACCOUNT_ENTITY_TYPE]: accountEntity, }, }); await fetchSQLServerDiagnosticSettings(context); const { diagnosticSettingsEntities, rest: restEntities, } = separateDiagnosticSettingsEntities(context.jobState.collectedEntities); // TODO: properly setup diagnostic settings and undo this expect(diagnosticSettingsEntities.length).toBeGreaterThanOrEqual(0); expect(diagnosticSettingsEntities).toMatchGraphObjectSchema({ _class: MonitorEntities.DIAGNOSTIC_SETTING._class, }); expect(restEntities).toHaveLength(0); const { diagnosticSettingsRelationships, // We have not fetched the storage account that these point to, so they may not exist in the job state. // diagnosticSettingsStorageRelationships, rest: restRelationships, } = separateDiagnosticSettingsRelationships( context.jobState.collectedRelationships, ); expect(diagnosticSettingsRelationships.length).toBe( diagnosticSettingsEntities.length, ); expect(restRelationships).toHaveLength(0); expect( context.jobState.collectedRelationships, ).toMatchDirectRelationshipSchema({}); }); }
Creativice-Oy/graph-azure
src/steps/resource-manager/databases/sql/index.test.ts
TypeScript
ArrowFunction
(e) => e._type === entities.SERVER._type && e.displayName === 'example-sql-server-02'
Creativice-Oy/graph-azure
src/steps/resource-manager/databases/sql/index.test.ts
TypeScript
ArrowFunction
async () => { recording = setupAzureRecording({ directory: __dirname, name: 'rm-sql-server-diagnostic-settings', options: { matchRequestsBy: getMatchRequestsBy({ config: configFromEnv }), }, }); const { sqlServerEntity, accountEntity } = await getSetupEntities(); const context = createMockAzureStepExecutionContext({ instanceConfig: configFromEnv, entities: [sqlServerEntity], setData: { [ACCOUNT_ENTITY_TYPE]: accountEntity, }, }); await fetchSQLServerDiagnosticSettings(context); const { diagnosticSettingsEntities, rest: restEntities, } = separateDiagnosticSettingsEntities(context.jobState.collectedEntities); // TODO: properly setup diagnostic settings and undo this expect(diagnosticSettingsEntities.length).toBeGreaterThanOrEqual(0); expect(diagnosticSettingsEntities).toMatchGraphObjectSchema({ _class: MonitorEntities.DIAGNOSTIC_SETTING._class, }); expect(restEntities).toHaveLength(0); const { diagnosticSettingsRelationships, // We have not fetched the storage account that these point to, so they may not exist in the job state. // diagnosticSettingsStorageRelationships, rest: restRelationships, } = separateDiagnosticSettingsRelationships( context.jobState.collectedRelationships, ); expect(diagnosticSettingsRelationships.length).toBe( diagnosticSettingsEntities.length, ); expect(restRelationships).toHaveLength(0); expect( context.jobState.collectedRelationships, ).toMatchDirectRelationshipSchema({}); }
Creativice-Oy/graph-azure
src/steps/resource-manager/databases/sql/index.test.ts
TypeScript
ArrowFunction
() => { async function getSetupEntities() { const accountEntity = getMockAccountEntity(configFromEnv); const setupContext = createMockAzureStepExecutionContext({ instanceConfig: configFromEnv, setData: { [ACCOUNT_ENTITY_TYPE]: accountEntity, }, }); await fetchSQLServers(setupContext); const j1devSqlServerEntities = setupContext.jobState.collectedEntities.filter( (e) => e._type === entities.SERVER._type && e.displayName === 'example-sql-server-02', ); expect(j1devSqlServerEntities.length).toBe(1); const sqlServerEntity = j1devSqlServerEntities[0]; return { accountEntity, sqlServerEntity }; } test('step', async () => { recording = setupAzureRecording({ directory: __dirname, name: 'rm-database-sql-databases', options: { matchRequestsBy: getMatchRequestsBy({ config: configFromEnv }), }, }); const { sqlServerEntity, accountEntity } = await getSetupEntities(); const context = createMockAzureStepExecutionContext({ instanceConfig: configFromEnv, entities: [sqlServerEntity], setData: { [ACCOUNT_ENTITY_TYPE]: accountEntity, }, }); await fetchSQLDatabases(context); const sqlDatabaseEntities = context.jobState.collectedEntities; expect(sqlDatabaseEntities.length).toBeGreaterThan(0); expect(sqlDatabaseEntities).toMatchGraphObjectSchema({ _class: entities.DATABASE._class, }); const sqlServerDatabaseRelationships = context.jobState.collectedRelationships; expect(sqlServerDatabaseRelationships.length).toBe( sqlDatabaseEntities.length, ); expect(sqlServerDatabaseRelationships).toMatchDirectRelationshipSchema({ schema: { properties: { _type: { const: relationships.SQL_SERVER_HAS_SQL_DATABASE._type }, }, }, }); }); }
Creativice-Oy/graph-azure
src/steps/resource-manager/databases/sql/index.test.ts
TypeScript
ArrowFunction
async () => { recording = setupAzureRecording({ directory: __dirname, name: 'rm-database-sql-databases', options: { matchRequestsBy: getMatchRequestsBy({ config: configFromEnv }), }, }); const { sqlServerEntity, accountEntity } = await getSetupEntities(); const context = createMockAzureStepExecutionContext({ instanceConfig: configFromEnv, entities: [sqlServerEntity], setData: { [ACCOUNT_ENTITY_TYPE]: accountEntity, }, }); await fetchSQLDatabases(context); const sqlDatabaseEntities = context.jobState.collectedEntities; expect(sqlDatabaseEntities.length).toBeGreaterThan(0); expect(sqlDatabaseEntities).toMatchGraphObjectSchema({ _class: entities.DATABASE._class, }); const sqlServerDatabaseRelationships = context.jobState.collectedRelationships; expect(sqlServerDatabaseRelationships.length).toBe( sqlDatabaseEntities.length, ); expect(sqlServerDatabaseRelationships).toMatchDirectRelationshipSchema({ schema: { properties: { _type: { const: relationships.SQL_SERVER_HAS_SQL_DATABASE._type }, }, }, }); }
Creativice-Oy/graph-azure
src/steps/resource-manager/databases/sql/index.test.ts
TypeScript
ArrowFunction
() => { async function getSetupEntities() { const accountEntity = getMockAccountEntity(configFromEnv); const setupContext = createMockAzureStepExecutionContext({ instanceConfig: configFromEnv, setData: { [ACCOUNT_ENTITY_TYPE]: accountEntity, }, }); await fetchSQLServers(setupContext); const j1devSqlServerEntities = setupContext.jobState.collectedEntities.filter( (e) => e._type === entities.SERVER._type && e.displayName === 'example-sql-server-02', ); expect(j1devSqlServerEntities.length).toBe(1); const sqlServerEntity = j1devSqlServerEntities[0]; return { accountEntity, sqlServerEntity }; } test('step', async () => { recording = setupAzureRecording({ directory: __dirname, name: 'rm-database-sql-server-firewall-rules', options: { matchRequestsBy: getMatchRequestsBy({ config: configFromEnv }), }, }); const { sqlServerEntity, accountEntity } = await getSetupEntities(); const context = createMockAzureStepExecutionContext({ instanceConfig: configFromEnv, entities: [sqlServerEntity], setData: { [ACCOUNT_ENTITY_TYPE]: accountEntity, }, }); await fetchSQLServerFirewallRules(context); const sqlServerFirewallRuleEntities = context.jobState.collectedEntities; expect(sqlServerFirewallRuleEntities.length).toBeGreaterThan(0); expect(sqlServerFirewallRuleEntities).toMatchGraphObjectSchema({ _class: entities.FIREWALL_RULE._class, }); const sqlServerFirewallRuleRelationships = context.jobState.collectedRelationships; expect(sqlServerFirewallRuleRelationships.length).toBe( sqlServerFirewallRuleEntities.length, ); expect(sqlServerFirewallRuleRelationships).toMatchDirectRelationshipSchema( {}, ); }); }
Creativice-Oy/graph-azure
src/steps/resource-manager/databases/sql/index.test.ts
TypeScript
ArrowFunction
async () => { recording = setupAzureRecording({ directory: __dirname, name: 'rm-database-sql-server-firewall-rules', options: { matchRequestsBy: getMatchRequestsBy({ config: configFromEnv }), }, }); const { sqlServerEntity, accountEntity } = await getSetupEntities(); const context = createMockAzureStepExecutionContext({ instanceConfig: configFromEnv, entities: [sqlServerEntity], setData: { [ACCOUNT_ENTITY_TYPE]: accountEntity, }, }); await fetchSQLServerFirewallRules(context); const sqlServerFirewallRuleEntities = context.jobState.collectedEntities; expect(sqlServerFirewallRuleEntities.length).toBeGreaterThan(0); expect(sqlServerFirewallRuleEntities).toMatchGraphObjectSchema({ _class: entities.FIREWALL_RULE._class, }); const sqlServerFirewallRuleRelationships = context.jobState.collectedRelationships; expect(sqlServerFirewallRuleRelationships.length).toBe( sqlServerFirewallRuleEntities.length, ); expect(sqlServerFirewallRuleRelationships).toMatchDirectRelationshipSchema( {}, ); }
Creativice-Oy/graph-azure
src/steps/resource-manager/databases/sql/index.test.ts
TypeScript
ArrowFunction
() => { async function getSetupEntities() { const accountEntity = getMockAccountEntity(configFromEnv); const setupContext = createMockAzureStepExecutionContext({ instanceConfig: configFromEnv, setData: { [ACCOUNT_ENTITY_TYPE]: accountEntity, }, }); await fetchSQLServers(setupContext); const j1devSqlServerEntities = setupContext.jobState.collectedEntities.filter( (e) => e._type === entities.SERVER._type && e.displayName === 'example-sql-server-02', ); expect(j1devSqlServerEntities.length).toBe(1); const sqlServerEntity = j1devSqlServerEntities[0]; return { accountEntity, sqlServerEntity }; } test('step', async () => { recording = setupAzureRecording({ directory: __dirname, name: 'rm-database-sql-server-active-directory-admins', options: { matchRequestsBy: getMatchRequestsBy({ config: configFromEnv }), }, }); const { sqlServerEntity, accountEntity } = await getSetupEntities(); const context = createMockAzureStepExecutionContext({ instanceConfig: configFromEnv, entities: [sqlServerEntity], setData: { [ACCOUNT_ENTITY_TYPE]: accountEntity, }, }); await fetchSQLServerActiveDirectoryAdmins(context); const sqlServerActiveDirectoryAdminEntities = context.jobState.collectedEntities; expect(sqlServerActiveDirectoryAdminEntities.length).toBeGreaterThan(0); expect(sqlServerActiveDirectoryAdminEntities).toMatchGraphObjectSchema({ _class: entities.ACTIVE_DIRECTORY_ADMIN._class, }); const sqlServerActiveDirectoryAdminRelationships = context.jobState.collectedRelationships; expect(sqlServerActiveDirectoryAdminRelationships.length).toBe( sqlServerActiveDirectoryAdminEntities.length, ); expect( sqlServerActiveDirectoryAdminRelationships, ).toMatchDirectRelationshipSchema({ schema: { properties: { _type: { const: relationships.SQL_SERVER_HAS_AD_ADMIN._type }, }, }, }); }); }
Creativice-Oy/graph-azure
src/steps/resource-manager/databases/sql/index.test.ts
TypeScript
ArrowFunction
async () => { recording = setupAzureRecording({ directory: __dirname, name: 'rm-database-sql-server-active-directory-admins', options: { matchRequestsBy: getMatchRequestsBy({ config: configFromEnv }), }, }); const { sqlServerEntity, accountEntity } = await getSetupEntities(); const context = createMockAzureStepExecutionContext({ instanceConfig: configFromEnv, entities: [sqlServerEntity], setData: { [ACCOUNT_ENTITY_TYPE]: accountEntity, }, }); await fetchSQLServerActiveDirectoryAdmins(context); const sqlServerActiveDirectoryAdminEntities = context.jobState.collectedEntities; expect(sqlServerActiveDirectoryAdminEntities.length).toBeGreaterThan(0); expect(sqlServerActiveDirectoryAdminEntities).toMatchGraphObjectSchema({ _class: entities.ACTIVE_DIRECTORY_ADMIN._class, }); const sqlServerActiveDirectoryAdminRelationships = context.jobState.collectedRelationships; expect(sqlServerActiveDirectoryAdminRelationships.length).toBe( sqlServerActiveDirectoryAdminEntities.length, ); expect( sqlServerActiveDirectoryAdminRelationships, ).toMatchDirectRelationshipSchema({ schema: { properties: { _type: { const: relationships.SQL_SERVER_HAS_AD_ADMIN._type }, }, }, }); }
Creativice-Oy/graph-azure
src/steps/resource-manager/databases/sql/index.test.ts
TypeScript
FunctionDeclaration
/* * Copyright (C) 2017, 2018 TypeFox and others. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 */ export function findPathToModule(dir: string, moduleName: string): string|undefined { try { return require.resolve(moduleName, { paths: [dir] }); } catch { return undefined; } }
apexskier/typescript-language-server
server/src/modules-resolver.ts
TypeScript
ArrowFunction
(jwt:JWTAuth) => { LogUtil.debug('LoginModalComponent jwtUpdated$', jwt); if (jwt) { if (jwt.status != 200) { this.authError = jwt.message || 'MODAL_LOGIN_FAILED_AUTH'; UserEventBus.getUserEventBus().emit(null); } else { let refreshInMs = (jwt.decoded.exp - jwt.decoded.iat) * 1000 - this.userTokenRefreshBufferMs; LogUtil.debug('LoginModalComponent refreshInMs', refreshInMs, this.userTokenRefreshBufferMs); Futures.once(function() { if (UserEventBus.getUserEventBus().currentJWT() != null) { if (UserEventBus.getUserEventBus().currentActive()) { LogUtil.debug('LoginModalComponent refreshing token'); let _sub = that._managementService.refreshToken().subscribe(jwt => { _sub.unsubscribe(); LogUtil.debug('LoginModalComponent refreshing token', jwt); }); } else { LogUtil.debug('LoginModalComponent NOT refreshing token, user not active'); that.authError = 'AUTH_TOKEN_EXPIRED'; UserEventBus.getUserEventBus().emit(null); } } // else user is not available, no refresh possible }, refreshInMs).delay(); let _sub:any = this._managementService.getMyUI().subscribe( myui => { LogUtil.debug('LoginModalComponent loading ui', myui); _sub.unsubscribe(); let _sub2:any = this._managementService.getMyself().subscribe( myself => { LogUtil.debug('LoginModalComponent loading user', myself); UserEventBus.getUserEventBus().emit(myself); _sub2.unsubscribe(); }); let _sub3:any = this._shopService.getAllShops().subscribe( allshops => { LogUtil.debug('LoginModalComponent loading user shops', allshops); ShopEventBus.getShopEventBus().emitAll(allshops); _sub3.unsubscribe(); if (this._router.isActive('', true) || this._router.isActive('index.html', true)) { this._router.navigate(['/dashboard']); } // else stay on same page }); }); } } }
isabella232/yes-cart
manager/jam-jsclient/src/main/typescript/src/client/app/shared/auth/login-modal.component.ts
TypeScript
ArrowFunction
jwt => { _sub.unsubscribe(); LogUtil.debug('LoginModalComponent refreshing token', jwt); }
isabella232/yes-cart
manager/jam-jsclient/src/main/typescript/src/client/app/shared/auth/login-modal.component.ts
TypeScript
ArrowFunction
myui => { LogUtil.debug('LoginModalComponent loading ui', myui); _sub.unsubscribe(); let _sub2:any = this._managementService.getMyself().subscribe( myself => { LogUtil.debug('LoginModalComponent loading user', myself); UserEventBus.getUserEventBus().emit(myself); _sub2.unsubscribe(); }); let _sub3:any = this._shopService.getAllShops().subscribe( allshops => { LogUtil.debug('LoginModalComponent loading user shops', allshops); ShopEventBus.getShopEventBus().emitAll(allshops); _sub3.unsubscribe(); if (this._router.isActive('', true) || this._router.isActive('index.html', true)) { this._router.navigate(['/dashboard']); } // else stay on same page }); }
isabella232/yes-cart
manager/jam-jsclient/src/main/typescript/src/client/app/shared/auth/login-modal.component.ts
TypeScript
ArrowFunction
myself => { LogUtil.debug('LoginModalComponent loading user', myself); UserEventBus.getUserEventBus().emit(myself); _sub2.unsubscribe(); }
isabella232/yes-cart
manager/jam-jsclient/src/main/typescript/src/client/app/shared/auth/login-modal.component.ts
TypeScript
ArrowFunction
allshops => { LogUtil.debug('LoginModalComponent loading user shops', allshops); ShopEventBus.getShopEventBus().emitAll(allshops); _sub3.unsubscribe(); if (this._router.isActive('', true) || this._router.isActive('index.html', true)) { this._router.navigate(['/dashboard']); } // else stay on same page }
isabella232/yes-cart
manager/jam-jsclient/src/main/typescript/src/client/app/shared/auth/login-modal.component.ts
TypeScript
ArrowFunction
cmd => { LogUtil.debug('LoginModalComponent commandUpdated$', cmd); switch (cmd) { case 'login': this.showLoginModal(); break; case 'logout': let _logout = this._managementService.logoff().subscribe(res => { this._router.navigate(['']); _logout.unsubscribe(); }); break; case 'changepassword': this.showLoginModal(true); break; } }
isabella232/yes-cart
manager/jam-jsclient/src/main/typescript/src/client/app/shared/auth/login-modal.component.ts
TypeScript
ArrowFunction
res => { this._router.navigate(['']); _logout.unsubscribe(); }
isabella232/yes-cart
manager/jam-jsclient/src/main/typescript/src/client/app/shared/auth/login-modal.component.ts
TypeScript
ArrowFunction
(resume:JWTAuth) => { LogUtil.debug('LoginModalComponent showLoginModal firstLoad resume', resume); _resume.unsubscribe(); if (resume && resume.status == 200) { this.loginModalDialog.cancelAction(); } }
isabella232/yes-cart
manager/jam-jsclient/src/main/typescript/src/client/app/shared/auth/login-modal.component.ts
TypeScript
ArrowFunction
event => { LogUtil.debug('LoginModalComponent login event', event); if (event === null) { let that = this; Futures.once(function() { that.showLoginModal(that.authError == 'AUTH_CREDENTAILS_EXPIRED'); }, 200).delay(); } else { this._login = { username : event.manager.email, password : null, organisation: event.manager.companyName1 }; this.authError = null; } }
isabella232/yes-cart
manager/jam-jsclient/src/main/typescript/src/client/app/shared/auth/login-modal.component.ts
TypeScript
ArrowFunction
change => { this.loading = false; _sub.unsubscribe(); LogUtil.debug('LoginModalComponent onLoginResult change pass', change); this._login.password = null; this._login.npassword = null; this._login.cpassword = null; if (change.status == 200) { this.authError = null; this.changePasswordSuccess = true; this.changePassword = false; UserEventBus.getUserEventBus().emitJWT(null); UserEventBus.getUserEventBus().emit(null); } else { this.authError = change.error; this.showLoginModal(true); } }
isabella232/yes-cart
manager/jam-jsclient/src/main/typescript/src/client/app/shared/auth/login-modal.component.ts
TypeScript
ArrowFunction
jwt => { this.loading = false; this.authError = null; this._login.password = null; _sub.unsubscribe(); if (jwt == null || jwt.status != 200) { LogUtil.debug('LoginModalComponent onLoginResult auth failed'); } }
isabella232/yes-cart
manager/jam-jsclient/src/main/typescript/src/client/app/shared/auth/login-modal.component.ts
TypeScript
MethodDeclaration
formBind():void { UiUtil.formBind(this, 'loginForm', 'delayedChange'); }
isabella232/yes-cart
manager/jam-jsclient/src/main/typescript/src/client/app/shared/auth/login-modal.component.ts
TypeScript
MethodDeclaration
formUnbind():void { UiUtil.formUnbind(this, 'loginForm'); }
isabella232/yes-cart
manager/jam-jsclient/src/main/typescript/src/client/app/shared/auth/login-modal.component.ts
TypeScript
MethodDeclaration
formChange():void { LogUtil.debug('LoginModalComponent formChange', this.loginForm.valid, this.login); this.changed = this.loginForm.dirty; this.validForSave = this.loginForm.valid; }
isabella232/yes-cart
manager/jam-jsclient/src/main/typescript/src/client/app/shared/auth/login-modal.component.ts
TypeScript
MethodDeclaration
ngOnInit() { this.formBind(); LogUtil.debug('LoginModalComponent ngOnInit'); }
isabella232/yes-cart
manager/jam-jsclient/src/main/typescript/src/client/app/shared/auth/login-modal.component.ts
TypeScript
MethodDeclaration
ngOnDestroy() { LogUtil.debug('LoginModalComponent ngOnDestroy'); if (this.userSub) { this.userSub.unsubscribe(); } if (this.cmdSub) { this.cmdSub.unsubscribe(); } this.formUnbind(); }
isabella232/yes-cart
manager/jam-jsclient/src/main/typescript/src/client/app/shared/auth/login-modal.component.ts
TypeScript
MethodDeclaration
showLoginModal(changePassword:boolean = false) { LogUtil.debug('LoginModalComponent showLoginModal', changePassword); if (this.loginModalDialog) { this.loading = false; this.changePassword = changePassword; let user = UserEventBus.getUserEventBus().current(); LogUtil.debug('LoginModalComponent showLoginModal', changePassword, user); if (user != null) { this._login.username = user.manager.email; } else { this._login.username = ''; } this._login.password = null; this.loginModalDialog.show(); if (this.firstLoad) { this.firstLoad = false; let _resume = this._managementService.attemptResume().subscribe((resume:JWTAuth) => { LogUtil.debug('LoginModalComponent showLoginModal firstLoad resume', resume); _resume.unsubscribe(); if (resume && resume.status == 200) { this.loginModalDialog.cancelAction(); } }); } } }
isabella232/yes-cart
manager/jam-jsclient/src/main/typescript/src/client/app/shared/auth/login-modal.component.ts
TypeScript
MethodDeclaration
ngAfterViewInit() { LogUtil.debug('LoginModalComponent ngAfterViewInit'); // Here you get a reference to the modal so you can control it programmatically this.userSub = UserEventBus.getUserEventBus().userUpdated$.subscribe(event => { LogUtil.debug('LoginModalComponent login event', event); if (event === null) { let that = this; Futures.once(function() { that.showLoginModal(that.authError == 'AUTH_CREDENTAILS_EXPIRED'); }, 200).delay(); } else { this._login = { username : event.manager.email, password : null, organisation: event.manager.companyName1 }; this.authError = null; } }); }
isabella232/yes-cart
manager/jam-jsclient/src/main/typescript/src/client/app/shared/auth/login-modal.component.ts
TypeScript
MethodDeclaration
protected onLoginResult(modalresult: ModalResult) { LogUtil.debug('LoginModalComponent onLoginResult modal result is ', modalresult); if (ModalAction.POSITIVE === modalresult.action) { this.loading = true; this.validForSave = false; this.changePasswordSuccess = false; if (this.changePassword) { let _sub = this._managementService.changePassword(this._login.username, this._login.password, this._login.npassword, this._login.cpassword).subscribe(change => { this.loading = false; _sub.unsubscribe(); LogUtil.debug('LoginModalComponent onLoginResult change pass', change); this._login.password = null; this._login.npassword = null; this._login.cpassword = null; if (change.status == 200) { this.authError = null; this.changePasswordSuccess = true; this.changePassword = false; UserEventBus.getUserEventBus().emitJWT(null); UserEventBus.getUserEventBus().emit(null); } else { this.authError = change.error; this.showLoginModal(true); } }); } else { let _sub = this._managementService.login(this._login.username, this._login.password, this._login.organisation).subscribe(jwt => { this.loading = false; this.authError = null; this._login.password = null; _sub.unsubscribe(); if (jwt == null || jwt.status != 200) { LogUtil.debug('LoginModalComponent onLoginResult auth failed'); } }); } } else if (UserEventBus.getUserEventBus().current() == null) { this.showLoginModal(); } }
isabella232/yes-cart
manager/jam-jsclient/src/main/typescript/src/client/app/shared/auth/login-modal.component.ts
TypeScript
ClassDeclaration
@Injectable() export class JwtAuthGuard extends AuthGuard('jwt-strategy') { canActivate(context: ExecutionContext) { return super.canActivate(context); } handleRequest(err, user, info) { if (info instanceof TokenExpiredError) { throw new ForbiddenException( 'tokenExpired', StatusCodesList.TokenExpired ); } if (err || !user) { throw err || new UnauthorizedException(); } return user; } }
gobeam/truthy
src/common/guard/jwt-auth.guard.ts
TypeScript
MethodDeclaration
canActivate(context: ExecutionContext) { return super.canActivate(context); }
gobeam/truthy
src/common/guard/jwt-auth.guard.ts
TypeScript
MethodDeclaration
handleRequest(err, user, info) { if (info instanceof TokenExpiredError) { throw new ForbiddenException( 'tokenExpired', StatusCodesList.TokenExpired ); } if (err || !user) { throw err || new UnauthorizedException(); } return user; }
gobeam/truthy
src/common/guard/jwt-auth.guard.ts
TypeScript
ArrowFunction
(feature: google.maps.Data.Feature) => { console.log(feature.getId()); }
TaeKimJR/DefinitelyTyped
types/googlemaps/googlemaps-tests.ts
TypeScript
ArrowFunction
features => { for (let i = 0, len = features.length; i < len; i++) { console.log(features[i].getId()); } }
TaeKimJR/DefinitelyTyped
types/googlemaps/googlemaps-tests.ts
TypeScript
ArrowFunction
feature => {}
TaeKimJR/DefinitelyTyped
types/googlemaps/googlemaps-tests.ts
TypeScript
ArrowFunction
latLng => console.log(`${latLng.lat} ${latLng.lng}`)
TaeKimJR/DefinitelyTyped
types/googlemaps/googlemaps-tests.ts
TypeScript
ArrowFunction
event => {}
TaeKimJR/DefinitelyTyped
types/googlemaps/googlemaps-tests.ts
TypeScript
ArrowFunction
event => { event; // $ExpectType MouseEvent }
TaeKimJR/DefinitelyTyped
types/googlemaps/googlemaps-tests.ts
TypeScript
ArrowFunction
(data, status) => { if (status === google.maps.StreetViewStatus.OK) { const location_pano = (data == null || data.location == null) ? null : data.location.pano; if (location_pano == null) { // Not good return; } const new_panorama = new google.maps.StreetViewPanorama(document.createElement('div'), panoramaOptions); new_panorama.setPano(location_pano); new_panorama.setPov({ heading: 0, pitch: 0 }); } }
TaeKimJR/DefinitelyTyped
types/googlemaps/googlemaps-tests.ts
TypeScript
ArrowFunction
(elem: string, i: number): void => { elem.toUpperCase(); }
TaeKimJR/DefinitelyTyped
types/googlemaps/googlemaps-tests.ts
TypeScript
ArrowFunction
(result, status) => { if (status === google.maps.places.PlacesServiceStatus.NOT_FOUND) { return; } result.name; // $ExpectType string }
TaeKimJR/DefinitelyTyped
types/googlemaps/googlemaps-tests.ts
TypeScript
ArrowFunction
(results, status) => { if (status === google.maps.places.PlacesServiceStatus.ERROR) { return; } results[0].name; // $ExpectType string }
TaeKimJR/DefinitelyTyped
types/googlemaps/googlemaps-tests.ts
TypeScript
ArrowFunction
(tileCoord: google.maps.Point, zoom: number) => 'string'
TaeKimJR/DefinitelyTyped
types/googlemaps/googlemaps-tests.ts
TypeScript
ClassDeclaration
class Overlay extends google.maps.OverlayView { draw(): void { const panes = this.getPanes(); panes.floatPane.appendChild(div); panes.mapPane.appendChild(div); panes.markerLayer.appendChild(div); panes.overlayLayer.appendChild(div); panes.overlayMouseTarget.appendChild(div); } }
TaeKimJR/DefinitelyTyped
types/googlemaps/googlemaps-tests.ts
TypeScript
MethodDeclaration
draw(): void { const panes = this.getPanes(); panes.floatPane.appendChild(div); panes.mapPane.appendChild(div); panes.markerLayer.appendChild(div); panes.overlayLayer.appendChild(div); panes.overlayMouseTarget.appendChild(div); }
TaeKimJR/DefinitelyTyped
types/googlemaps/googlemaps-tests.ts
TypeScript
ClassDeclaration
export declare class Calla extends TypedEventBase<CallaClientEvents> implements ICombinedClient, IDisposable { private _fetcher; private _tele; private _meta; isAudioMuted: boolean; isVideoMuted: boolean; constructor(_fetcher: IFetcher, _tele: ITeleconferenceClientExt, _meta: IMetadataClientExt); get connectionState(): ConnectionState; get conferenceState(): ConnectionState; get fetcher(): IFetcher; get tele(): ITeleconferenceClient; get meta(): IMetadataClient; get audio(): AudioManager; get devices(): DeviceManager; private disposed; dispose(): void; get offsetRadius(): number; set offsetRadius(v: number); setLocalPose(px: number, py: number, pz: number, fx: number, fy: number, fz: number, ux: number, uy: number, uz: number): void; tellLocalPose(toUserID: string, px: number, py: number, pz: number, fx: number, fy: number, fz: number, ux: number, uy: number, uz: number): void; setLocalPointer(name: string, px: number, py: number, pz: number, fx: number, fy: number, fz: number, ux: number, uy: number, uz: number): void; setAvatarEmoji(toUserID: string, emoji: string): void; setAvatarURL(toUserID: string, url: string): void; emote(emoji: string): void; chat(text: string): void; toggleAudioMuted(): Promise<boolean>; toggleVideoMuted(): Promise<boolean>; getAudioMuted(): Promise<boolean>; getVideoMuted(): Promise<boolean>; get metadataState(): ConnectionState; get localUserID(): string; get localUserName(): string; get roomName(): string; userExists(id: string): boolean; getUserNames(): string[][]; connect(): Promise<void>; join(roomName: string, enableTeleconference: boolean): Promise<void>; identify(userName: string): Promise<void>; leave(): Promise<void>; disconnect(): Promise<void>; setAudioOutputDevice(device: MediaDeviceInfo): Promise<void>; setAudioMuted(muted: boolean): Promise<boolean>; setVideoMuted(muted: boolean): Promise<boolean>; get startDevicesImmediately(): boolean; get localAudioInput(): GainNode; get localAudioOutput(): GainNode; get useHalfDuplex(): boolean; set useHalfDuplex(v: boolean); get halfDuplexMin(): number; set halfDuplexMin(v: number); get halfDuplexMax(): number; set halfDuplexMax(v: number); get halfDuplexThreshold(): number; set halfDuplexThreshold(v: number); get halfDuplexAttack(): number; set halfDuplexAttack(v: number); get halfDuplexDecay(): number; set halfDuplexDecay(v: number); get halfDuplexSustain(): number; set halfDuplexSustain(v: number); get halfDuplexHold(): number; set halfDuplexHold(v: number); get halfDuplexRelease(): number; set halfDuplexRelease(v: number); get halfDuplexLevel(): number; get remoteActivityLevel(): number; }
TommyTeaVee/Calla
Calla/Calla.d.ts
TypeScript
EnumDeclaration
export declare enum ClientState { InConference = "in-conference", JoiningConference = "joining-conference", Connected = "connected", Connecting = "connecting", Prepaired = "prepaired", Prepairing = "prepairing", Unprepared = "unprepaired" }
TommyTeaVee/Calla
Calla/Calla.d.ts
TypeScript
MethodDeclaration
setLocalPose(px: number, py: number, pz: number, fx: number, fy: number, fz: number, ux: number, uy: number, uz: number): void;
TommyTeaVee/Calla
Calla/Calla.d.ts
TypeScript
MethodDeclaration
tellLocalPose(toUserID: string, px: number, py: number, pz: number, fx: number, fy: number, fz: number, ux: number, uy: number, uz: number): void;
TommyTeaVee/Calla
Calla/Calla.d.ts
TypeScript
MethodDeclaration
setLocalPointer(name: string, px: number, py: number, pz: number, fx: number, fy: number, fz: number, ux: number, uy: number, uz: number): void;
TommyTeaVee/Calla
Calla/Calla.d.ts
TypeScript
MethodDeclaration
setAvatarEmoji(toUserID: string, emoji: string): void;
TommyTeaVee/Calla
Calla/Calla.d.ts
TypeScript
MethodDeclaration
setAvatarURL(toUserID: string, url: string): void;
TommyTeaVee/Calla
Calla/Calla.d.ts
TypeScript
MethodDeclaration
emote(emoji: string): void;
TommyTeaVee/Calla
Calla/Calla.d.ts
TypeScript
MethodDeclaration
chat(text: string): void;
TommyTeaVee/Calla
Calla/Calla.d.ts
TypeScript
MethodDeclaration
toggleAudioMuted(): Promise<boolean>;
TommyTeaVee/Calla
Calla/Calla.d.ts
TypeScript