repo_name stringlengths 5 122 | path stringlengths 3 232 | text stringlengths 6 1.05M |
|---|---|---|
barouchmaximedenoun/similarweb | src/components/VideoSearch.tsx | <gh_stars>0
import React, { useState, useMemo, useEffect } from 'react'
import TextField from '@material-ui/core/TextField';
import Autocomplete from '@material-ui/lab/Autocomplete';
import YouTubeIcon from '@material-ui/icons/YouTube';
import Grid from '@material-ui/core/Grid';
import { makeStyles } from '@material-ui... |
barouchmaximedenoun/similarweb | src/Main/Main.tsx | import React from "react";
import CssBaseline from "@material-ui/core/CssBaseline";
import Dashboard from "../components/Dashboard";
import { Providers } from "./Providers";
const Main: React.FC<{}> = (): React.ReactElement => (
<Providers>
<CssBaseline />
<Dashboard />
</Providers>
);
export default Main |
barouchmaximedenoun/similarweb | src/Main/types.ts | export interface VideoSharedMessage {
title: string;
videoId: string;
}
export enum VideoSharedMsgEvent {
ADD_VIDEO_MESSAGE = 'add-video',
ADDED_VIDEO_MESSAGE = 'added-video',
REMOVE_VIDEO_MESSAGE = 'remove-video',
REMOVED_VIDEO_MESSAGE = 'removed-video',
END_VIDEO_MESSAGE = 'end-video'
}
|
barouchmaximedenoun/similarweb | server/src/Server.ts | import path from 'path';
import express from 'express';
import { createServer, Server } from 'http';
import bodyParser from 'body-parser';
import cors from 'cors';
import { VideoSharedMsgServer } from './VideoSharedMsgServer';
class NodeServer {
public static readonly PORT: number = 3001;
public static readonl... |
barouchmaximedenoun/similarweb | src/components/Dashboard.tsx | import React, { useCallback, useEffect, useState } from 'react';
import qs from 'querystring';
import VideoSearch from './VideoSearch';
import YouTube, { Options } from 'react-youtube';
import axios from 'axios-jsonp-pro';
import YouTubeIcon from '@material-ui/icons/YouTube';
import { VideoSharedMessage } from '../Mai... |
barouchmaximedenoun/similarweb | src/Main/SocketService.ts | import SocketIOClient from 'socket.io-client';
import { VideoSharedMessage, VideoSharedMsgEvent } from './types';
import { fromEvent, Observable } from 'rxjs';
const SERVER_URL = 'http://localhost:3001';
export class SocketService {
private socket: SocketIOClient.Socket = {} as SocketIOClient.Socket;
public init ... |
barouchmaximedenoun/similarweb | src/themes/light.tsx | import { createMuiTheme } from "@material-ui/core/styles";
export const lightTheme = createMuiTheme({
palette: {
primary: {
main: "#4eb8ea",
contrastText: "#ffffff",
},
},
overrides: {},
props: {},
});
|
Laul0/SPSToronto-Github-Presentation | src/webparts/spsTorontoWebPart/components/ISpsTorontoWebPartProps.ts | <reponame>Laul0/SPSToronto-Github-Presentation
export interface ISpsTorontoWebPartProps {
description: string;
}
|
byte-pushers/bytepushers-js-oop | src/main/javascript/software.bytepushers.oop.d.ts | <reponame>byte-pushers/bytepushers-js-oop
/**
* Created by tonte on 2/5/18.
*/
declare module MBytePushers {
export interface Main {
implementsInterface(object:any):boolean;
namespace(ns:string):Object;
inherit(prototype:Object):Object;
defineClass(classConfig:Object):Function;
... |
sadohert/mattermost-webapp | components/global/history_buttons/history_buttons.tsx | <filename>components/global/history_buttons/history_buttons.tsx
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import React from 'react';
import styled from 'styled-components';
import IconButton from '@mattermost/compass-components/components/icon-butto... |
sadohert/mattermost-webapp | components/purchase_modal/purchase_modal.tsx | <gh_stars>0
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import React, {ReactNode} from 'react';
import {FormattedMessage} from 'react-intl';
import {Stripe, StripeCardElementChangeEvent} from '@stripe/stripe-js';
import {loadStripe} from '@stripe/stri... |
sadohert/mattermost-webapp | components/global/global_header.tsx | <reponame>sadohert/mattermost-webapp
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import React, {useEffect} from 'react';
import {useSelector} from 'react-redux';
import styled from 'styled-components';
import StatusDropdown from 'components/status_d... |
sadohert/mattermost-webapp | components/global/product_switcher.tsx | // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import React, {useRef, useState} from 'react';
import {FormattedMessage} from 'react-intl';
import {Link} from 'react-router-dom';
import styled from 'styled-components';
import IconButton from '@mattermost/... |
sadohert/mattermost-webapp | selectors/global_header.ts | // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import Constants from 'utils/constants';
import {get} from 'mattermost-redux/selectors/entities/preferences';
import {GlobalState} from 'types/store';
import {getFeatureFlagValue} from 'mattermost-redux/sele... |
Manny2296/NestjsGocar | src/solicitud/solicitud.entity.ts | <reponame>Manny2296/NestjsGocar<filename>src/solicitud/solicitud.entity.ts<gh_stars>0
import { Entity, PrimaryGeneratedColumn, Column, OneToMany, ManyToMany, JoinTable } from "typeorm";
@Entity()
export class Solicitud {
@PrimaryGeneratedColumn()
id_solicitud:number;
@Column()
id_cliente:number;
@C... |
Manny2296/NestjsGocar | src/conductor/conductor.entity.spec.ts | <gh_stars>0
import { ConductorEntity } from './conductor.entity';
describe('ConductorEntity', () => {
it('should be defined', () => {
expect(new ConductorEntity()).toBeDefined();
});
});
|
Manny2296/NestjsGocar | src/metodopago/metodopago.controller.spec.ts | <filename>src/metodopago/metodopago.controller.spec.ts<gh_stars>0
import { Test, TestingModule } from '@nestjs/testing';
import { MetodopagoController } from './metodopago.controller';
describe('Metodopago Controller', () => {
let controller: MetodopagoController;
beforeEach(async () => {
const module: Testin... |
Manny2296/NestjsGocar | src/metodopago/metodopago.entity.ts | import { Entity, PrimaryGeneratedColumn, Column, OneToMany, ManyToMany, JoinTable } from "typeorm";
@Entity()
export class Metodopago {
@PrimaryGeneratedColumn()
id_metodo:number;
@Column()
id_cliente:number;
@Column()
tipo:string;
@Column('bigint')
ntarjeta:number;
@Column()
... |
Manny2296/NestjsGocar | src/solicitud/solicitud.entity.spec.ts | <gh_stars>0
import { SolicitudEntity } from './solicitud.entity';
describe('SolicitudEntity', () => {
it('should be defined', () => {
expect(new SolicitudEntity()).toBeDefined();
});
});
|
Manny2296/NestjsGocar | src/conductor/conductor.module.ts | import { Module } from '@nestjs/common';
@Module({})
export class ConductorModule {}
|
Manny2296/NestjsGocar | src/solicitud/solicitud.controller.ts | import { Controller } from '@nestjs/common';
@Controller('solicitud')
export class SolicitudController {}
|
Manny2296/NestjsGocar | src/conductor/conductor.controller.ts | import { Controller } from '@nestjs/common';
@Controller('conductor')
export class ConductorController {}
|
Manny2296/NestjsGocar | src/conductor/conductor.entity.ts | import { Entity, PrimaryGeneratedColumn, Column, OneToMany, ManyToMany, JoinTable } from "typeorm";
@Entity()
export class Conductor {
@PrimaryGeneratedColumn()
id_conductor:number;
@Column()
nombre:string;
@Column()
apellido:string;
@Column()
tipo_servicio:string;
@Column('bigint')... |
Manny2296/NestjsGocar | src/metodopago/metodopago.entity.spec.ts | <reponame>Manny2296/NestjsGocar
import { MetodopagoEntity } from './metodopago.entity';
describe('MetodopagoEntity', () => {
it('should be defined', () => {
expect(new MetodopagoEntity()).toBeDefined();
});
});
|
Manny2296/NestjsGocar | src/app.module.ts | import { Module } from '@nestjs/common';
import { AppController } from './app.controller';
import { AppService } from './app.service';
import { ClienteController } from './cliente/cliente.controller';
import { ClienteService } from './cliente/cliente.service';
import { ClienteModule } from './cliente/cliente.module';
i... |
Manny2296/NestjsGocar | src/metodopago/metodopago.service.ts | import { Injectable } from '@nestjs/common';
@Injectable()
export class MetodopagoService {}
|
Manny2296/NestjsGocar | src/conductor/conductor.controller.spec.ts | <reponame>Manny2296/NestjsGocar<gh_stars>0
import { Test, TestingModule } from '@nestjs/testing';
import { ConductorController } from './conductor.controller';
describe('Conductor Controller', () => {
let controller: ConductorController;
beforeEach(async () => {
const module: TestingModule = await Test.create... |
Manny2296/NestjsGocar | src/conductor/conductor.service.ts | import { Injectable } from '@nestjs/common';
@Injectable()
export class ConductorService {}
|
Manny2296/NestjsGocar | src/metodopago/metodopago.controller.ts | <filename>src/metodopago/metodopago.controller.ts
import { Controller } from '@nestjs/common';
@Controller('metodopago')
export class MetodopagoController {}
|
skhanhub/currency | client/src/components/DateForm.tsx | // Import necessary libraries
import React from 'react';
import Form from 'react-bootstrap/Form'
import Col from 'react-bootstrap/Col'
import Select from 'react-select'
import './slider.css'
const customStyles = {
option: (provided: any) => ({
...provided,
borderBottom: '1px dotted pink',
color: 'black',... |
skhanhub/currency | client/src/App.tsx | <filename>client/src/App.tsx<gh_stars>0
import React, {useState, useEffect} from 'react';
import Container from 'react-bootstrap/Container'
import Row from 'react-bootstrap/Row'
import Col from 'react-bootstrap/Col'
import './App.css';
import DateForm from './components/DateForm';
import ProfitTable from './components/... |
skhanhub/currency | server/test/services/profitAnalyser.test.ts | <reponame>skhanhub/currency<gh_stars>0
'use struct';
// Import necessary libraries
import * as chai from 'chai';
import ProfitAnalyser from "../../src/services/profitAnalyser"
// Use expect from chai for assertion
const expect = chai.expect;
// Fake data for the test
const currencies: Array<Object> = [
{"date": "2018... |
kathesama/gaugemeter-app | frontend/src/app/model/Medicion.ts | export class Medicion{
private _fecha: Date;
private _valor: number;
private _dispositivoId: string;
constructor(fecha, valor, dispositivoId){
this._fecha=fecha;
this._valor=valor;
this._dispositivoId=dispositivoId;
}
public get fecha(): Date {
return this.... |
kathesama/gaugemeter-app | frontend/src/app/model/Dispositivo.ts | export class Dispositivo{
private _uuid: string;
private _nombre: string;
private _ubicacion: string;
private _electrovalvulaId: string;
constructor(uuid: string, nombre: string, ubicacion: string, electrovalvulaId: string){
this._uuid= uuid;
this._nombre= nombre;
this._ubi... |
kathesama/gaugemeter-app | frontend/src/app/home/home.page.ts | import { Component } from '@angular/core';
import { Dispositivo } from '../model/Dispositivo';
import { DispositivoService } from '../services/dispositivo.service';
@Component({
selector: 'app-home',
templateUrl: 'home.page.html',
styleUrls: ['home.page.scss'],
})
export class HomePage {
listadoDispositivo: a... |
kathesama/gaugemeter-app | frontend/src/app/dispositivo/dispositivo.page.ts | import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { Dispositivo } from '../model/Dispositivo';
import { DispositivoService } from '../services/dispositivo.service';
import { Log } from '../model/Log';
import { LogRiegoService } from '../services/logRiego.service... |
kathesama/gaugemeter-app | frontend/src/app/services/logRiego.service.ts | import { HttpClient, HttpHeaders } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Log } from '../model/Log';
@Injectable({
providedIn: 'root'
})
export class LogRiegoService {
urlApi = "http://localhost:8051/api/v1";
headers = {
headers: new HttpHeaders().set('Accept-Langua... |
kathesama/gaugemeter-app | frontend/src/app/dispositivo/dispositivo.module.ts | <reponame>kathesama/gaugemeter-app
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { IonicModule } from '@ionic/angular';
import { DispositivoPageRoutingModule } from './dispositivo-routing.module';
import { DispositivoPag... |
kathesama/gaugemeter-app | frontend/src/app/services/ionLoader.service.ts | <filename>frontend/src/app/services/ionLoader.service.ts
import { Injectable } from '@angular/core';
import { LoadingController } from '@ionic/angular';
@Injectable({
providedIn: 'root'
})
export class IonLoaderService {
constructor(public loadingController: LoadingController) { }
// Simple loader
simpleLoa... |
kathesama/gaugemeter-app | frontend/src/app/pipes/unidad.pipe.ts | import { Pipe, PipeTransform } from '@angular/core';
@Pipe({
name: 'unidad'
})
export class UnidadPipe implements PipeTransform {
transform(value: string): string {
return (value + ' kPA');
}
}
|
kathesama/gaugemeter-app | frontend/src/app/pipes/actuador.pipe.ts | <filename>frontend/src/app/pipes/actuador.pipe.ts
import { Pipe, PipeTransform } from '@angular/core';
@Pipe({
name: 'actuador'
})
export class ActuadorPipe implements PipeTransform {
transform(value: number): string {
return value === 1 ? 'On' : 'Off';
}
}
|
kathesama/gaugemeter-app | frontend/src/app/services/dispositivo.service.ts | <filename>frontend/src/app/services/dispositivo.service.ts<gh_stars>0
import { HttpClient, HttpHeaders } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Dispositivo } from '../model/Dispositivo';
@Injectable({
providedIn: 'root'
})
export class DispositivoService {
urlApi = "http:... |
kathesama/gaugemeter-app | frontend/src/app/services/medicion.service.ts | <reponame>kathesama/gaugemeter-app<filename>frontend/src/app/services/medicion.service.ts
import { HttpClient, HttpHeaders } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Log } from '../model/Log';
import { Medicion } from '../model/Medicion';
@Injectable({
providedIn: 'root'
})
e... |
kathesama/gaugemeter-app | frontend/src/app/pipes/actuador.pipe.spec.ts | import { ActuadorPipe } from './actuador.pipe';
describe('ActuadorPipe', () => {
it('create an instance', () => {
const pipe = new ActuadorPipe();
expect(pipe).toBeTruthy();
});
});
|
kathesama/gaugemeter-app | frontend/src/app/model/Log.ts | export class Log{
private _fecha: Date;
private _apertura: number;
private _electrovalvulaId: string;
constructor(fecha, apertura, electrovalvulaId){
this._fecha=fecha;
this._apertura=apertura;
this._electrovalvulaId=electrovalvulaId;
}
get fecha(): Date {
... |
kathesama/gaugemeter-app | frontend/src/app/pipes/unidad.pipe.spec.ts | <gh_stars>0
import { UnidadPipe } from './unidad.pipe';
describe('UnidadPipe', () => {
it('create an instance', () => {
const pipe = new UnidadPipe();
expect(pipe).toBeTruthy();
});
});
|
KONAPAVANKUMAR/shopping-angular-frontend | src/app/order/order.component.ts | import { Component, OnInit } from '@angular/core';
import { orders } from '../orders';
import { User } from '../user';
@Component({
selector: 'app-order',
templateUrl: './order.component.html',
styleUrls: ['./order.component.css','../app.bootstrap.css']
})
export class OrderComponent implements OnInit {
orde... |
KONAPAVANKUMAR/shopping-angular-frontend | src/app/orders.ts | <reponame>KONAPAVANKUMAR/shopping-angular-frontend
import { Product } from "./productsmodel";
export class Order{
products: Product[] = [];
constructor(products:Product[]){
this.products = products;
}
}
export const orders : Order[] = [
]
|
KONAPAVANKUMAR/shopping-angular-frontend | src/app/user.ts |
export class User{
static balance : number = 50;
} |
KONAPAVANKUMAR/shopping-angular-frontend | src/app/products.ts | <filename>src/app/products.ts<gh_stars>0
import { Product } from "./productsmodel";
export const Products: Product[] = [
{name : 'book',price : 20},
{name : 'pen',price : 10},
{name : 'eraser',price : 5},
{name : 'refil',price : 10},
{name : 'sharpner',price : 5},
{name : 'pencil',price : 5},
... |
KONAPAVANKUMAR/shopping-angular-frontend | src/app/cart.ts | import { Product } from "./productsmodel";
export const cartItems : Product[] = [
] |
KONAPAVANKUMAR/shopping-angular-frontend | src/app/app-routing.module.ts | <gh_stars>0
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { ProductsComponent } from './products/products.component'
import { CartComponent } from './cart/cart.component'
import { OrderComponent } from './order/order.component';
import { InsufficientfundsCompon... |
KONAPAVANKUMAR/shopping-angular-frontend | src/app/insufficientfunds/insufficientfunds.component.ts | import { Component, OnInit } from '@angular/core';
import { User } from '../user';
@Component({
selector: 'app-insufficientfunds',
templateUrl: './insufficientfunds.component.html',
styleUrls: ['./insufficientfunds.component.css','../app.bootstrap.css']
})
export class InsufficientfundsComponent implements OnIni... |
KONAPAVANKUMAR/shopping-angular-frontend | src/app/products/products.component.ts | import { Component, OnInit } from '@angular/core';
import { cartItems } from '../cart';
import { Products } from '../products'
import { Product } from '../productsmodel';
import { User } from '../user';
@Component({
selector: 'app-products',
templateUrl: './products.component.html',
styleUrls: ['./products.compo... |
KONAPAVANKUMAR/shopping-angular-frontend | src/app/cart/cart.component.ts | <reponame>KONAPAVANKUMAR/shopping-angular-frontend<filename>src/app/cart/cart.component.ts
import { Injectable } from '@angular/core';
import { Component, OnInit } from '@angular/core';
import { Router } from '@angular/router';
import { cartItems } from '../cart';
import { orders } from '../orders';
import { Order } fr... |
shifatullah/shoestore-admin-angular | src/app/clients/identity.client.ts | <filename>src/app/clients/identity.client.ts
import { Injectable } from "@angular/core";
import { HttpClient } from "@angular/common/http";
import { Observable } from "rxjs";
import { map } from "rxjs/operators";
import { HttpHeaders } from '@angular/common/http';
import { CacheService } from "../services/cache.service... |
shifatullah/shoestore-admin-angular | src/app/clients/orders.client.ts | <reponame>shifatullah/shoestore-admin-angular
import { Injectable } from "@angular/core";
import { HttpClient } from "@angular/common/http";
import { Observable } from "rxjs";
import { Order } from "../models/order.model";
import { HttpHeaders } from '@angular/common/http';
import { CacheService } from "../services/cac... |
shifatullah/shoestore-admin-angular | src/app/clients/products.client.ts | <filename>src/app/clients/products.client.ts
import { Injectable } from "@angular/core";
import { HttpClient } from "@angular/common/http";
import { Observable } from "rxjs";
import { Product } from "../models/product.model";
import { HttpHeaders } from '@angular/common/http';
import { CacheService } from "../services/... |
shifatullah/shoestore-admin-angular | src/app/products/products-list/products-list.component.ts | import { Component, OnInit } from '@angular/core';
import { Product } from "../../models/product.model";
import { ProductRepository } from "../../repositories/product.repository";
@Component({
selector: 'app-products-list',
templateUrl: './products-list.component.html',
styleUrls: ['./products-list.component.sas... |
shifatullah/shoestore-admin-angular | src/app/services/cache.service.spec.ts | <filename>src/app/services/cache.service.spec.ts
import { CacheService } from './cache.service';
describe('CacheService', () => {
it('should create an instance', () => {
expect(new CacheService()).toBeTruthy();
});
});
|
shifatullah/shoestore-admin-angular | src/app/repositories/product.repository.ts | <filename>src/app/repositories/product.repository.ts
import { Injectable } from "@angular/core";
import { Product } from "../models/product.model";
import { ProductsClient } from "../clients/products.client";
@Injectable()
export class ProductRepository {
private products: Product[] = [];
private categories: s... |
DEP-7/Front-end-skills-test-assignment | ts/main.ts | <gh_stars>0
// @ts-ignore
import $ from 'jquery';
let pageSize = calculatePageSize();
let pages: number = 1;
let selectedPage: number = 1;
$(()=>{
$('#txt-id').trigger('focus');
});
/* Add or update a row */
$('#btn-save').on('click', (eventData) => {
eventData.preventDefault();
const txtId = $('#txt-i... |
joshuawilson/vscode-yaml | src/schema-extension-api.ts | import { URI } from 'vscode-uri'
import { LanguageClient, RequestType } from 'vscode-languageclient';
import { workspace } from 'vscode';
import { logToExtensionOutputChannel } from './extension';
interface SchemaContributorProvider {
readonly requestSchema: (resource: string) => string;
readonly requestSchemaConten... |
isudnop/transaction-parser-th | src/index.ts | import { PatternMatcher, compilePattern } from './PatternMatcher'
const smsMatcherProviders: { [provider: string]: SMSMatcher[] } = {
'TrueMoney Wallet': [
// == TrueMoney ==
match(
'TrueMoney',
'ชำระเงิน {{amount:number}}บ. ให้ {{to}} คงเหลือ {{balance:number}}บ. ({{transactionId}})',
{ ty... |
isudnop/transaction-parser-th | src/PatternMatcher.ts | <filename>src/PatternMatcher.ts
import escapeStringRegexp from 'escape-string-regexp'
export type PatternMatcher = {
execute(text: string): { [k: string]: string } | null
}
export function compilePattern(pattern: string): PatternMatcher {
const regexpParts: string[] = []
const matchParts: { key: string; matcher... |
ginkgoch/node-stream-io | src/StreamReader.ts | import { ReadStream } from 'fs';
export default class StreamReader {
_readable: Promise<boolean>;
_stream: ReadStream;
_resolve?: (res: boolean) => void;
_reject?: (err: any) => void;
constructor(stream: ReadStream) {
this._readable = this._promise(this);
this._stream = stream.on('... |
ginkgoch/node-stream-io | src/index.ts | import StreamReader from './StreamReader';
import StreamWriter from './StreamWriter';
export { StreamReader, StreamWriter }; |
ginkgoch/node-stream-io | src/StreamWriter.ts | <gh_stars>1-10
import { WriteStream } from "fs";
export default class StreamWriter {
stream: WriteStream
/**
* @param {stream.Writable} stream Writable stream.
*/
constructor(stream: WriteStream) {
this.stream = stream
}
cork() {
this.stream.cork()
}
uncork() {
... |
huazai128/nest-emp2-wechat | server/errors/custom.error.ts | <gh_stars>1-10
import { ExceptionInfo } from "@app/interfaces/response.interface";
import { HttpException, HttpStatus } from "@nestjs/common";
/**
* @export
* @class CustomError
* @extends {HttpException}
* @example new CustomError({ message: 'error message' }, 400)
*/
export class CustomError extends HttpExcepti... |
huazai128/nest-emp2-wechat | src/stores/useRootStore.ts |
import { useContext } from 'react'
import { StoreContext } from '@src/components/StoreProvider'
const useRootStore = () => {
return useContext(StoreContext)
}
export default useRootStore |
huazai128/nest-emp2-wechat | src/config/config.dev.ts | <reponame>huazai128/nest-emp2-wechat<gh_stars>0
import { ConfigParams } from "@src/interfaces/config"
const config: ConfigParams = {
apiHost: 'http://172.25.230.139:3002',
wxUdbLoginDomain: '',
}
export default config |
huazai128/nest-emp2-wechat | server/interfaces/request.interface.ts | /* eslint-disable @typescript-eslint/no-namespace */
import { ConfigServer } from "./config.interface";
export interface HttpRequest {
transformUrl: string
transferData: Record<string, any>
apiTransferType?: ConfigServer['apiPrefix']
}
declare global {
// eslint-disable-next-line @typescript-eslint/n... |
huazai128/nest-emp2-wechat | server/app.env.ts | <filename>server/app.env.ts
export const environment = process.env.NODE_ENV
export const isDevEnv = Object.is(environment, 'dev')
export const isProdEnv = Object.is(environment, 'prod')
export const isTestEnv = Object.is(environment, 'test')
export default {
isDevEnv,
isProdEnv,
isTestEnv,
environment,... |
huazai128/nest-emp2-wechat | server/constants/router.constant.ts |
export const RouterWhiteList: Array<string> = [
'/login'
] |
huazai128/nest-emp2-wechat | server/modules/router/router.controller.ts | <filename>server/modules/router/router.controller.ts
import { Controller, Get, Header, Render, Req, UseGuards } from '@nestjs/common';
import { RouterGuard } from '@app/guards/router.guard';
import { Request } from 'express'
import { SessionPipe } from '@app/pipes/session.pipe';
import { QueryParams } from '@app/decora... |
huazai128/nest-emp2-wechat | src/services/api/auth.ts | import http, { HttpParams } from '@src/services/http'
function login<T>(data: HttpParams): Promise<any> {
return http.post<T>(data)
}
function getUserInfo<T>(data: HttpParams): Promise<any> {
return http.get<T>(data)
}
export default {
login,
getUserInfo,
}
|
huazai128/nest-emp2-wechat | src/interfaces/config.ts |
export interface ConfigParams {
apiHost: string
wxUdbLoginDomain: string
}
|
huazai128/nest-emp2-wechat | src/utils/common.ts | /**
* 解决图片跨域问题
* @export
* @param {string} api
* @return {*}
*/
export function imageProxy(api: string) {
return function (url: string) {
if (url != '') {
if (/^data:image\/\w+;base64,/.test(url)) {
return url
} else {
return api + encodeURICompo... |
huazai128/nest-emp2-wechat | server/modules/wechat/accessToken.service.ts | import { config } from "@app/config";
import * as CACHE from "@app/constants/cache.constant";
import { CacheIntervalResult, RedisServer } from "@app/processors/redis/redis.server";
import logger from "@app/utils/logger";
import { Injectable } from "@nestjs/common";
import { AccessToken, HttpKit } from 'tnwx'
type Acce... |
huazai128/nest-emp2-wechat | src/services/http.ts | import axios, { AxiosRequestConfig as _AxiosRequestConfig, Method } from 'axios'
import config from '@src/config'
export interface AxiosRequestConfig extends _AxiosRequestConfig {
startTime?: Date
}
export interface HttpParams {
transformUrl: string // 转发接口
data: object | FormData // 转发参数
apiUrl?: str... |
huazai128/nest-emp2-wechat | src/config/index.ts | import { ConfigParams } from "@src/interfaces/config"
const env = process.env.EMP_ENV || 'dev'
console.log(env, 'env')
const config: ConfigParams = require(`./config.${env}`).default
export default {
...config,
env
} as ConfigParams & { env: string } |
huazai128/nest-emp2-wechat | src/utils/reactExt.ts | <reponame>huazai128/nest-emp2-wechat
import { message, notification } from 'antd'
import * as api from '@src/services/api'
export class StoreExt {
readonly api = api
readonly $message = message
readonly $notification = notification
}
|
huazai128/nest-emp2-wechat | src/stores/AuthStore/type.d.ts | import { AuthStore as AuthStoreModel } from './index'
export as namespace IAuthStore
export type AuthStore = AuthStoreModel
|
huazai128/nest-emp2-wechat | src/stores/TestStore/index.ts | import { makeAutoObservable } from 'mobx'
export class TestStore {
constructor() {
makeAutoObservable(this) // 个人喜欢装饰器写法
}
}
export default new TestStore() |
huazai128/nest-emp2-wechat | server/pipes/session.pipe.ts | <reponame>huazai128/nest-emp2-wechat
import { PipeTransform, Injectable, ArgumentMetadata } from '@nestjs/common';
import { get } from 'lodash';
import { Request } from 'express'
/**
* session 解析
* @export
* @class SessionPipe
* @implements {PipeTransform<IRequest, IRequest>}
*/
@Injectable()
export class Session... |
huazai128/nest-emp2-wechat | server/utils/proxyHttp.ts | <reponame>huazai128/nest-emp2-wechat
import { createProxyMiddleware } from 'http-proxy-middleware'
import { NextFunction, Request, Response } from 'express'
import { config } from '@app/config'
let cookie: any = null
const middleware = createProxyMiddleware({
target: config.apiPrefix.baseApi, // 目前只考虑一个
chang... |
huazai128/nest-emp2-wechat | src/page/Hello/index.tsx | <reponame>huazai128/nest-emp2-wechat<gh_stars>0
import { useEffect } from 'react'
import { WechatLogin } from '@src/utils/wxConfig'
import useRootStore from '@src/stores/useRootStore'
import HostApp from '@microHost/App'
import { Button } from '@microHost/Button'
import config from '@src/config'
import './index.scss'
i... |
huazai128/nest-emp2-wechat | server/modules/api/api.controller.ts | <reponame>huazai128/nest-emp2-wechat
import { QueryParams } from '@app/decorators/params.decorator';
import { Responsor } from '@app/decorators/responsor.decorator';
import { ApiGuard } from '@app/guards/api.guard';
import { HttpRequest } from '@app/interfaces/request.interface';
import { TransformPipe } from '@app/pip... |
huazai128/nest-emp2-wechat | src/bootstrap.tsx | import ReactDOM from 'react-dom'
import App from './App'
import { RootStoreProvider } from '@src/components/StoreProvider'
import * as stores from '@src/stores/index'
import 'intersection-observer'
import 'mutationobserver-polyfill'
import '@fastly/performance-observer-polyfill/polyfill'
import Monitor from '@src/util... |
huazai128/nest-emp2-wechat | server/processors/redis/redis.server.ts | <filename>server/processors/redis/redis.server.ts
import { CACHE_MANAGER, Inject, Injectable } from "@nestjs/common";
import { RedisCacheStore } from "./redis.store";
import { Cache } from 'cache-manager'
import logger from "@app/utils/logger";
import schedule from 'node-schedule'
export type CacheKey = string
export ... |
huazai128/nest-emp2-wechat | src/utils/monitor/index.ts | <reponame>huazai128/nest-emp2-wechat
import { FN1 } from "./interfaces";
import UserVitals from "./userVitals";
import WebVitals from "./webVitals";
export default class Monitor {
private webVitals: WebVitals
private userVitals: UserVitals
private customHandler: FN1
constructor() {
this.webVita... |
huazai128/nest-emp2-wechat | src/utils/wxConfig.ts | /**
* 微信扫码登录
* @export
* @class WechatLogin
*/
export class WechatLogin {
public static initLogin(appID: string, id: string, url: string){
new WxLogin({
self_redirect:true,
id: id,
appid: appID,
scope: 'snsapi_login',
redirect_uri: url,
... |
huazai128/nest-emp2-wechat | server/modules/api/api.service.ts | import { HttpRequest } from "@app/interfaces/request.interface";
import { AxiosService } from "@app/processors/axios/axios.service";
import { Injectable } from "@nestjs/common";
@Injectable()
export class ApiService {
constructor(private readonly axiosService: AxiosService) { }
public async get({ transformUrl... |
huazai128/nest-emp2-wechat | server/interfaces/config.interface.ts | export interface ConfigServer {
requestTimeout: number
userId?: string
apiPrefix: {
baseApi: string,
}
redisConf: {
port: number,
host: string,
no_ready_check: boolean,
password: string,
defaultCacheTTL?: number
username?: string
}
wxCo... |
huazai128/nest-emp2-wechat | src/components/RouterComp.tsx | <reponame>huazai128/nest-emp2-wechat<filename>src/components/RouterComp.tsx
import { useEffect, Suspense, lazy } from 'react'
import { BrowserRouter as Router, Route, Switch, useLocation } from 'react-router-dom'
import { RouterCompProps, SwitchRouterProps } from '@src/types'
import { routes } from '@src/routes';
expo... |
huazai128/nest-emp2-wechat | src/utils/monitor/httpProxy.ts | <reponame>huazai128/nest-emp2-wechat
import { FN1, HttpMetrics } from "./interfaces";
// 调用 proxyXmlHttp 即可完成全局监听 XMLHttpRequest
export const proxyXmlHttp = (sendHandler: FN1 | null | undefined, loadHandler: FN1) => {
if ('XMLHttpRequest' in window && typeof window.XMLHttpRequest === 'function') {
const oX... |
huazai128/nest-emp2-wechat | server/constants/text.constant.ts | <reponame>huazai128/nest-emp2-wechat
export const HTTP_UNAUTHORIZED_TEXT_DEFAULT = 'Unauthorized'
export enum ScopeEnum {
SNSAPI_BASE = "snsapi_base",
SNSAPI_USERINFO = "snsapi_userinfo"
}
export enum Lang {
ZH_CN = "zh_CN",
ZH_TW = "zh_TW",
EN = "en"
}
export const WX_STATE = "wxLogin" |
huazai128/nest-emp2-wechat | server/processors/redis/redis.config.server.ts | <gh_stars>1-10
import { REDIS } from '@app/config'
import logger from '@app/utils/logger'
import { CacheModuleOptions, CacheOptionsFactory, Injectable } from '@nestjs/common'
import redisStore, { RedisStoreOptions } from './redis.store'
@Injectable()
export class RedisConfigServer implements CacheOptionsFactory {
... |
huazai128/nest-emp2-wechat | src/utils/monitor/utils/index.ts | <filename>src/utils/monitor/utils/index.ts<gh_stars>0
import { FN, FN1, IMetrics, MPerformanceNavigationTiming, PerformanceEntryHandler } from "../interfaces"
export const supported = {
performance: !!window.performance,
getEntriesByType: !!(window.performance && window.performance.getEntriesByType),
Perfo... |
huazai128/nest-emp2-wechat | server/config/config.test.ts | import { ConfigServer } from '@app/interfaces/config.interface'
import { redisConf, wxConfig } from '../dev.config'
const config: ConfigServer = {
/* 接口请求相关配置 */
requestTimeout: 300000,
// 代理接口域名
apiPrefix: {
baseApi: 'http://172.25.197.154:3000',
},
redisConf: {
'port': redi... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.