repo_name
stringlengths
5
122
path
stringlengths
3
232
text
stringlengths
6
1.05M
http4k/FrameworkBenchmarks
frameworks/TypeScript/feathersjs/src/services/plaintext/plaintext.service.ts
<gh_stars>1-10 // Initializes the `plaintext` service on path `/plaintext` import { ServiceAddons } from '@feathersjs/feathers'; import { Application } from '../../declarations'; import { Request, Response } from 'express'; // Add this service to the service type index declare module '../../declarations' { interface...
http4k/FrameworkBenchmarks
frameworks/TypeScript/feathersjs/src/index.ts
import cluster from 'cluster'; import os from 'os'; import logger from './logger'; import app from './app'; if (cluster.isPrimary) { const cpuCount: os.CpuInfo[] = os.cpus(); for (const cpu of cpuCount) { cluster.fork(); } cluster.on('exit', () => { process.exit(1); }); } else { const port = ap...
http4k/FrameworkBenchmarks
frameworks/TypeScript/feathersjs/src/services/world/world.class.ts
import { Service, SequelizeServiceOptions } from 'feathers-sequelize'; import { Application } from '../../declarations'; import { WorldModel } from '../../models/world.model'; import { randInt } from '../../util'; export class World extends Service { //eslint-disable-next-line @typescript-eslint/no-unused-vars con...
http4k/FrameworkBenchmarks
frameworks/TypeScript/feathersjs/src/services/fortune/fortune.class.ts
import { Service, SequelizeServiceOptions } from 'feathers-sequelize'; import { Application } from '../../declarations'; import { FortuneModel } from '../../models/fortune.model'; export class Fortune extends Service { //eslint-disable-next-line @typescript-eslint/no-unused-vars constructor(options: Partial<Sequel...
http4k/FrameworkBenchmarks
frameworks/TypeScript/feathersjs/src/services/index.ts
import { Application } from '../declarations'; import plaintext from './plaintext/plaintext.service'; import json from './json/json.service'; import fortune from './fortune/fortune.service'; import world from './world/world.service'; // Don't remove this comment. It's needed to format import lines nicely. export ...
http4k/FrameworkBenchmarks
frameworks/TypeScript/feathersjs/src/services/world/world.service.ts
<filename>frameworks/TypeScript/feathersjs/src/services/world/world.service.ts // Initializes the `world` service on path `/world` import { Params, ServiceAddons } from '@feathersjs/feathers'; import { Application } from '../../declarations'; import { Request, Response } from 'express'; import { World } from './world.c...
http4k/FrameworkBenchmarks
frameworks/TypeScript/feathersjs/src/services/fortune/fortune.service.ts
<filename>frameworks/TypeScript/feathersjs/src/services/fortune/fortune.service.ts // Initializes the `fortune` service on path `/fortune` import { ServiceAddons } from '@feathersjs/feathers'; import { Application } from '../../declarations'; import { Request, Response } from 'express'; import { Fortune } from './fortu...
http4k/FrameworkBenchmarks
frameworks/TypeScript/feathersjs/src/util.ts
export const randInt = () => { return Math.floor(Math.random() * 10000) + 1; };
http4k/FrameworkBenchmarks
frameworks/TypeScript/feathersjs/src/services/world/world.hooks.ts
import { HookContext } from '@feathersjs/feathers'; import { hooks } from 'feathers-sequelize'; const { hydrate } = hooks; function rawFalse(context: HookContext) { if (!context.params.sequelize) context.params.sequelize = {}; Object.assign(context.params.sequelize, { raw: false }); return context; } export d...
nishantraj656/Complex
src/app/pages/maintenances/maintenances.component.ts
<reponame>nishantraj656/Complex import { Component, OnInit } from '@angular/core'; @Component({ selector: 'app-maintenances', templateUrl: './maintenances.component.html', styleUrls: ['./maintenances.component.scss'] }) export class MaintenancesComponent implements OnInit { constructor() { } ngOnInit() { ...
nishantraj656/Complex
src/app/pages/employee/employee.module.ts
<filename>src/app/pages/employee/employee.module.ts import { NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; import { EmployeeComponent } from './employee.component'; import { EmployeeFormComponent } from './employee-form/employee-form.component'; import { EmployeeShowComponent } from '...
nishantraj656/Complex
src/Model/Complex.ts
<gh_stars>0 import { Address } from "./address"; import { Wings } from "./Wings"; import { Facility } from "./Facility"; export class ComplexDetails { public name:string; public websiteUrl?:string; public imageUrls?:string[]; public phones:string[]; public emailIds?:string[]; public address:Add...
nishantraj656/Complex
src/app/super-admin/facility/facility.component.ts
<gh_stars>0 import { Component, OnInit } from '@angular/core'; @Component({ selector: 'app-facility', templateUrl: './facility.component.html', styleUrls: ['./facility.component.scss'] }) export class FacilityComponent implements OnInit { facilityArray=[{value:'1',label:'Swimming Pool'}, {va...
nishantraj656/Complex
src/app/pages/flat-owner/flat-owner.module.ts
import { NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; import { FormComponent } from './form/form.component'; import { ListComponent } from './list/list.component'; import { ShowComponent } from './show/show.component'; import { routing } from './flatOwner.routing'; @NgModule({ imp...
nishantraj656/Complex
src/app/super-admin/main/main.component.ts
<filename>src/app/super-admin/main/main.component.ts import { Component, OnInit } from '@angular/core'; import { menuService } from '../../shared/services/menu.service'; import { GlobalService } from '../../shared/services/global.service'; @Component({ selector: 'app-main', templateUrl: './main.component.html', ...
nishantraj656/Complex
src/app/super-admin/association-details/association-details.component.ts
import { Component, OnInit } from '@angular/core'; @Component({ selector: 'app-association-details', templateUrl: './association-details.component.html', styleUrls: ['./association-details.component.scss'] }) export class AssociationDetailsComponent implements OnInit { constructor() { } ngOnInit() { } }...
nishantraj656/Complex
src/app/super-admin/complex/complex.component.ts
import { Component, OnInit } from '@angular/core'; import { Wings } from '../../../Model/Wings'; import { Address } from '../../../Model/address'; import {ComplexDetails} from '../../../Model/Complex'; import { Facility } from '../../../Model/Facility'; @Component({ selector: 'app-complex', templateUrl: './comple...
nishantraj656/Complex
src/Model/Facility.ts
<filename>src/Model/Facility.ts export class Facility { public count:number; public ftype:number; constructor(count:any,ftype:any) { this.count =<number>count; this.ftype =<number>ftype; } }
nishantraj656/Complex
src/app/pages/pages.module.ts
import { NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; import { routing } from './pages.routing'; import { LayoutModule } from '../shared/layout.module'; import { SharedModule } from '../shared/shared.module'; /* components */ import { PagesComponent } from './pages.component'; impo...
nishantraj656/Complex
src/app/super-admin/super-admin.routing.ts
import { Routes, RouterModule } from '@angular/router'; import { MainComponent } from './main/main.component'; const appRoutes: Routes = [ {path:'Admin',component:MainComponent, children:[ ] } ]; export const routing = RouterModule.forRoot(appRoutes);
nishantraj656/Complex
src/app/pages/flat-owner/flatOwner.routing.ts
import { Routes, RouterModule } from '@angular/router'; import { ShowComponent } from './show/show.component'; import { FormComponent } from './form/form.component'; import { ListComponent } from './list/list.component'; export const childRoutes: Routes = [ { path: '', redirectTo: 'owner', pa...
nishantraj656/Complex
src/Model/Address.ts
<reponame>nishantraj656/Complex export class Address { public street:string; public city:string; public state:string; public country:string; constructor(street:string,city:string,state:string,country:string,street1:string) { this.street = street + street1; this.city = city; ...
nishantraj656/Complex
src/Model/Wings.ts
<gh_stars>0 export class Wings { public label:string; public floor:number; public start:number; public end:number; constructor(label:string,floor:string,start:string,end:string) { this.label = label; this.floor = <number> <any>floor; this.start = <number> <any>start; ...
nishantraj656/Complex
src/app/pages/pages.routing.ts
import { Routes, RouterModule } from '@angular/router'; import { PagesComponent } from './pages.component'; import { LoginComponent } from './login/login.component'; import { EmployeeComponent } from './employee/employee.component'; import { MaintenancesComponent } from './maintenances/maintenances.component'; import ...
nishantraj656/Complex
src/app/pages/employee/employee.routing.ts
import { Routes, RouterModule } from '@angular/router'; import { EmployeeComponent } from './employee.component'; import { EmployeeShowComponent } from './employee-show/employee-show.component'; import { EmployeeFormComponent } from './employee-form/employee-form.component'; export const childRoutes: Routes = [ { ...
nishantraj656/Complex
src/app/pages/employee/employee-form/employee-form.component.ts
<filename>src/app/pages/employee/employee-form/employee-form.component.ts import { Component, OnInit } from '@angular/core'; import { FileUploader } from 'ng2-file-upload'; @Component({ selector: 'app-employee-form', templateUrl: './employee-form.component.html', styleUrls: ['./employee-form.component.scss'] }...
nishantraj656/Complex
src/app/super-admin/super-admin.module.ts
<filename>src/app/super-admin/super-admin.module.ts import { NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; import { MainComponent } from './main/main.component'; import { routing } from './super-admin.routing'; import { PagesModule } from '../pages/pages.module'; import { LayoutModule...
belugafm/beluga-v3-api-server
src/domain/repository/command/LoginCredential.ts
import { LoginCredentialEntity } from "../../entity/LoginCredential" export interface ILoginCredentialCommandRepository { add(credential: LoginCredentialEntity): Promise<boolean> update(credential: LoginCredentialEntity): Promise<boolean> delete(credential: LoginCredentialEntity): Promise<boolean> }
belugafm/beluga-v3-api-server
src/infrastructure/prisma/repository/query/ChannelTimeline.ts
import { IChannelTimelineQueryRepository, Parameters, SortOrder, } from "../../../../domain/repository/query/ChannelTimeline" import { RepositoryError, UnknownRepositoryError } from "../../../../domain/repository/RepositoryError" import { MessageEntity } from "../../../../domain/entity/Message" import { Pr...
belugafm/beluga-v3-api-server
src/web/endpoint/debug.ts
import debug, { facts } from "../api/methods/debug" import { TurboServer } from "../turbo" export default (server: TurboServer) => { server.get(facts, async (req, res, params) => { const remoteIpAddress = req.headers["x-real-ip"] await debug({}, remoteIpAddress, null) return { ...
belugafm/beluga-v3-api-server
src/infrastructure/mongoose/repository/command/LoginCredential.ts
import { EmptyTransactionRepository, TransactionRepository, TransactionRepositoryInterface, } from "../Transaction" import { LoginCredentialModel, schemaVersion } from "../../schema/LoginCredential" import { RepositoryError, UnknownRepositoryError, } from "../../../../domain/repository/RepositoryErr...
belugafm/beluga-v3-api-server
src/domain/validation/types/boolean.ts
import { CommonErrorMessages, ValidationError } from "../error" import { PropertyValidator } from "../PropertyValidator" export function boolean() { return new PropertyValidator<boolean>({}, [ (value: any) => { if (typeof value !== "boolean") { throw new ValidationError(CommonE...
belugafm/beluga-v3-api-server
src/web/api/methods/debug.ts
<filename>src/web/api/methods/debug.ts import { InternalErrorSpec, UnexpectedErrorSpec } from "../error" import { MethodFacts, defineArguments, defineErrors, defineMethod } from "../define" import { ContentTypes } from "../facts/content_type" import { HttpMethods } from "../facts/http_method" import { MethodIdentifier...
belugafm/beluga-v3-api-server
tests/prisma/application/account/SignInWithPassword.ts
<gh_stars>1-10 import { ErrorCodes, SignInWithPasswordApplication } from "../../../../src/application/signin/SignInWithPassword" import { generateRandomIpAddress, generateRandomName } from "../../functions" import { ApplicationError } from "../../../../src/application/ApplicationError" import { AuthenticityTokenEntity...
belugafm/beluga-v3-api-server
src/web/api/methods/timeline/channel.ts
import * as vs from "../../../../domain/validation" import { ChannelReadStateCommandRepository, ChannelReadStateQueryRepository, ChannelTimelineQueryRepository, TransactionRepository, } from "../../../repositories" import { InternalErrorSpec, UnexpectedErrorSpec, raise } from "../../error" import { Met...
belugafm/beluga-v3-api-server
src/web/endpoint/channel/create.ts
import createChannel, { facts } from "../../api/methods/channel/create" import { TurboServer } from "../../turbo" import { getRemoteIpAddress } from "../../remoteIpAddress" export default (server: TurboServer) => { server.post(facts, async (req, res, params) => { const remoteIpAddress = getRemoteIpAddress...
belugafm/beluga-v3-api-server
src/config/app.default.ts
const config: { server: { domain: string port: number https: boolean get_base_url: () => string } private_api: { allowed_ip_addresses: string[] } terms_of_service: { version: string } admin: { name: string password: string }...
belugafm/beluga-v3-api-server
src/web/api/methods/account/signin.ts
import * as vs from "../../../../domain/validation" import { AuthenticityTokenCommandRepository, LoginCredentialQueryRepository, LoginSessionCommandRepository, UserQueryRepository, } from "../../../repositories" import { ErrorCodes, SignInWithPasswordApplication, } from "../../../../application...
belugafm/beluga-v3-api-server
src/domain/repository/query/ChannelGroupTimeline.ts
<reponame>belugafm/beluga-v3-api-server import { ChannelGroupdId, MessageId } from "../../types" export const SortOrder = { Ascending: "ascending", Descending: "descending", } as const export type Parameters = { sortOrder: typeof SortOrder[keyof typeof SortOrder] limit: number sinceId?: MessageId ...
belugafm/beluga-v3-api-server
tests/prisma/timeline/ChannelGroupTimeline.ts
<reponame>belugafm/beluga-v3-api-server import { generateRandomIpAddress, generateRandomName } from "../functions" import { ChannelEntity } from "../../../src/domain/entity/Channel" import { ChannelGroupEntity } from "../../../src/domain/entity/ChannelGroup" import { IChannelCommandRepository } from "../../../src/doma...
belugafm/beluga-v3-api-server
tests/domain/entity/ChannelGroup.test.ts
<filename>tests/domain/entity/ChannelGroup.test.ts import { ChannelGroupEntity, ErrorCodes } from "../../../src/domain/entity/ChannelGroup" import { DomainError } from "../../../src/domain/DomainError" const id = 1 const name = "beluga" const uniqueName = "fuga" const level = 0 const parentId = 1 const createdBy = 1 ...
belugafm/beluga-v3-api-server
src/cache/repository/LoginSessions.ts
<filename>src/cache/repository/LoginSessions.ts import { LoginSessionEntity } from "../../domain/entity/LoginSession" export interface ILoginSessionsQueryRepository { findBySessionId(sessionId: string): Promise<LoginSessionEntity> }
belugafm/beluga-v3-api-server
tests/prisma/application/channel/CreateChannel.test.ts
import * as repo from "../../../../src/infrastructure/prisma/repository" import { CreateChannelApplicationTests } from "./CreateChannel" jest.setTimeout(60000) describe("CreateChannelApplication", () => { const testing = new CreateChannelApplicationTests() test("Normal", async () => { await testing.t...
belugafm/beluga-v3-api-server
src/domain/repository/command/AuthenticityToken.ts
<reponame>belugafm/beluga-v3-api-server<gh_stars>1-10 import { AuthenticityTokenEntity } from "../../entity/AuthenticityToken" export interface IAuthenticityTokenCommandRepository { add(token: AuthenticityTokenEntity): Promise<boolean> delete(token: AuthenticityTokenEntity): Promise<boolean> }
belugafm/beluga-v3-api-server
src/domain/validation/validator/string/isString.ts
import { CommonErrorMessages, ValidationError } from "../../error" import { isString } from "../../functions" export type Options = {} export function checkIsString(value: string, options: Options): void { if (isString(value) !== true) { throw new ValidationError(CommonErrorMessages.InvalidType) } }
belugafm/beluga-v3-api-server
tests/prisma/application/timeline/Channel.test.ts
import * as repo from "../../../../src/infrastructure/prisma/repository" import { ChannelTimelineApplicationTests } from "./Channel" jest.setTimeout(60000) describe("ChannelTimelineApplication", () => { const testing = new ChannelTimelineApplicationTests() test("Normal", async () => { await testing.t...
belugafm/beluga-v3-api-server
src/infrastructure/prisma/repository/query/Channel.ts
<reponame>belugafm/beluga-v3-api-server import { Channel, PrismaClient } from "@prisma/client" import { ChannelGroupdId, ChannelId, UserId } from "../../../../domain/types" import { IChannelQueryRepository, SortBy, SortOrder } from "../../../../domain/repository/query/Channel" import { RepositoryError, UnknownRepositor...
belugafm/beluga-v3-api-server
tests/domain/entity/Channel.test.ts
<gh_stars>1-10 import { ChannelEntity, ErrorCodes } from "../../../src/domain/entity/Channel" import { DomainError } from "../../../src/domain/DomainError" const id = 1 const name = "beluga" const uniqueName = "fuga" const parentChannelGroupId = 1 const createdBy = 1 const createdAt = new Date() describe("ChannelEnt...
belugafm/beluga-v3-api-server
src/infrastructure/storage/CloudStorage.ts
import { IStorageCommandRepository } from "../../domain/repository/command/Storage" import { RepositoryError } from "../../domain/repository/RepositoryError" import { Storage } from "@google-cloud/storage" const storage = new Storage() // @ts-ignore const bucket = storage.bucket(process.env.GCLOUD_STORAGE_BUCKET) exp...
belugafm/beluga-v3-api-server
src/web/endpoint/channel_group/list_channel_groups.ts
import listChannelGroups, { facts } from "../../api/methods/channel_group/list_channel_groups" import { TurboServer } from "../../turbo" import { getRemoteIpAddress } from "../../remoteIpAddress" export default (server: TurboServer) => { server.get(facts, async (req, res, params) => { const remoteIpAddres...
belugafm/beluga-v3-api-server
src/infrastructure/mongoose/repository/query/LoginCredential.ts
<reponame>belugafm/beluga-v3-api-server<filename>src/infrastructure/mongoose/repository/query/LoginCredential.ts import { EmptyTransactionRepository, TransactionRepository, TransactionRepositoryInterface, } from "../Transaction" import { RepositoryError, UnknownRepositoryError, } from "../../../../d...
belugafm/beluga-v3-api-server
src/domain/validation/types/entityId.ts
import { ChannelGroupdId, ChannelId, ChannelReadStateId, EntityId, FileId, MessageId, UserId } from "../../types" import { CommonErrorMessages, ValidationError } from "../error" import { PropertyValidator } from "../PropertyValidator" import { isInteger } from "../functions" export function checkIsEntityId(value: Ent...
belugafm/beluga-v3-api-server
src/web/endpoint/account/signup.ts
<filename>src/web/endpoint/account/signup.ts import signupWithoutName, { facts } from "../../api/methods/account/signup_without_name" import { TurboServer } from "../../turbo" import config from "../../../config/app" import { getRemoteIpAddress } from "../../remoteIpAddress" export default (server: TurboServer) => { ...
belugafm/beluga-v3-api-server
src/domain/repository/query/AuthenticityToken.ts
<filename>src/domain/repository/query/AuthenticityToken.ts import { AuthenticityTokenEntity } from "../../entity/AuthenticityToken" export interface IAuthenticityTokenQueryRepository { findBySessionId(sessionId: string): Promise<AuthenticityTokenEntity | null> }
belugafm/beluga-v3-api-server
src/domain/repository/command/File.ts
<filename>src/domain/repository/command/File.ts<gh_stars>1-10 import { FileEntity } from "../../entity/File" import { FileId } from "../../types" export interface IFileCommandRepository { add(file: FileEntity): Promise<FileId> delete(file: FileEntity): Promise<boolean> update(file: FileEntity): Promise<boo...
belugafm/beluga-v3-api-server
tests/prisma/infrastructure/repository/LoginCredentials.test.ts
import { LoginCredentialCommandRepository } from "../../../../src/infrastructure/prisma/repository/command/LoginCredential" import { LoginCredentialEntity } from "../../../../src/domain/entity/LoginCredential" import { LoginCredentialQueryRepository } from "../../../../src/infrastructure/prisma/repository/query/LoginCr...
belugafm/beluga-v3-api-server
src/infrastructure/prisma/repository/index.ts
<gh_stars>1-10 export { LoginCredentialQueryRepository } from "./query/LoginCredential" export { LoginSessionQueryRepository } from "./query/LoginSession" export { UserQueryRepository } from "./query/User" export { AuthenticityTokenQueryRepository } from "./query/AuthenticityToken" export { ChannelGroupQueryRepository ...
belugafm/beluga-v3-api-server
src/domain/validation/types/date.ts
<filename>src/domain/validation/types/date.ts<gh_stars>1-10 import { PropertyValidator } from "../PropertyValidator" import { checkIsDate } from "../validator/date/isDate" import { checkMaxValue } from "../validator/number/maxValue" import { checkMinValue } from "../validator/number/minValue" export function date() { ...
belugafm/beluga-v3-api-server
src/domain/service/CheckUserNameAvailability.ts
import { DomainError } from "../DomainError" import { IUserQueryRepository } from "../repository/query/User" export const ErrorCodes = { NameTaken: "name_taken", } as const export class CheckUserNameAvailabilityService { private usersRepository: IUserQueryRepository constructor(usersRepository: IUserQuery...
belugafm/beluga-v3-api-server
src/web/endpoint/upload/media.ts
<gh_stars>1-10 import upload, { facts } from "../../api/methods/upload/media" import { TurboServer } from "../../turbo" import { getRemoteIpAddress } from "../../remoteIpAddress" export default (server: TurboServer) => { server.post(facts, async (req, res, params) => { const remoteIpAddress = getRemoteIpA...
belugafm/beluga-v3-api-server
src/domain/validation/types/number.ts
import { PropertyValidator } from "../PropertyValidator" import { checkIsInteger } from "../validator/number/isNumber" import { checkMaxValue } from "../validator/number/maxValue" import { checkMinValue } from "../validator/number/minValue" export type Options = { minValue?: number maxValue?: number regexp...
belugafm/beluga-v3-api-server
src/domain/repository/query/ChannelReadState.ts
import { ChannelId, UserId } from "../../types" import { ChannelReadStateEntity } from "../../entity/ChannelReadState" export interface IChannelReadStateQueryRepository { find(channelId: ChannelId, userId: UserId): Promise<ChannelReadStateEntity | null> }
belugafm/beluga-v3-api-server
src/application/ApplicationError.ts
export class ApplicationError extends Error { code?: string constructor(code: string, message?: string) { super() this.code = code if (message) { this.message = message } Object.setPrototypeOf(this, ApplicationError.prototype) } }
belugafm/beluga-v3-api-server
src/domain/entity/File.ts
<gh_stars>1-10 import { FileId, FileJsonObjectT, UserId } from "../types" import { IsAnyString, IsBoolean, IsDate, IsFileId, IsFileType, IsInteger, IsUserId } from "../validation/decorators" import { Entity } from "./Entity" import config from "../../config/app" import crypto from "crypto" import pathlib from "path" ...
belugafm/beluga-v3-api-server
src/domain/entity/Channel.ts
import { ChannelGroupdId, ChannelId, ChannelJsonObjectT, MessageId, UserId } from "../types" import { IsChannelDescription, IsChannelGroupId, IsChannelId, IsChannelName, IsChannelUniqueName, IsDate, IsInteger, IsMessageId, IsString, IsUserId, } from "../validation/decorators" im...
belugafm/beluga-v3-api-server
src/web/api/methods/channel/show.ts
import * as vs from "../../../../domain/validation" import { ChannelGroupQueryRepository, ChannelQueryRepository } from "../../../repositories" import { InternalErrorSpec, UnexpectedErrorSpec, raise } from "../../error" import { MethodFacts, defineArguments, defineErrors, defineMethod } from "../../define" import { A...
belugafm/beluga-v3-api-server
src/web/turbo/turbo.ts
<gh_stars>1-10 import cookie from "cookie" import multipart from "./multipart" import turbo from "turbo-http" export class Request { _req: turbo.Request headers: { [key: string]: string } cookies: any url: string = "" query: any = null body: any constructor(req: turbo.Request) { thi...
belugafm/beluga-v3-api-server
src/domain/validation/types/message/index.ts
export { text } from "./text" export { textStyle } from "./textStyle"
belugafm/beluga-v3-api-server
src/infrastructure/storage/NFS.ts
<gh_stars>1-10 import { IStorageCommandRepository } from "../../domain/repository/command/Storage" import { RepositoryError } from "../../domain/repository/RepositoryError" import config from "../../config/app" import fs from "fs" import pathlib from "path" export class StorageCommandRepository implements IStorageComm...
belugafm/beluga-v3-api-server
src/domain/validation/types/url.ts
import { Options } from "./string" import { PropertyValidator } from "../PropertyValidator" import { checkIsString } from "../validator/string/isString" import { checkRegexPattern } from "../validator/string/regex" export function url() { const options: Options = { regexp: new RegExp(/^https?:\/\/.+\..+$/)...
belugafm/beluga-v3-api-server
src/infrastructure/prisma/repository/command/ChannelReadState.ts
import { ChannelReadState, PrismaClient } from "@prisma/client" import { RepositoryError, UnknownRepositoryError } from "../../../../domain/repository/RepositoryError" import { ChangeEventHandler } from "../../../ChangeEventHandler" import { ChannelReadStateEntity } from "../../../../domain/entity/ChannelReadState" im...
belugafm/beluga-v3-api-server
src/web/endpoint/channel_group/create.ts
<gh_stars>1-10 import createChannelGroup, { facts } from "../../api/methods/channel_group/create" import { TurboServer } from "../../turbo" import { getRemoteIpAddress } from "../../remoteIpAddress" export default (server: TurboServer) => { server.post(facts, async (req, res, params) => { const remoteIpAd...
belugafm/beluga-v3-api-server
src/domain/repository/RepositoryError.ts
export class RepositoryError extends Error { code?: number | string constructor(message: string, stack?: string, code?: string | number) { super() this.code = code this.message = message this.stack = stack } } export class UnknownRepositoryError extends RepositoryError { ...
belugafm/beluga-v3-api-server
src/infrastructure/mongoose/schema/LoginCredential.ts
import mongoose, { Document, Schema } from "mongoose" import { LoginCredentialEntity } from "../../../domain/entity/LoginCredential" import { ObjectId } from "mongodb" export const schemaVersion = 1 export interface LoginCredentialSchema extends Document { _id: mongoose.Types.ObjectId user_id: mongoose.Types...
belugafm/beluga-v3-api-server
src/web/repositories.default.ts
export { LoginSessionCommandRepository } from "../infrastructure/prisma/repository/command/LoginSession" export { LoginSessionQueryRepository } from "../infrastructure/prisma/repository/query/LoginSession" export { LoginCredentialCommandRepository } from "../infrastructure/prisma/repository/command/LoginCredential" exp...
belugafm/beluga-v3-api-server
src/domain/repository/query/ThreadTimeline.ts
<filename>src/domain/repository/query/ThreadTimeline.ts import { MessageEntity } from "../../entity/Message" import { MessageId } from "../../types" export const SortBy = { CreatedAt: "CreatedAt", } as const export const SortOrder = { Ascending: "Ascending", Descending: "Descending", } as const export ty...
belugafm/beluga-v3-api-server
src/infrastructure/ChangeEventHandler.ts
export class ChangeEventHandler { static subscribe(func: (changedId: any) => void) {} static deleteAllEventHandlers() {} protected static _eventListeners: ((changedId: any) => void)[] = [] protected async emitChanges(changedId: number | string) {} constructor(cls: any) { if (cls.hasOwnProper...
belugafm/beluga-v3-api-server
src/web/api/methods/channel_group/list_channels.ts
import * as vs from "../../../../domain/validation" import { ChannelGroupQueryRepository, ChannelReadStateQueryRepository, MessageQueryRepository, } from "../../../repositories" import { InternalErrorSpec, UnexpectedErrorSpec, raise } from "../../error" import { MethodFacts, defineArguments, defineErrors, ...
belugafm/beluga-v3-api-server
src/domain/validation/index.ts
<reponame>belugafm/beluga-v3-api-server<gh_stars>1-10 export { boolean } from "./types/boolean" export { integer } from "./types/number" export { string } from "./types/string" export * as user from "./types/user" export * as channelGroup from "./types/channel_group" export * as channel from "./types/channel" export * ...
belugafm/beluga-v3-api-server
src/domain/repository/command/HomeTimeline.ts
import { MessageEntity } from "../../entity/Message" import { UserEntity } from "../../entity/User" export interface IHomeTimelineCommandRepository { add(message: MessageEntity, user: UserEntity): Promise<boolean> }
belugafm/beluga-v3-api-server
src/@types/ffmpeg-extract-frames.d.ts
<reponame>belugafm/beluga-v3-api-server declare module "ffmpeg-extract-frames" { function extractFrames(opt: { input: string; output: string; offsets: number[] }): any export = extractFrames }
belugafm/beluga-v3-api-server
tests/prisma/application/message/PostMessage.ts
<reponame>belugafm/beluga-v3-api-server<gh_stars>1-10 import { ErrorCodes, PostMessageApplication } from "../../../../src/application/message/PostMessage" import { generateRandomIpAddress, generateRandomName, sleep } from "../../functions" import { ApplicationError } from "../../../../src/application/ApplicationError"...
belugafm/beluga-v3-api-server
src/domain/repository/command/ChannelGroup.ts
<filename>src/domain/repository/command/ChannelGroup.ts import { ChannelGroupEntity } from "../../entity/ChannelGroup" import { ChannelGroupdId } from "../../types" export interface IChannelGroupCommandRepository { add(channel: ChannelGroupEntity): Promise<ChannelGroupdId> delete(channel: ChannelGroupEntity): ...
belugafm/beluga-v3-api-server
tests/prisma/functions.ts
import crypto from "crypto" export function sleep(sec: number) { return new Promise((resolve) => { setTimeout(() => { resolve(null) }, sec * 1000) }) } export const generateRandomName = (length: number): string => { const S = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXY...
belugafm/beluga-v3-api-server
src/infrastructure/prisma/repository/command/Channel.ts
<reponame>belugafm/beluga-v3-api-server import { Channel, PrismaClient } from "@prisma/client" import { RepositoryError, UnknownRepositoryError } from "../../../../domain/repository/RepositoryError" import { ChangeEventHandler } from "../../../ChangeEventHandler" import { ChannelEntity } from "../../../../domain/entit...
belugafm/beluga-v3-api-server
src/domain/repository/Media.ts
<gh_stars>1-10 import { FileEntity } from "../entity/File" import { UserId } from "../types" export type ReturnType = { file: FileEntity buffer: Buffer }[] export interface IMediaRepository { prepareFilesToUpload(userId: UserId, buffer: Buffer): Promise<ReturnType> }
belugafm/beluga-v3-api-server
src/web/endpoint/channel_group/list_channels.ts
import listChannels, { facts } from "../../api/methods/channel_group/list_channels" import { TurboServer } from "../../turbo" import { getRemoteIpAddress } from "../../remoteIpAddress" export default (server: TurboServer) => { server.get(facts, async (req, res, params) => { const remoteIpAddress = getRemo...
belugafm/beluga-v3-api-server
src/web/api/identifier.ts
export const MethodIdentifiers = { Login: "account/signin", AuthenticateUserWithCookie: "auth/cookie/authenticate", GetTwitterRequestToken: "auth/twitter/request_token", AuthenticateUserWithTwitter: "auth/twitter/authenticate", CreateAccount: "account/signup", SignInToAccount: "account/signin", ...
belugafm/beluga-v3-api-server
src/infrastructure/prisma/repository/command/User.ts
<gh_stars>1-10 import { PrismaClient, User } from "@prisma/client" import { RepositoryError, UnknownRepositoryError } from "../../../../domain/repository/RepositoryError" import { ChangeEventHandler } from "../../../ChangeEventHandler" import { IUserCommandRepository } from "../../../../domain/repository/command/User"...
belugafm/beluga-v3-api-server
src/web/api/methods/channel/list_channels.ts
<filename>src/web/api/methods/channel/list_channels.ts import * as vs from "../../../../domain/validation" import { InternalErrorSpec, UnexpectedErrorSpec, raise } from "../../error" import { MethodFacts, defineArguments, defineErrors, defineMethod } from "../../define" import { SortBy, SortOrder } from "../../../../d...
belugafm/beluga-v3-api-server
src/web/api/methods/upload/media.ts
<filename>src/web/api/methods/upload/media.ts import * as vs from "../../../../domain/validation" import { FileCommandRepository, MediaRepository, StorageCommandRepository, TransactionRepository, UserQueryRepository, } from "../../../repositories" import { InternalErrorSpec, InvalidAuth, Unexpected...
belugafm/beluga-v3-api-server
src/infrastructure/ipqualityscore/config.default.ts
const config: { enabled: boolean api_secret: string } = { enabled: false, api_secret: "your_secret", } export default config
belugafm/beluga-v3-api-server
src/application/message/DeleteMessage.ts
<gh_stars>1-10 import { MessageId, UserId } from "../../domain/types" import { ApplicationError } from "../ApplicationError" import { DeleteMessagePermission } from "../../domain/permission/DeleteMessage" import { DomainError } from "../../domain/DomainError" import { IChannelCommandRepository } from "../../domain/rep...
belugafm/beluga-v3-api-server
src/web/endpoint/channel/list_channels.ts
import listChannels, { facts } from "../../api/methods/channel/list_channels" import { TurboServer } from "../../turbo" import { getRemoteIpAddress } from "../../remoteIpAddress" export default (server: TurboServer) => { server.get(facts, async (req, res, params) => { const remoteIpAddress = getRemoteIpAd...
belugafm/beluga-v3-api-server
src/web/auth.ts
import { CookieAuthenticationApplication } from "../application/authentication/Cookie" import { MethodFacts } from "./api/define" import { UserEntity } from "../domain/entity/User" export class Authenticator { private cookieAuthentication: CookieAuthenticationApplication constructor(cookieAuthentication: Cooki...
belugafm/beluga-v3-api-server
src/domain/service/ExtractEntitiesFromText.ts
<filename>src/domain/service/ExtractEntitiesFromText.ts import sharp from "sharp" export class RemoveImageExifService { async process(buffer: Buffer): Promise<[Buffer, sharp.WriteableMetadata]> { const imageWithExif = sharp(buffer, { animated: true }) const metadata = await imageWithExif.metadata()...
belugafm/beluga-v3-api-server
src/web/api/facts/http_method.ts
<filename>src/web/api/facts/http_method.ts export const HttpMethods = { POST: "POST", GET: "GET", } as const export type HttpMethodUnion = keyof typeof HttpMethods
belugafm/beluga-v3-api-server
src/web/api/methods/channel_group/show.ts
import * as vs from "../../../../domain/validation" import { InternalErrorSpec, UnexpectedErrorSpec, raise } from "../../error" import { MethodFacts, defineArguments, defineErrors, defineMethod } from "../../define" import { ChannelGroupEntity } from "../../../../domain/entity/ChannelGroup" import { ChannelGroupQuery...
belugafm/beluga-v3-api-server
src/infrastructure/prisma/repository/command/LoginCredential.ts
import { RepositoryError, UnknownRepositoryError, } from "../../../../domain/repository/RepositoryError" import { ChangeEventHandler } from "../../../ChangeEventHandler" import { ILoginCredentialCommandRepository } from "../../../../domain/repository/command/LoginCredential" import { LoginCredentialEntity } fr...
belugafm/beluga-v3-api-server
src/infrastructure/prisma/repository/command/ChannelGroupTimeline.ts
<reponame>belugafm/beluga-v3-api-server<filename>src/infrastructure/prisma/repository/command/ChannelGroupTimeline.ts import { RepositoryError, UnknownRepositoryError } from "../../../../domain/repository/RepositoryError" import { ChannelGroupEntity } from "../../../../domain/entity/ChannelGroup" import { IChannelGrou...