repo_name
stringlengths
5
122
path
stringlengths
3
232
text
stringlengths
6
1.05M
lauslim12/attendance
web/utils/http.ts
<filename>web/utils/http.ts<gh_stars>1-10 import type { AxiosRequestConfig } from 'axios'; import axiosClient from 'axios'; import type { Response } from './types'; /** * Creates an initial 'axios' instance with custom settings. */ const instance = axiosClient.create({ headers: { Accept: 'application/vnd.nich...
lauslim12/attendance
web/components/Toast.tsx
<filename>web/components/Toast.tsx import type { UseToastOptions } from '@chakra-ui/react'; /** * Displays a failed toast, if, for a reason, a request fails. In this toast, * sometimes `message` is of the type 'any'. For this reason, we place a default value * just in case `message` also fails. * * @param toast -...
lauslim12/attendance
web/components/Pages/Home/Links.tsx
import { Button, Stack } from '@chakra-ui/react'; import NextLink from 'next/link'; import { memo } from 'react'; import { FaAddressCard, FaSignInAlt } from 'react-icons/fa'; import routes from '../../../utils/routes'; /** * Collection of links. * * @returns Links component. */ const Links = () => ( <Stack ...
lauslim12/attendance
api/modules/middleware/has-role.ts
<gh_stars>1-10 import type { NextFunction, Request, Response } from 'express'; import AppError from '../../util/app-error'; import UserService from '../user/service'; /** * Checks whether a user does have sufficient privileges / roles to access this endpoint. * * @param roles - Roles that are allowed to access thi...
lauslim12/attendance
api/modules/cache/service.ts
import CacheRepository from './repository'; /** * All services in Redis / cache are performed here. */ const CacheService = { /** * Blacklists an OTP using Redis. * * @param userID - User ID. * @param otp - One time password. * @returns Asynchronous number from Redis. */ blacklistOTP: async (us...
lauslim12/attendance
api/cli/match-totps.ts
import { generateDefaultTOTP, generateOwnOTP, validateDefaultTOTP, verifyOwnTOTP, } from '../core/rfc6238'; /** * Runs a function to know whether my understanding of OTPs is the same as * the experts who created the libraries. */ function main() { // Initialize default values. const period = 30; const...
lauslim12/attendance
web/components/Pages/Home/Hello.tsx
<gh_stars>1-10 import { Text, VStack } from '@chakra-ui/react'; import { memo } from 'react'; import MainHeading from '../../MainHeading'; /** * Hello component. * * @returns Hello component. */ const Hello = () => ( <VStack as="section" align="start" spacing={1}> <MainHeading text="Hello and Welcome!...
lauslim12/attendance
web/components/Pages/Home/Present.tsx
import { Button, Text, useToast, VStack } from '@chakra-ui/react'; import { memo, useState } from 'react'; import { FaRegGrinAlt, FaRegGrinBeam } from 'react-icons/fa'; import { useAttendanceStatus } from '../../../utils/hooks'; import type { Status } from '../../../utils/types'; import MFAButton from '../../MFAButton...
lauslim12/attendance
web/components/Card/MenuCard.tsx
import { Icon, Link, Text, VStack } from '@chakra-ui/react'; import NextLink from 'next/link'; import { memo } from 'react'; import type { IconType } from 'react-icons'; /** * Props for menu. */ type Props = { header: string; description: string; icon: IconType; gradientStart: string; gradientEnd: string; ...
lauslim12/attendance
api/modules/middleware/has-session.ts
<filename>api/modules/middleware/has-session.ts import type { NextFunction, Request, Response } from 'express'; import AppError from '../../util/app-error'; import getDeviceID from '../../util/device-id'; import UserService from '../user/service'; /** * Validates whether a user is authenticated or not (via sessions)...
lauslim12/attendance
web/components/Overlay/EditUserModal.tsx
<reponame>lauslim12/attendance import { Alert, AlertIcon, Button, Modal, ModalBody, ModalCloseButton, ModalContent, ModalFooter, ModalHeader, ModalOverlay, Tab, TabList, TabPanel, TabPanels, Tabs, useToast, VStack, } from '@chakra-ui/react'; import type { FormEvent } from 'react'; impo...
lauslim12/attendance
web/components/Spinner.tsx
<reponame>lauslim12/attendance<filename>web/components/Spinner.tsx import { Spinner as ChakraSpinner, Text, VStack } from '@chakra-ui/react'; import { memo } from 'react'; import Head from './Layout/Head'; /** * Application loader when the browser is loading something, such as localizations. This is * intentionally...
lauslim12/attendance
api/core/util/base32.ts
<gh_stars>1-10 /** * This function is used to transform base-32 encoded string into bytes. * * @link http://web.cecs.pdx.edu/~harry/compilers/ASCIIChart.pdf * @link https://github.com/LinusU/base32-decode * @param str - Base32-encoded string. * @returns ArrayBuffer consists of the 'bytes' version of the parameter...
lauslim12/attendance
web/components/Overlay/CreateUserModal.tsx
<gh_stars>1-10 import { Alert, AlertIcon, Button, Modal, ModalBody, ModalCloseButton, ModalContent, ModalFooter, ModalHeader, ModalOverlay, useToast, VStack, } from '@chakra-ui/react'; import type { FormEvent } from 'react'; import { memo, useRef, useState } from 'react'; import { FaPencilAlt, F...
lauslim12/attendance
api/modules/middleware/favicon.ts
import type { NextFunction, Request, Response } from 'express'; /** * Prevents `404 Not Found` when searching for the `favicon.ico` file in the API. * * @returns A middleware to be used globally. */ const favicon = () => (req: Request, res: Response, next: NextFunction) => { if (req.originalUrl.includes('favicon...
lauslim12/attendance
api/modules/middleware/not-found.ts
import type { NextFunction, Request, Response } from 'express'; import AppError from '../../util/app-error'; /** * Middleware to handle `404 Not Found` errors in API. * * @returns Closure to handle `404 Not Found` errors in API. */ const notFound = () => (req: Request, _: Response, next: NextFunction) => { next...
lauslim12/attendance
api/modules/error/index.ts
import { PrismaClientKnownRequestError } from '@prisma/client/runtime'; import type { NextFunction, Request, Response } from 'express'; import { ValidationError } from 'express-validation'; import { errors as jose } from 'jose'; import config from '../../config'; import AppError from '../../util/app-error'; import sen...
lauslim12/attendance
api/infra/prisma.ts
<filename>api/infra/prisma.ts import { PrismaClient } from '@prisma/client'; const prisma = new PrismaClient({ log: ['info', 'warn', 'error'] }); export default prisma;
lauslim12/attendance
api/infra/express.ts
import cookieParser from 'cookie-parser'; import express from 'express'; import helmet from 'helmet'; import hpp from 'hpp'; import morgan from 'morgan'; import config from '../config'; import AttendanceHandler from '../modules/attendance/handler'; import AuthHandler from '../modules/auth/handler'; import errorHandler...
lauslim12/attendance
api/modules/middleware/body-parser.ts
import type { NextFunction, Request, Response } from 'express'; import { json as parse } from 'express'; import AppError from '../../util/app-error'; /** * Parses the request body of a request. Do not use this middleware globally. Instead, * use this in requests where you need to parse the request body. This makes ...
lauslim12/attendance
api/core/util/hmac-digest.ts
<filename>api/core/util/hmac-digest.ts import { createHmac } from 'node:crypto'; /** * Create a HOTP-base (the ALG(K, C) in the formula) by using buffers. * Let's say this will return 'HOTPBase' mathematically. * * @param algorithm - Algorithm to use, can be `SHA1`, `SHA256`, or `SHA512`. * @param key - The share...
lauslim12/attendance
api/modules/middleware/accept.ts
<reponame>lauslim12/attendance import type { NextFunction, Request, Response } from 'express'; import AppError from '../../util/app-error'; /** * Middleware to validate the `Accept` header in the API. * * @returns Middleware to validate the `Accept` header. */ const accept = () => (req: Request, _: Response, next...
lauslim12/attendance
web/components/Layout/Header.tsx
<gh_stars>1-10 import { Heading, HStack, IconButton, Link, Menu, MenuButton, MenuItem, MenuList, Spacer, Text, useColorMode, useMediaQuery, useToast, } from '@chakra-ui/react'; import NextLink from 'next/link'; import { useRouter } from 'next/router'; import { memo, useEffect, useState } from ...
lauslim12/attendance
web/utils/hooks.ts
<reponame>lauslim12/attendance import type { Key } from 'swr'; import useSWR from 'swr'; import { fetcher } from './http'; import type { Attendance, AttendanceStatus, Session, Status, User, } from './types'; /** * Hook to call a `GET` request with Vercel's `useSWR` for performance and reactive * applicati...
lauslim12/attendance
web/pages/admin/users.tsx
<reponame>lauslim12/attendance import { Button, Grid, HStack, Spacer, Text, VStack } from '@chakra-ui/react'; import NextLink from 'next/link'; import { memo, useState } from 'react'; import { FaArrowLeft, FaCheck } from 'react-icons/fa'; import UserCard from '../../components/Card/UserCard'; import Layout from '../.....
lauslim12/attendance
web/utils/types.ts
<reponame>lauslim12/attendance /** * JSONAPI standard response from the back-end. */ export interface Response<T> { status: 'success' | 'fail' | 'error'; message: string; data: T; type: 'general' | 'users' | 'attendance' | 'auth' | 'sessions'; meta: { copyright: string; authors: string[]; }; jso...
liadmagen/Keep-Current-App
src/app/user-area/user-area-routing.module.ts
<filename>src/app/user-area/user-area-routing.module.ts<gh_stars>1-10 import { NgModule } from '@angular/core'; import { Routes, RouterModule } from '@angular/router'; import { UserAreaCenterComponent } from './user-area-center.component'; import { UserAreaNavBarComponent } from './user-area-navbar.component'; import ...
liadmagen/Keep-Current-App
src/app/topic/recommendation-list/recommendation-list.service.spec.ts
<reponame>liadmagen/Keep-Current-App<gh_stars>1-10 import { TestBed, inject } from '@angular/core/testing'; import { RecommendationListService } from './recommendation-list.service'; describe('RecommendationService', () => { beforeEach(() => { TestBed.configureTestingModule({ providers: [RecommendationLis...
liadmagen/Keep-Current-App
src/app/topic/recommendation/recommendation.class.ts
<reponame>liadmagen/Keep-Current-App export class Recommendation { constructor( public id: string, public title: string, public abstract: string, public authors: Array<string> = [], public url: string = '', public similarityScore: Array<string> = []) { } }
liadmagen/Keep-Current-App
src/app/topic/topic-list/topic-list.component.ts
<gh_stars>1-10 import { Component, OnInit } from '@angular/core'; import { ActivatedRoute, ParamMap } from '@angular/router'; import { Topic, TopicService } from '../topic.service'; import { Observable, pipe } from 'rxjs'; import { switchMap } from 'rxjs/operators'; @Component({ selector: 'app-topic-list', temp...
liadmagen/Keep-Current-App
src/app/auth/register/enforce-password-policy.directive.ts
import { Directive, Input, OnChanges, SimpleChanges } from '@angular/core'; import { AbstractControl, NG_VALIDATORS, Validator, ValidatorFn, Validators } from '@angular/forms'; /** * checks if the control input agrees with the pattern */ export function enforcePatternValidator(nameRe: RegExp): ValidatorFn { retu...
liadmagen/Keep-Current-App
src/app/public/script.store.ts
interface Scripts { name: string; src: string; } export const ScriptStore: Scripts[] = [ { name: 'slick', src: 'https://cdn.jsdelivr.net/npm/slick-carousel@1.8.1/slick/slick.min.js' } ];
liadmagen/Keep-Current-App
src/app/topic/recommendation-list/recommendation-list.component.ts
import { Component, OnInit } from '@angular/core'; import { RecommendationListService } from './recommendation-list.service'; import { Recommendation } from '../recommendation/recommendation.class'; import { ActivatedRoute, ParamMap } from '@angular/router'; import { Observable, pipe } from 'rxjs'; import { switchMa...
liadmagen/Keep-Current-App
src/app/public/home/home.resolve.service.ts
import { Injectable } from '@angular/core'; import { Resolve } from '@angular/router'; import { Observable } from 'rxjs'; import { ScriptService } from '../script.service'; @Injectable() export class HomeScriptResolver implements Resolve<any> { constructor(private script: ScriptService) { } resolve(): Observ...
liadmagen/Keep-Current-App
src/app/topic/topic-routing.module.ts
<gh_stars>1-10 import { NgModule } from '@angular/core'; import { Routes, RouterModule } from '@angular/router'; import { TopicComponent } from './topic.component'; import { TopicListComponent } from './topic-list/topic-list.component'; import { TopicEditComponent } from './topic-edit/topic-edit.component'; import { T...
liadmagen/Keep-Current-App
src/app/app.component.ts
<gh_stars>1-10 import { Component } from '@angular/core'; import { AuthService } from './auth/auth.service'; import { Router } from '@angular/router'; @Component({ selector: 'app-root', templateUrl: './app.component.html', styleUrls: ['./app.component.scss'] }) export class AppComponent { title = 'Keep Current...
liadmagen/Keep-Current-App
src/app/topic/topic-edit/topic-edit.component.ts
import { Component, OnInit, HostBinding } from '@angular/core'; import { ActivatedRoute, Router } from '@angular/router'; import { slideInDownAnimation } from '../../animations'; import { Topic, TopicService } from '../topic.service'; @Component({ selector: 'app-topic-edit', templateUrl: './topic-edit.component.h...
liadmagen/Keep-Current-App
src/app/app.module.ts
import { NgModule } from '@angular/core'; import { BrowserModule } from '@angular/platform-browser'; import { FormsModule } from '@angular/forms'; import { HttpClientModule } from '@angular/common/http'; import { AppRoutingModule } from './app-routing.module'; import { AuthModule } from './auth/auth.module'; import { ...
liadmagen/Keep-Current-App
src/app/topic/recommendation-list/recommendation-list.service.ts
import { Observable, of } from 'rxjs'; import { catchError, map, tap } from 'rxjs/operators'; import { Injectable } from '@angular/core'; import { Recommendation } from '../recommendation/recommendation.class'; import { HttpClient, HttpHeaders } from '@angular/common/http'; @Injectable() export class Recommenda...
liadmagen/Keep-Current-App
src/app/user-area/user-area-navbar.component.ts
import { Component } from '@angular/core'; @Component({ template: ` <nav> <a routerLink="./" routerLinkActive="active" [routerLinkActiveOptions]="{ exact: true }">Dashboard</a> <a routerLink="./topic" routerLinkActive="active">Topics</a> <a routerLink="./recommended" routerLinkActiv...
liadmagen/Keep-Current-App
src/app/topic/topic.module.ts
import { NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; import { FormsModule } from '@angular/forms'; import { TopicComponent } from './topic.component'; import { TopicService } from './topic.service'; import { RecommendationListService } from './recommendation-list/recommendation-lis...
liadmagen/Keep-Current-App
src/app/auth/register/register.component.ts
import { Component, OnInit } from '@angular/core'; import { AuthService } from '../auth.service'; import { UserRegistration } from './user-registration'; @Component({ selector: 'app-register', templateUrl: './register.component.html', styleUrls: ['./register.component.scss'] }) export class RegisterComponent im...
liadmagen/Keep-Current-App
src/app/auth/auth0-variables.ts
<gh_stars>1-10 interface AuthConfig { clientID: string; domain: string; callbackUrlDev: string; callbackUrlProd: string; } export const AUTH_CONFIG: AuthConfig = { clientID: 'YiWI6rmDX56tO72HSHmaoMOm5aExw6bG', domain: 'keepcurrent.eu.auth0.com', callbackUrlDev: 'http://localhost:4200/ca...
liadmagen/Keep-Current-App
src/app/auth/auth.service.ts
<reponame>liadmagen/Keep-Current-App<gh_stars>1-10 import { timer, Observable, of, pipe } from 'rxjs'; import { filter, flatMap } from 'rxjs/operators'; import { Injectable } from '@angular/core'; import { Router } from '@angular/router'; import { AUTH_CONFIG } from './auth0-variables'; import { isDevMode } from '@an...
liadmagen/Keep-Current-App
src/app/user-area/user-area.module.ts
<reponame>liadmagen/Keep-Current-App<filename>src/app/user-area/user-area.module.ts<gh_stars>1-10 import { NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; import { UserAreaCenterComponent } from './user-area-center.component'; import { UserAreaNavBarComponent } from './user-area-navbar...
liadmagen/Keep-Current-App
src/app/topic/topic.service.ts
<reponame>liadmagen/Keep-Current-App import { BehaviorSubject, pipe } from 'rxjs'; import { map } from 'rxjs/operators'; export class Topic { constructor( public name: string, public urls?: Array<string>, public id: number = -1) { } } // ToDo: retrieve it from the DB const TOPICS = [ new Topic('Reas...
liadmagen/Keep-Current-App
src/app/alert/alert.component.ts
import { Input, Component } from '@angular/core'; import { AlertService } from './alert.service'; @Component({ selector: 'app-alert', templateUrl: './alert.component.html' }) export class AlertComponent { constructor(public alerts: AlertService) { } public closeAlert(alert: IAlert) { this.alerts.remove...
liadmagen/Keep-Current-App
src/app/alert/alert.service.ts
<filename>src/app/alert/alert.service.ts<gh_stars>1-10 import { Injectable } from '@angular/core'; export interface IAlert { id?: number; type: string; message: string; } @Injectable() export class AlertService { public alerts: Array<IAlert> = []; constructor() { } public removeAlert(alert: IAlert) { ...
liadmagen/Keep-Current-App
src/app/public/public-routing.module.ts
<filename>src/app/public/public-routing.module.ts import { NgModule } from '@angular/core'; import { RouterModule, Routes } from '@angular/router'; import { HomeComponent } from './home/home.component'; import { HowComponent } from './how/how.component'; import { AboutUsComponent } from './about-us/about-us.component'...
liadmagen/Keep-Current-App
src/app/public/home/home.component.ts
import { Component, OnInit } from '@angular/core'; @Component({ selector: 'app-home', templateUrl: './home.component.html', styleUrls: ['./home.component.scss'] }) export class HomeComponent implements OnInit { constructor() { } slideConfig = { accessibility: false, autoplay: true, autoplaySp...
fugle-dev/fugle-realtime-node
src/utils/compile-url.util.ts
import { stringify } from 'query-string'; import { ClientConfig } from '../interfaces'; export function compileUrl(path: string, params: any, config: ClientConfig): string { params = { ...params, apiToken: config.apiToken }; const baseUrl = `${config.url}/${config.apiVersion}`; /* istanbul ignore next */ con...
fugle-dev/fugle-realtime-node
src/interfaces/client-options.interface.ts
export interface ClientOptions { apiToken: string; apiVersion?: string; }
fugle-dev/fugle-realtime-node
src/clients/index.ts
<filename>src/clients/index.ts export * from './http-client'; export * from './websocket-client';
fugle-dev/fugle-realtime-node
src/constants.ts
export const FUGLE_REALTIME_HTTP_URL = 'https://api.fugle.tw/realtime'; export const FUGLE_REALTIME_WS_URL = 'wss://api.fugle.tw/realtime'; export const FUGLE_REALTIME_API_VERSION = 'v0.3';
fugle-dev/fugle-realtime-node
test/http-client.spec.ts
import * as fetch from 'isomorphic-fetch'; import { HttpClient } from '../src'; import { Intraday } from '../src/clients/http-client/intraday'; jest.mock('isomorphic-fetch', () => jest.fn(() => Promise.resolve({ json: () => Promise.resolve({}) }))); describe('HttpClient', () => { describe('constructor()', () => { ...
fugle-dev/fugle-realtime-node
test/websocket-client.spec.ts
import * as WebSocket from 'isomorphic-ws'; import { WebSocketClient } from '../src'; import { Intraday } from '../src/clients/websocket-client/intraday'; jest.mock('isomorphic-ws'); describe('HttpClient', () => { describe('constructor()', () => { it('should be instantiated', () => { const client = new We...
fugle-dev/fugle-realtime-node
src/clients/http-client/intraday.ts
<filename>src/clients/http-client/intraday.ts import * as fetch from 'isomorphic-fetch'; import { compileUrl } from '../../utils'; import { ClientConfig } from '../../interfaces'; export class Intraday { constructor(private readonly config: ClientConfig) {} public meta(params: { symbolId: string, oddLot?: boolean...
fugle-dev/fugle-realtime-node
src/clients/websocket-client/intraday.ts
import * as WebSocket from 'isomorphic-ws'; import { compileUrl } from '../../utils'; import { ClientConfig } from '../../interfaces'; export class Intraday { constructor(private readonly config: ClientConfig) {} public meta(params: { symbolId: string, oddLot?: boolean }): WebSocket { return this.createSocket...
fugle-dev/fugle-realtime-node
src/interfaces/index.ts
<gh_stars>1-10 export * from './client-config.interface'; export * from './client-options.interface';
fugle-dev/fugle-realtime-node
src/clients/websocket-client/websocket-client.ts
import { Intraday } from './intraday'; import { BaseClient } from '../base-client'; import { ClientOptions } from '../../interfaces'; import { FUGLE_REALTIME_WS_URL, FUGLE_REALTIME_API_VERSION } from '../../constants'; export class WebSocketClient extends BaseClient { constructor(options?: ClientOptions) { const...
fugle-dev/fugle-realtime-node
src/interfaces/client-config.interface.ts
export interface ClientConfig { url: string; apiVersion: string; apiToken: string; }
fugle-dev/fugle-realtime-node
src/clients/base-client.ts
<reponame>fugle-dev/fugle-realtime-node import { ClientConfig } from '../interfaces'; export abstract class BaseClient { constructor(protected readonly config: ClientConfig) {} /** * Set api token. * * @param apiToken - The api token * @returns The client instance */ public setApiToken(apiToken: ...
fugle-dev/fugle-realtime-node
src/utils/index.ts
<reponame>fugle-dev/fugle-realtime-node export * from './compile-url.util';
fugle-dev/fugle-realtime-node
src/clients/http-client/http-client.ts
<reponame>fugle-dev/fugle-realtime-node import { Intraday } from './intraday'; import { BaseClient } from '../base-client'; import { ClientOptions } from '../../interfaces'; import { FUGLE_REALTIME_HTTP_URL, FUGLE_REALTIME_API_VERSION } from '../../constants'; export class HttpClient extends BaseClient { constructor...
emdad23/vuestorefront
src/modules/example-module/index.ts
<reponame>emdad23/vuestorefront<filename>src/modules/example-module/index.ts<gh_stars>0 import { StorefrontModule } from '@vue-storefront/core/lib/modules'; const exampleModuleStore = { namespaced: true, state: { key: null } } export const ExampleModule: StorefrontModule = function ({app, store, ...
lkostrowski/todoist-api-colors
test/colors.test.ts
<reponame>lkostrowski/todoist-api-colors import { getAllTodoistColors, getTodoistColorById, getTodoistColorByName, } from '../src'; test('Returns all as array', () => { expect(getAllTodoistColors()).toMatchSnapshot(); }); test('Returns by ID', () => { const color = getTodoistColorById(41); expect(color)....
lkostrowski/todoist-api-colors
src/index.ts
export type TodoistColor = { id: number; name: string; hexColor: string; }; const apiColors = [ { id: 30, hexColor: '#b8256f', name: 'berry_red', }, { id: 31, hexColor: '#db4035', name: 'red', }, { name: 'orange', id: 32, hexColor: '#ff9933', }, { id: 33, ...
AndrewRayCode/apollo-client-1
packages/apollo-client/src/client.ts
<reponame>AndrewRayCode/apollo-client-1 /* Copyright (c) 2020, salesforce.com, inc. All rights reserved. SPDX-License-Identifier: BSD-3-Clause For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause */ // // Reference the Apollo client to use // impor...
AndrewRayCode/apollo-client-1
packages/apollo-client/src/mutation.ts
/* Copyright (c) 2020, salesforce.com, inc. All rights reserved. SPDX-License-Identifier: BSD-3-Clause For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause */ import { getClient } from './client'; import ApolloClient, { MutationOptions, OperationVa...
AndrewRayCode/apollo-client-1
packages/apollo-client/src/query.ts
/* Copyright (c) 2020, salesforce.com, inc. All rights reserved. SPDX-License-Identifier: BSD-3-Clause For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause */ import { getClient } from './client'; import { ApolloClient, WatchQueryOptions, Observabl...
AndrewRayCode/apollo-client-1
packages/apollo-client/src/error-helpers.ts
export function getErrorString(error: any): string | undefined { if (error) { if (Array.isArray(error)) { let s = ""; for (let i of (error as [])) { if (s) s += "\n"; s += getErrorString(i); } return s; } if (ty...
AndrewRayCode/apollo-client-1
packages/apollo-client/src/index.ts
/* Copyright (c) 2020, salesforce.com, inc. All rights reserved. SPDX-License-Identifier: BSD-3-Clause For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause */ export { getClient, setClient } from './client'; export { useQuery } from './query'; expo...
anchan828/typeorm-helpers
packages/history/src/e2e-tests/custom-property.spec-e2e.ts
<gh_stars>10-100 import { e2eDatabaseTypeSetUp, e2eSetUp } from "testing"; import { BaseEntity, Column, Entity, EventSubscriber, getConnection, PrimaryGeneratedColumn } from "typeorm"; import { HistoryActionType } from "../history-action.enum"; import { HistoryActionColumn, HistoryOriginalIdColumn } from "../history-en...
anchan828/typeorm-helpers
packages/transformers/src/boolean.spec-e2e.ts
<gh_stars>10-100 import { e2eDatabaseTypeSetUp, e2eSetUp } from "testing"; import { BaseEntity, Column, Entity, getConnection, PrimaryGeneratedColumn } from "typeorm"; import { BooleanTransformer } from "./boolean"; e2eDatabaseTypeSetUp("BigintTransformer", (options) => { @Entity() class BooleanTransformerTest exte...
anchan828/typeorm-helpers
packages/transformers/src/hmac.spec-e2e.ts
<reponame>anchan828/typeorm-helpers import { e2eDatabaseTypeSetUp, e2eSetUp } from "testing"; import { BaseEntity, Column, Entity, PrimaryGeneratedColumn } from "typeorm"; import { HmacTransformer } from "./hmac"; e2eDatabaseTypeSetUp("HmacTransformer", (options) => { @Entity() class HmacTransformerTest extends Bas...
anchan828/typeorm-helpers
packages/transformers/src/json.spec-e2e.ts
import { e2eDatabaseTypeSetUp, e2eSetUp } from "testing"; import { BaseEntity, Column, Entity, getConnection, PrimaryGeneratedColumn } from "typeorm"; import { JsonTransformer } from "./json"; e2eDatabaseTypeSetUp("JsonTransformer", (options) => { class TestJson { public name!: string; } @Entity() class Js...
anchan828/typeorm-helpers
packages/decorators/src/json-column.spec-e2e.ts
import { e2eDatabaseTypeSetUp, e2eSetUp } from "testing"; import { BaseEntity, Entity, PrimaryGeneratedColumn } from "typeorm"; import { JsonColumn } from "./json-column"; interface TestInterface { hoge: string; foo: number; } e2eDatabaseTypeSetUp("JsonColumn", (options) => { @Entity({ name: "test" }) class J...
anchan828/typeorm-helpers
packages/transformers/src/static-file.spec-e2e.ts
<gh_stars>10-100 import { BinaryLike } from "crypto"; import { readFileSync } from "fs"; import { tmpdir } from "os"; import { e2eDatabaseTypeSetUp, e2eSetUp } from "testing"; import { BaseEntity, Column, Entity, getConnection, PrimaryGeneratedColumn } from "typeorm"; import { StaticFileTransformer } from "./static-fil...
anchan828/typeorm-helpers
packages/history/src/e2e-tests/remove-unique-index.spec-e2e.ts
<filename>packages/history/src/e2e-tests/remove-unique-index.spec-e2e.ts import { e2eDatabaseTypeSetUp, e2eSetUp } from "testing"; import { BaseEntity, Column, Entity, EventSubscriber, Index, JoinColumn, ManyToOne, OneToMany, OneToOne, PrimaryGeneratedColumn, QueryRunner, Unique, } from "typeorm...
anchan828/typeorm-helpers
packages/testing/src/index.ts
import { Connection, ConnectionOptions, createConnection } from "typeorm"; export function e2eDatabaseTypeSetUp(name: string, callback: (options: Partial<ConnectionOptions>) => void): void; export function e2eDatabaseTypeSetUp( name: string, ignoreTypes: string[], callback: (options: Partial<ConnectionOptions>) ...
anchan828/typeorm-helpers
packages/history/src/history-entity.ts
<filename>packages/history/src/history-entity.ts import { Column, ColumnOptions } from "typeorm"; import { TYPEORM_HELPER_HISTORY_ACTION_TYPE, TYPEORM_HELPER_HISTORY_ORIGINAL_ID } from "./constants"; import { HistoryActionType } from "./history-action.enum"; export function HistoryActionColumn(column?: ColumnOptions):...
anchan828/typeorm-helpers
packages/decorators/src/ulid-column.spec-e2e.ts
<filename>packages/decorators/src/ulid-column.spec-e2e.ts /* eslint-disable @typescript-eslint/no-non-null-assertion */ import { e2eDatabaseTypeSetUp, e2eSetUp } from "testing"; import { BaseEntity, Column, Entity, PrimaryGeneratedColumn } from "typeorm"; import { UlidColumn } from "./ulid-column"; e2eDatabaseTypeSetU...
anchan828/typeorm-helpers
packages/history/src/history-migration.ts
import { EntityTarget, QueryRunner, Table, TableIndex } from "typeorm"; /** * Helper function for drop unique indices for history entity. * The default is to drop the all unique indices. * If you want to regenerate the index with the unique flag removed, please set keepIndex to true. * * @param {QueryRunner} quer...
anchan828/typeorm-helpers
packages/decorators/src/static-file-colum.spec-e2e.ts
import { BinaryLike } from "crypto"; import { tmpdir } from "os"; import { e2eDatabaseTypeSetUp, e2eSetUp } from "testing"; import { BaseEntity, Entity, PrimaryGeneratedColumn } from "typeorm"; import { StaticFileColumn } from "./static-file-column"; e2eDatabaseTypeSetUp("StaticFileColumn", (options) => { @Entity() ...
tomoya/slack-hot-channel-deno
src/index.ts
import { delay } from "https://deno.land/std@0.93.0/async/delay.ts"; import moment from "https://deno.land/x/momentjs@2.29.1-deno/mod.ts"; type Conversations = { channels: Array<Channel>; response_metadata: { next_cursor: string; }; }; type Channel = { id: string; name: string; }; type History = { me...
flazepe/alexflipnote.js
typings/index.d.ts
<reponame>flazepe/alexflipnote.js //List all the functions declare class AlexClient { image: { birb():Promise<AlexClient.AlexRequestResults>; cats():Promise<AlexClient.AlexRequestResults>; dogs():Promise<AlexClient.AlexRequestResults>; sadcat():Promise<AlexClient.AlexRequestResults>; amiajo...
kopach/autocomplete-control
src/options-storage.ts
<gh_stars>1-10 import webextOptionsSync from 'webext-options-sync'; export enum DefaultBehaviour { disableAutocomplete = 'disableAutocomplete', doNothing = 'doNothing', forceEnableAutocomplete = 'forceEnableAutocomplete', } // tslint:disable-next-line: interface-over-type-literal export type UserSettings = { defa...
kopach/autocomplete-control
src/options.ts
<filename>src/options.ts import optionsStorage from './options-storage'; optionsStorage.syncForm('#options-form').catch((e: string) => { const errorElement: HTMLSpanElement | null = document.querySelector('.error'); if (errorElement) { errorElement.textContent = e; } throw Error(e); }); // TODO: add loading indi...
kopach/autocomplete-control
src/content_script.ts
import optionsStorage, { DefaultBehaviour, UserSettings, } from './options-storage'; populateAutocompleteSetup(); async function populateAutocompleteSetup(): Promise<void> { const { defaultBehaviour }: UserSettings = await optionsStorage.getAll(); switch (defaultBehaviour) { case DefaultBehaviour.disableAutoco...
MilanMolnar/join-among-us
web/src/app/services/before-login.service.spec.ts
<reponame>MilanMolnar/join-among-us /* tslint:disable:no-unused-variable */ import { TestBed, async, inject } from '@angular/core/testing'; import { BeforeLoginService } from './before-login.service'; describe('Service: BeforeLogin', () => { beforeEach(() => { TestBed.configureTestingModule({ providers: [...
coronsaye/ConstrutNgAdmin
.history/src/app/modules/user-groups/user-group_20190617223601.ts
<gh_stars>0 import { User } from '../user/user'; export class UserGroup { public get updated_at() { return this._updated_at; } public set updated_at(value) { this._updated_at = value; } public get created_at() { return this._created_at; } public set created_at(value) { this._created_at = ...
coronsaye/ConstrutNgAdmin
src/app/modules/customer/customer.module.ts
<filename>src/app/modules/customer/customer.module.ts import { NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; import { NewCustomerComponent } from './new-customer/new-customer.component'; import { CustomersComponent } from './customers/customers.component'; // Components Routing impo...
coronsaye/ConstrutNgAdmin
src/app/services/user.service.ts
<reponame>coronsaye/ConstrutNgAdmin<filename>src/app/services/user.service.ts import { Injectable } from '@angular/core'; import { HttpClient, HttpHeaders } from '@angular/common/http'; import { Observable, of } from 'rxjs'; import { catchError, map, tap } from 'rxjs/operators'; import { User } from '../modules/user/u...
coronsaye/ConstrutNgAdmin
src/app/modules/user-group-actions/user-group-actions.module.ts
import { NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; import { GroupActionsComponent } from './group-actions/group-actions.component'; import { NewGroupActionComponent } from './new-group-action/new-group-action.component'; // Components Routing import { UserGroupActionsRoutingModul...
coronsaye/ConstrutNgAdmin
src/app/modules/customer/customer-routing.module.ts
import { NgModule } from '@angular/core'; import { Routes, RouterModule } from '@angular/router'; import { CustomersComponent } from './customers/customers.component'; import { NewCustomerComponent } from './new-customer/new-customer.component'; const routes: Routes = [ { path: '', data: { title: 'Cus...
coronsaye/ConstrutNgAdmin
src/app/models/headers2.ts
<gh_stars>0 export interface Headers2 { }
coronsaye/ConstrutNgAdmin
.history/src/app/modules/user-groups/user-group.spec_20190617205901.ts
import { UserGroup } from './user-group'; describe('UserGroup', () => { it('should create an instance', () => { expect(new UserGroup()).toBeTruthy(); }); });
coronsaye/ConstrutNgAdmin
.history/src/app/modules/user-groups/user-group_20190617222919.ts
import { User } from '../user/user'; export class UserGroup { constructor( public id, public name, public created_at, public updated_at ) { } }
coronsaye/ConstrutNgAdmin
src/app/modules/user-groups/user-groups.module.ts
import { NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; import { UserGroupsComponent } from './user-groups/user-groups.component'; import { NewUserGroupComponent } from './new-user-group/new-user-group.component'; import { FormsModule } from '../../../../node_modules/@angular/forms'; ...
coronsaye/ConstrutNgAdmin
src/app/modules/user-groups/new-user-group/new-user-group.component.ts
import { Component, OnInit } from '@angular/core'; import { UserGroup } from '../../../models/user-group'; import { UserGroupService } from '../../../services/user-group.service'; @Component({ selector: 'app-new-user-group', templateUrl: './new-user-group.component.html', styleUrls: ['./new-user-group.component....