repo_name
stringlengths
5
122
path
stringlengths
3
232
text
stringlengths
6
1.05M
buiminhhai1/mhh-backend-service
src/common/configurations/admin-context.middleware.ts
<reponame>buiminhhai1/mhh-backend-service import { ForbiddenException, Injectable, Logger, NestMiddleware } from "@nestjs/common"; import { NguoiDungVaiTro } from "../../entities"; import { CustomHttpRequest } from "../interfaces"; @Injectable() export class AdminContextMiddleware implements NestMiddleware { private...
buiminhhai1/mhh-backend-service
src/modules/nguoi-nhan/nguoi-nhan.service.ts
import { Injectable } from "@nestjs/common"; import { NguoiNhanEntity } from "../../entities"; import { NguoiNhanDTO } from "./nguoi-nhan.dto"; import { NguoiNhanRepository } from "./nguoi-nhan.repository"; @Injectable() export class NguoiNhanService { constructor(private readonly nguoiNhanRepo: NguoiNhanRepository)...
buiminhhai1/mhh-backend-service
src/modules/mua-hang/controllers/phieu-dat-hang.controller.ts
<reponame>buiminhhai1/mhh-backend-service import { Body, Controller, Delete, Get, Param, Patch, Post, Query } from "@nestjs/common"; import { ApiTags } from "@nestjs/swagger"; import { PhieuDatHangEntity } from "../../../entities"; import { PhieuDatHangDTO, RecieveDateDTO } from "../dto"; import { PhieuDatHangService }...
buiminhhai1/mhh-backend-service
src/common/configurations/index.ts
export * from './auth.middleware'; export * from './health-config.service'; export * from './jwt-configuration.provider'; export * from './tenant-context.middleware'; export * from './admin-context.middleware';
buiminhhai1/mhh-backend-service
src/modules/tac-gia/tac-gia.dto.ts
import { ApiProperty } from "@nestjs/swagger"; import { IsNotEmpty, IsOptional, IsUrl } from "class-validator"; export class TacGiaDTO { @ApiProperty() @IsNotEmpty() public ten: string; @ApiProperty() @IsNotEmpty() public ngaySinh: Date; @ApiProperty() @IsOptional() public ngayMat: Date; @ApiPro...
buiminhhai1/mhh-backend-service
src/modules/database/database.module.ts
import { DynamicModule } from '@nestjs/common'; import { TypeOrmModule } from '@nestjs/typeorm'; import { DatabaseCoreModule } from './database-core.module'; import { TenantAwareContext, TenantAwareContextProvider } from './providers'; import { TypeOrmConfigService } from './services'; import { TenantMigrationService }...
buiminhhai1/mhh-backend-service
src/entities/index.ts
<reponame>buiminhhai1/mhh-backend-service export * from './chi-tiet-ban-hang.entity'; export * from './chi-tiet-phieu-dat-hang.entity'; export * from './loai-sach.entity'; export * from './nguoi-dung.entity'; export * from './nguoi-nhan.entity'; export * from './phieu-dat-hang.entity'; export * from './sach.entity'; ex...
buiminhhai1/mhh-backend-service
src/modules/auth/auth.controller.ts
import { Body, Controller, Get, Patch, Post, Query, UnauthorizedException, UseGuards } from '@nestjs/common'; import { ApiTags } from '@nestjs/swagger'; import { NguoiDungEntity } from '../../entities'; import { NguoiDungService } from '../nguoi-dung'; import { AdminGuard } from './admin.guard'; import { ChangePassword...
buiminhhai1/mhh-backend-service
src/modules/sach/sach.service.ts
<gh_stars>0 import { Inject, Injectable } from '@nestjs/common'; import { DEFAULT_LIMIT, DEFAULT_PAGE } from './../../common'; import { SachDTO, QuerySachDTO, GenericSachReponse, QueryPaginationDTO, UpdateProcessStatus } from './sach.dto'; import { SachEntity } from '../../entities'; import { TenantAwareContext } from ...
buiminhhai1/mhh-backend-service
src/modules/mua-hang/index.ts
<gh_stars>0 export * from "./mua-hang.module"
buiminhhai1/mhh-backend-service
src/modules/auth/auth.dto.ts
import { ApiProperty } from '@nestjs/swagger'; import { IsEmail, IsEnum, IsNotEmpty, IsString, IsUUID } from 'class-validator'; import { NguoiDungEntity, NguoiDungVaiTro } from '../../entities/nguoi-dung.entity'; export class TokenJWTDTO { public access_token: string; } export class LoginDTO { @ApiProperty() @I...
buiminhhai1/mhh-backend-service
src/modules/database/services/tenant-migration.service.ts
import { Injectable, Logger } from '@nestjs/common'; import { Connection } from 'typeorm'; @Injectable() export class TenantMigrationService { constructor(private readonly databaseConnection: Connection) {} private readonly logger = new Logger(TenantMigrationService.name); async onNewTenant(tenantId: string) { ...
buiminhhai1/mhh-backend-service
src/modules/loai-sach/loai-sach.repository.ts
<gh_stars>0 import { LoaiSachEntity } from '../../entities'; import { EntityRepository, Repository } from 'typeorm'; @EntityRepository(LoaiSachEntity) export class LoaiSachRepository extends Repository<LoaiSachEntity> {}
buiminhhai1/mhh-backend-service
src/common/utils/scan-components.ts
<gh_stars>0 const isNestComponent = (ob: any) => { if (ob.provide) return true; return Reflect.getMetadataKeys(ob).length > 0; }; const isTypeORMEntity = (ob: any) => ob.prototype?.constructor; export const scanComponents = (object: any): any[] => Object.values(object).filter(isNestComponent); export const scanE...
buiminhhai1/mhh-backend-service
src/modules/nguoi-nhan/nguoi-nhan.module.ts
<filename>src/modules/nguoi-nhan/nguoi-nhan.module.ts import * as repositories from './nguoi-nhan.repository'; import * as controllers from './nguoi-nhan.controller'; import * as services from './nguoi-nhan.service'; import { Module } from '@nestjs/common'; import { TypeOrmModule } from '@nestjs/typeorm'; import { scan...
buiminhhai1/mhh-backend-service
src/common/configurations/jwt-configuration.provider.ts
import { Logger } from '@nestjs/common'; import { JwtModuleOptions } from '@nestjs/jwt'; import { authSecret } from '../constants'; const logger = new Logger('JWTConfigurationProvider'); export const JWTConfigurationProvider = { useFactory: (): JwtModuleOptions => { logger.log('Setting up JWT module'); retu...
buiminhhai1/mhh-backend-service
src/modules/tac-gia/tac-gia.module.ts
<reponame>buiminhhai1/mhh-backend-service<filename>src/modules/tac-gia/tac-gia.module.ts import { Module } from "@nestjs/common"; import * as repositories from './tac-gia.repository'; import * as controllers from './tac-gia.controller'; import * as services from './tac-gia.service'; import { TypeOrmModule } from "@nest...
buiminhhai1/mhh-backend-service
src/entities/phieu-dat-hang.entity.ts
import { BaseEntity } from './base'; import { Column, Entity, ManyToOne, OneToMany } from 'typeorm'; import { ChiTietPhieuDatHangEntity } from './chi-tiet-phieu-dat-hang.entity'; import { NguoiDungEntity } from './nguoi-dung.entity'; import { NguoiNhanEntity } from './nguoi-nhan.entity'; @Entity() export class PhieuDa...
buiminhhai1/mhh-backend-service
src/modules/nguoi-dung/nguoi-dung.repository.ts
import { NguoiDungEntity } from '../../entities'; import { EntityRepository, Repository } from 'typeorm'; @EntityRepository(NguoiDungEntity) export class NguoiDungRepository extends Repository<NguoiDungEntity> {}
buiminhhai1/mhh-backend-service
src/common/configurations/health-config.service.ts
<reponame>buiminhhai1/mhh-backend-service import { Injectable } from '@nestjs/common'; import { TerminusEndpoint, TerminusModuleOptions, TerminusOptionsFactory, TypeOrmHealthIndicator, } from '@nestjs/terminus'; @Injectable() export class HealthConfigService implements TerminusOptionsFactory { constructor(pr...
buiminhhai1/mhh-backend-service
src/entities/tac-gia.entity.ts
<filename>src/entities/tac-gia.entity.ts<gh_stars>0 import { BaseEntity } from './base'; import { Column, Entity, IsNull, OneToMany } from 'typeorm'; import { SachEntity } from './sach.entity'; @Entity() export class TacGiaEntity extends BaseEntity { @Column() public ten: string; @Column() public ngaySinh: Dat...
buiminhhai1/mhh-backend-service
src/modules/nguoi-dung/index.ts
export * from './nguoi-dung.module'; export * from './nguoi-dung.repository'; export * from './nguoi-dung.service';
buiminhhai1/mhh-backend-service
src/modules/mua-hang/dto/phieu-dat-hang.dto.ts
import { NguoiNhanEntity, NguoiDungEntity } from './../../../entities/'; import { ApiProperty } from "@nestjs/swagger"; import { IsNotEmpty, IsOptional } from "class-validator"; import { ChiTietPhieuDatHangDTO } from './chi-tiet-phieu-dat-hang.dto'; export class PhieuDatHangDTO { @ApiProperty() @IsNotEmpty() nga...
AutoCoderr/MegaBot
Commands/React/DeleteReaction.ts
<filename>Commands/React/DeleteReaction.ts<gh_stars>1-10 import low = require("lowdb") import FileSync = require("lowdb/adapters/FileSync") import {MessageAct} from "../../Class/MessageAct"; export class DeleteReaction extends MessageAct { static match(message) { return message } static Alert(rol...
claudiospizzi/node-red-contrib-mystrom-switch
src/nodes/mystrom-switch-relay/mystrom-switch-relay.html/index.ts
<filename>src/nodes/mystrom-switch-relay/mystrom-switch-relay.html/index.ts import { EditorRED } from 'node-red'; import { MyStromSwitchRelayEditorNodeProperties } from './modules/types'; declare const RED: EditorRED; RED.nodes.registerType<MyStromSwitchRelayEditorNodeProperties>('mystrom-switch-relay', { category:...
claudiospizzi/node-red-contrib-mystrom-switch
src/nodes/mystrom-switch-config/modules/types.ts
import { Node, NodeDef } from 'node-red'; import { MyStromSwitchConfigOptions } from '../shared/types'; export interface MyStromSwitchConfigNodeDef extends NodeDef, MyStromSwitchConfigOptions {} export interface MyStromSwitchConfigNode extends Node { address: string; }
claudiospizzi/node-red-contrib-mystrom-switch
src/modules/mystrom-switch.ts
<gh_stars>1-10 import axios from 'axios'; export class MyStromSwitchStatus { public power: number | undefined; public relay: boolean | undefined; public temperature: number | undefined; } export class MyStromSwitch { private address: string; constructor(address: string) { this.address = address; } ...
claudiospizzi/node-red-contrib-mystrom-switch
src/nodes/mystrom-switch-config/mystrom-switch-config.html/modules/types.ts
import { EditorNodeProperties } from 'node-red'; import { MyStromSwitchConfigOptions } from '../../shared/types'; export interface MyStromSwitchConfigEditorNodeProperties extends EditorNodeProperties, MyStromSwitchConfigOptions {}
claudiospizzi/node-red-contrib-mystrom-switch
src/nodes/mystrom-switch-config/shared/types.ts
<reponame>claudiospizzi/node-red-contrib-mystrom-switch export interface MyStromSwitchConfigOptions { address: string; }
claudiospizzi/node-red-contrib-mystrom-switch
src/nodes/mystrom-switch-status/mystrom-switch-status.html/modules/types.ts
<reponame>claudiospizzi/node-red-contrib-mystrom-switch<gh_stars>1-10 import { EditorNodeProperties } from 'node-red'; import { MyStromSwitchStatusOptions } from '../../shared/types'; export interface MyStromSwitchStatusEditorNodeProperties extends EditorNodeProperties, MyStromSwitchStatusOptions {}
claudiospizzi/node-red-contrib-mystrom-switch
src/nodes/mystrom-switch-relay/mystrom-switch-relay.ts
<gh_stars>1-10 import { NodeInitializer } from 'node-red'; import { MyStromSwitch } from '../../modules/mystrom-switch'; import { MyStromSwitchConfigNode } from '../mystrom-switch-config/modules/types'; import { MyStromSwitchRelayNode, MyStromSwitchRelayNodeDef } from './modules/types'; const nodeInit: NodeInitializer...
claudiospizzi/node-red-contrib-mystrom-switch
src/nodes/mystrom-switch-status/modules/types.ts
import { Node, NodeDef } from 'node-red'; import { MyStromSwitchConfigNode } from '../../mystrom-switch-config/modules/types'; import { MyStromSwitchStatusOptions } from '../shared/types'; export interface MyStromSwitchStatusNodeDef extends NodeDef, MyStromSwitchStatusOptions {} export interface MyStromSwitchStatusNo...
claudiospizzi/node-red-contrib-mystrom-switch
src/nodes/mystrom-switch-status/shared/types.ts
export interface MyStromSwitchStatusOptions { switch: string; }
claudiospizzi/node-red-contrib-mystrom-switch
src/nodes/mystrom-switch-relay/mystrom-switch-relay.html/modules/types.ts
import { EditorNodeProperties } from 'node-red'; import { MyStromSwitchRelayOptions } from '../../shared/types'; export interface MyStromSwitchRelayEditorNodeProperties extends EditorNodeProperties, MyStromSwitchRelayOptions {}
claudiospizzi/node-red-contrib-mystrom-switch
src/nodes/mystrom-switch-relay/shared/types.ts
export interface MyStromSwitchRelayOptions { switch: string; relay: string; }
claudiospizzi/node-red-contrib-mystrom-switch
src/nodes/mystrom-switch-status/mystrom-switch-status.html/index.ts
<filename>src/nodes/mystrom-switch-status/mystrom-switch-status.html/index.ts import { EditorRED } from 'node-red'; import { MyStromSwitchStatusEditorNodeProperties } from './modules/types'; declare const RED: EditorRED; RED.nodes.registerType<MyStromSwitchStatusEditorNodeProperties>('mystrom-switch-status', { cate...
claudiospizzi/node-red-contrib-mystrom-switch
src/nodes/mystrom-switch-relay/modules/types.ts
<reponame>claudiospizzi/node-red-contrib-mystrom-switch import { Node, NodeDef } from 'node-red'; import { MyStromSwitchConfigNode } from '../../mystrom-switch-config/modules/types'; import { MyStromSwitchRelayOptions } from '../shared/types'; export interface MyStromSwitchRelayNodeDef extends NodeDef, MyStromSwitchRe...
claudiospizzi/node-red-contrib-mystrom-switch
src/nodes/mystrom-switch-status/mystrom-switch-status.ts
import { NodeInitializer } from 'node-red'; import { MyStromSwitchStatusNode, MyStromSwitchStatusNodeDef } from './modules/types'; import { MyStromSwitchConfigNode } from '../mystrom-switch-config/modules/types'; import { MyStromSwitch } from '../../modules/mystrom-switch'; const nodeInit: NodeInitializer = (RED): voi...
claudiospizzi/node-red-contrib-mystrom-switch
src/nodes/mystrom-switch-config/mystrom-switch-config.html/index.ts
import { EditorRED } from 'node-red'; import { MyStromSwitchConfigEditorNodeProperties } from './modules/types'; declare const RED: EditorRED; RED.nodes.registerType<MyStromSwitchConfigEditorNodeProperties>('mystrom-switch-config', { category: 'config', defaults: { name: { value: '', required: tru...
claudiospizzi/node-red-contrib-mystrom-switch
src/nodes/mystrom-switch-config/mystrom-switch-config.ts
<gh_stars>1-10 import { NodeInitializer } from 'node-red'; import { MyStromSwitchConfigNode, MyStromSwitchConfigNodeDef } from './modules/types'; const nodeInit: NodeInitializer = (RED): void => { function MyStromSwitchConfigNodeConstructor(this: MyStromSwitchConfigNode, config: MyStromSwitchConfigNodeDef): void { ...
okamoai/webscrs
src/websrcs.ts
<reponame>okamoai/webscrs import { promises as fs, constants as fsConst } from 'fs' import ora from 'ora' import chalk from 'chalk' import { PNG } from 'pngjs' import pixelmatch from 'pixelmatch' import sharp from 'sharp' import puppeteer from 'puppeteer' interface WebscrsOption { outputDir: string; device?: strin...
okamoai/webscrs
src/index.ts
import { Command, flags } from '@oclif/command' import { websrcs } from './websrcs' class Webscrs extends Command { static strict = false static description = 'Take a screenshot from a url and generate a diff from two urls.' static examples = [ '\nTake screenshots of URLs\n$ webscrs "https://example.com/" ...
igorivaniuk/md-to-quill-delta
src/__tests__/utils.spec.ts
import { whitespace, wordCharacter } from '../utils' describe('utils', () => { it('wordCharacter', () => { expect(wordCharacter('d')).toBe(true) expect(wordCharacter('1')).toBe(true) expect(wordCharacter(' ')).toBe(false) expect(wordCharacter(1)).toBe(false) }) it('whitespace', () => { expec...
igorivaniuk/md-to-quill-delta
src/__tests__/parse.spec.ts
import { markdownToQuillDelta } from '../parser' jest.mock('../environment.ts', () => ({ IS_DEV: true, IS_PROD: false, })) describe(`markdownToQuillDelta`, () => { it('should parse: bold', () => { const md = `test *bold*` expect(markdownToQuillDelta(md)).toMatchInlineSnapshot(` A...
igorivaniuk/md-to-quill-delta
src/utils.ts
const fromCode = String.fromCharCode const re = /\w/ // Check if the given character code, or the character code at the first // character, is a word character. export function wordCharacter(character: string | number) { return re.test( typeof character === 'number' ? fromCode(character) : character.charAt(0) ...
igorivaniuk/md-to-quill-delta
src/index.ts
<reponame>igorivaniuk/md-to-quill-delta export { markdownToQuillDelta } from './parser'
igorivaniuk/md-to-quill-delta
src/parser.ts
// tslint:disable-next-line: match-default-export-name import markdown from 'remark-parse' import unified from 'unified' import emphasisCustom from './parsers/emphasis' import strongCustom from './parsers/strong' interface AttributeMap { [key: string]: any } interface Op { insert?: string | object delete?: numb...
igorivaniuk/md-to-quill-delta
src/__tests__/parse-escaped.spec.ts
<filename>src/__tests__/parse-escaped.spec.ts import { markdownToQuillDelta } from '../parser' jest.mock('../environment.ts', () => ({ IS_DEV: true, IS_PROD: false, })) describe(`markdownToQuillDelta-escaped`, () => { it('should parse: bold', () => { const md = 'test *bo\\*ld*' expect(markdownToQuillDel...
igorivaniuk/md-to-quill-delta
src/parsers/emphasis.ts
<gh_stars>0 import { trim, whitespace, wordCharacter } from '../utils' function locate(value: string, fromIndex: number) { return value.indexOf('_', fromIndex) } emphasisCustom.locator = locate const underscore = '_' const backslash = '\\' export default function emphasisCustom( this: any, eat: any, value: s...
uploadcare/uploadcare-wordpress
jsx/interfaces/WpMediaModel.ts
import WpMedia from './WpMedia'; export default interface WpMediaModel { cid: string; attributes: WpMedia; _listenId: string; _pending: boolean; }
uploadcare/uploadcare-wordpress
jsx/UcUploader.ts
import uploadcare from 'uploadcare-widget/uploadcare' import FileInfoResponse from './interfaces/FileInfoResponse'; import UcConfig from './interfaces/UcConfig'; import uploadcareTabEffects from 'uploadcare-widget-tab-effects' import effectsConfig from './effects' export default class UcUploader { private loadingS...
uploadcare/uploadcare-wordpress
jsx/interfaces/WpMedia.ts
<reponame>uploadcare/uploadcare-wordpress enum Orientation { portrait = 'portrait', landscape = 'landscape' } export default interface WpMedia { alt?: string; author: number; authorName: string; caption?: string; date: Date; dateFormatted: string; description?: string; editLink: string;...
uploadcare/uploadcare-wordpress
jsx/UcMediaMeta.ts
interface UploadcareImageMeta { uploadcare_url_modifiers: Array<string>; uploadcare_url: Array<string>; uploadcare_uuid: Array<string>; } export default class UcMediaMeta { private static urlTemplate = (mediaId) => `/index.php?rest_route=/wp/v2/media/${mediaId}&_fields=meta`; static fetch(mediaId:...
uploadcare/uploadcare-wordpress
jsx/interfaces/FileInfoResponse.ts
<reponame>uploadcare/uploadcare-wordpress<filename>jsx/interfaces/FileInfoResponse.ts import {FileInfo} from '@uploadcare/react-widget'; export default interface FileInfoResponse extends FileInfo { attach_id: number; }
uploadcare/uploadcare-wordpress
jsx/UcImage.tsx
<filename>jsx/UcImage.tsx<gh_stars>10-100 import { registerBlockType } from '@wordpress/blocks'; import React from 'react/index'; import UcUploader from './UcUploader'; import config from './uc-config'; import { __ } from '@wordpress/i18n'; import { RichText, MediaUpload } from '@wordpress/block-editor'; import { Butto...
uploadcare/uploadcare-wordpress
jsx/interfaces/UcConfig.ts
<filename>jsx/interfaces/UcConfig.ts export default interface UcConfig { ajaxurl: string; cdnBase: string; previewStep: boolean; public_key: string; secureSignature?: string; secureExpire?: string; tabs: string; imagesOnly: boolean; multiple: boolean; effects: Array<string>; }
uploadcare/uploadcare-wordpress
jsx/transfer/TransferImages.ts
import UcConfig from '../interfaces/UcConfig'; import config from '../uc-config'; export default class TransferImages { private uploadButtons: NodeListOf<HTMLButtonElement> = document.querySelectorAll('button[data-action="uc-upload"]'); private downloadButtons: NodeListOf<HTMLButtonElement> = document.querySe...
uploadcare/uploadcare-wordpress
jsx/UploadToLibrary.ts
<reponame>uploadcare/uploadcare-wordpress import uploadcare from 'uploadcare-widget/uploadcare' import config from './uc-config'; import UcConfig from './interfaces/UcConfig'; import FileInfoResponse from './interfaces/FileInfoResponse'; import UcUploader from './UcUploader'; import { __ } from '@wordpress/i18n'; impor...
uploadcare/uploadcare-wordpress
jsx/imageEdit/editorLoader.tsx
<filename>jsx/imageEdit/editorLoader.tsx import uploadcare from 'uploadcare-widget/uploadcare' import config from '../uc-config'; import UcConfig from '../interfaces/UcConfig'; import WpMediaModel from '../interfaces/WpMediaModel'; import uploadcareTabEffects from 'uploadcare-widget-tab-effects' import UcUploader from ...
GraphiteEditor/Graphite
frontend/src/utilities/strip-indents.ts
<reponame>GraphiteEditor/Graphite export function stripIndents(stringPieces: TemplateStringsArray, ...substitutions: unknown[]) { const interleavedSubstitutions = stringPieces.flatMap((stringPiece, index) => [stringPiece, substitutions[index] !== undefined ? substitutions[index] : ""]); const stringLines = interleave...
GraphiteEditor/Graphite
frontend/src/dispatcher/js-dispatcher.ts
<filename>frontend/src/dispatcher/js-dispatcher.ts<gh_stars>1000+ import { plainToInstance } from "class-transformer"; import { JsMessageType, messageConstructors, JsMessage } from "@/dispatcher/js-messages"; import type { RustEditorInstance, WasmInstance } from "@/state/wasm-loader"; type JsMessageCallback<T extends ...
GraphiteEditor/Graphite
frontend/src/main.ts
// reflect-metadata allows for runtime reflection of types in JavaScript. // It is needed for class-transformer to work and is imported as a side effect. // The library replaces the Reflect API on the window to support more features. import "reflect-metadata"; import { createApp } from "vue"; import "@/lifetime/errors...
GraphiteEditor/Graphite
frontend/src/lifetime/auto-save.ts
import { AutoSaveDocument, RemoveAutoSaveDocument } from "@/dispatcher/js-messages"; import { DocumentsState } from "@/state/documents"; import { EditorState } from "@/state/wasm-loader"; const GRAPHITE_INDEXED_DB_NAME = "graphite-indexed-db"; const GRAPHITE_INDEXED_DB_VERSION = 1; const GRAPHITE_AUTO_SAVE_STORE = "au...
Sopiro/Physics
src/joint.ts
<reponame>Sopiro/Physics<filename>src/joint.ts import * as Util from "./util.js"; import { Constraint } from "./constraint.js"; import { RigidBody } from "./rigidbody.js"; import { Settings } from "./settings.js"; // Children: Revolute, Prismatic, Distance, Max distance, Weld, Motor, Line, Angle, Grab export abstract ...
Sopiro/Physics
src/line.ts
<filename>src/line.ts import { Joint } from "./joint.js"; import { Vector2 } from "./math.js"; import { RigidBody, Type } from "./rigidbody.js"; import { Settings } from "./settings.js"; import * as Util from "./util.js"; export class LineJoint extends Joint { public readonly localAnchorA: Vector2; public read...
Sopiro/Physics
src/edge.ts
import { Vector2 } from "./math.js"; import * as Util from "./util.js"; export class Edge { public p1: Vector2; public p2: Vector2; public dir: Vector2; public id1: number; public id2: number; constructor(p1: Vector2, p2: Vector2, id1: number = -1, id2: number = -1) { this.p1 = p1...
Sopiro/Physics
src/distance.ts
import { Joint } from "./joint.js"; import { Vector2 } from "./math.js"; import { RigidBody } from "./rigidbody.js"; import { Settings } from "./settings.js"; import * as Util from "./util.js"; export class DistanceJoint extends Joint { public localAnchorA: Vector2; public localAnchorB: Vector2; priva...
Sopiro/Physics
src/box.ts
import { Type } from "./rigidbody.js"; import { Vector2 } from "./math.js"; import { Polygon } from "./polygon.js"; import * as Util from "./util.js"; import { Settings } from "./settings.js"; export class Box extends Polygon { public readonly width; public readonly height; constructor(width: number, heig...
Sopiro/Physics
src/simplex.ts
import { Vector2 } from "./math.js"; import { getUV, lerpVector } from "./util.js"; interface ClosestResult { result: Vector2; contributors: number[]; // Vertex indices that contributed to calculating the closest point } export class Simplex { public vertices: Vector2[]; constructor() { t...
Sopiro/Physics
src/util.ts
import { Box } from "./box.js"; import { Circle } from "./circle.js"; import { RigidBody, Type } from "./rigidbody.js"; import { Matrix3, Vector2 } from "./math.js"; import { Polygon } from "./polygon.js"; import { Settings } from "./settings.js"; export interface Pair<A, B> { p1: A; p2: B; } export function ...
Sopiro/Physics
src/island.ts
<gh_stars>1-10 import { Constraint } from "./constraint.js"; import { ContactManifold } from "./contact.js"; import { Joint } from "./joint.js"; import { Vector2 } from "./math.js"; import { RigidBody } from "./rigidbody.js"; import { Settings } from "./settings.js"; import { World } from "./world.js"; export class Is...
Sopiro/Physics
src/camera.ts
import { Entity } from "./entity.js"; import { Matrix3 } from "./math.js"; export class Camera extends Entity { constructor() { super(); } get transform(): Matrix3 { return super.localToGlobal; } get cameraTransform(): Matrix3 { return super.globalToLocal; ...
Sopiro/Physics
src/settings.ts
import { gWorld } from "./game.js"; import * as Util from "./util.js"; export enum GenerationShape { Box = 0, Circle, Regular, Random } export enum MouseMode { Grab = 0, Force } const frequencyRange: Util.Pair<number, number> = { p1: 10, p2: 240 }; const iterationRange: Util.Pair<number, numb...
Sopiro/Physics
src/aabb.ts
import { Box } from "./box.js"; import { Circle } from "./circle.js"; import { Vector2 } from "./math.js"; import { Polygon } from "./polygon.js"; import { RigidBody } from "./rigidbody.js"; export class AABB { public min: Vector2; public max: Vector2; constructor(min: Vector2 = new Vector2(), max: Vector...
Sopiro/Physics
src/world.ts
import { RigidBody, Type } from "./rigidbody.js"; import { testPointInside, detectCollision } from "./detection.js"; import { ContactManifold } from "./contact.js"; import * as Util from "./util.js"; import { Settings } from "./settings.js"; import { Joint } from "./joint.js"; import { Island } from "./island.js"; impo...
Sopiro/Physics
src/detection.ts
<gh_stars>1-10 import { Circle } from "./circle.js"; import { RigidBody } from "./rigidbody.js"; import { ContactManifold } from "./contact.js"; import { Edge } from "./edge.js"; import { Vector2 } from "./math.js"; import { Polygon } from "./polygon.js"; import { ClosestEdgeInfo, Polytope } from "./polytope.js"; impor...
Sopiro/Physics
src/game.ts
<filename>src/game.ts import { Vector2 } from "./math.js"; import * as Input from "./input.js"; import * as Util from "./util.js"; import { Renderer } from "./renderer.js"; import { Camera } from "./camera.js"; import { RigidBody, Type } from "./rigidbody.js"; import { World } from "./world.js"; import { Box } from "./...
Sopiro/Physics
src/circle.ts
import { RigidBody, Type } from "./rigidbody.js"; import { Settings } from "./settings.js"; import * as Util from "./util.js"; export class Circle extends RigidBody { public readonly radius: number; public readonly area: number; constructor(radius: number, type: Type = Type.Dynamic, density: number = Sett...
Sopiro/Physics
src/rigidbody.ts
<reponame>Sopiro/Physics<gh_stars>1-10 import { ContactInfo } from "./contact.js"; import { Entity } from "./entity.js"; import { Vector2 } from "./math.js"; import { Settings } from "./settings.js"; import * as Util from "./util.js"; import { Node } from "./aabbtree.js"; export enum Type { Static = 0, Dynamic...
Sopiro/Physics
src/weld.ts
<filename>src/weld.ts import { Matrix3, Vector2, Vector3 } from "./math.js"; import { RigidBody } from "./rigidbody.js"; import { Settings } from "./settings.js"; import * as Util from "./util.js"; import { Joint } from "./joint.js"; // Revolute joint + Angle joint export class WeldJoint extends Joint { public loc...
Sopiro/Physics
src/revolute.ts
import { Matrix2, Vector2 } from "./math.js"; import { RigidBody } from "./rigidbody.js"; import { Settings } from "./settings.js"; import * as Util from "./util.js"; import { Joint } from "./joint.js"; export class RevoluteJoint extends Joint { public localAnchorA: Vector2; public localAnchorB: Vector2; ...
Sopiro/Physics
src/motor.ts
import { Matrix2, Vector2 } from "./math.js"; import { RigidBody } from "./rigidbody.js"; import { Settings } from "./settings.js"; import * as Util from "./util.js"; import { Joint } from "./joint.js"; // Revolute joint + Angle joint + limited force (torque) export class MotorJoint extends Joint { public localAnc...
Sopiro/Physics
src/grab.ts
<filename>src/grab.ts<gh_stars>1-10 import { Joint } from "./joint.js"; import { Matrix2, Vector2 } from "./math.js"; import { RigidBody } from "./rigidbody.js"; import { Settings } from "./settings.js"; import * as Util from "./util.js"; export class GrabJoint extends Joint { public localAnchor: Vector2; publ...
Sopiro/Physics
src/contact.ts
<gh_stars>1-10 import { RigidBody } from "./rigidbody.js"; import { Matrix2, Vector2 } from "./math.js"; import { Settings } from "./settings.js"; import * as Util from "./util.js"; import { Constraint } from "./constraint.js"; import { ContactPoint } from "./detection.js"; enum ContactType { Normal, Tangent }...
Sopiro/Physics
src/polytope.ts
<reponame>Sopiro/Physics import { Vector2 } from "./math.js"; import { Simplex } from "./simplex.js"; export interface ClosestEdgeInfo { index: number; distance: number; normal: Vector2; } export class Polytope { public readonly vertices: Vector2[]; constructor(simplex: Simplex) { if ...
Sopiro/Physics
src/nsquared.ts
<reponame>Sopiro/Physics import { Pair } from "./util.js"; import { RigidBody } from "./rigidbody.js"; import { createAABB, detectCollisionAABB } from "./aabb.js"; //N^2 broad phase, actually (N^2 - N) / 2 export function getCollisionPairsNSquared(bodies: RigidBody[]): Pair<RigidBody, RigidBody>[] { let pairs: Pai...
Sopiro/Physics
src/demo.ts
<reponame>Sopiro/Physics import { Box } from "./box.js"; import { RigidBody, Type } from "./rigidbody.js"; import { Vector2 } from "./math.js"; import { Settings, updateSetting } from "./settings.js"; import { World } from "./world.js"; import * as Util from "./util.js"; import { Circle } from "./circle.js"; import { R...
Sopiro/Physics
src/polygon.ts
<reponame>Sopiro/Physics import { RigidBody, Type } from "./rigidbody.js"; import { Vector2 } from "./math.js"; import * as Util from "./util.js"; import { Settings } from "./settings.js"; // Children: Box export class Polygon extends RigidBody { public readonly vertices: Vector2[]; public readonly area: numbe...
Sopiro/Physics
src/constraint.ts
import { Vector2, Vector3 } from "./math.js"; import { RigidBody } from "./rigidbody.js"; // Children: ContactManifold, Joint export abstract class Constraint { public readonly bodyA: RigidBody; public readonly bodyB: RigidBody; protected beta = 0.0; // Coefficient of position correction (Positional error...
Sopiro/Physics
src/angle.ts
import { Joint } from "./joint.js"; import { RigidBody } from "./rigidbody.js"; import { Settings } from "./settings.js"; export class AngleJoint extends Joint { public initialAngleOffset: number; private m!: number; private bias!: number; private impulseSum: number = 0.0; constructor( bo...
Sopiro/Physics
src/renderer.ts
import { Circle } from "./circle.js"; import { RigidBody } from "./rigidbody.js"; import { Matrix3, Vector2 } from "./math.js"; import { Polygon } from "./polygon.js"; import { Simplex } from "./simplex.js"; import { AABB } from "./aabb.js"; import { Settings } from "./settings.js"; import * as Util from "./util.js"; i...
completium/taqueria
tests/e2e/utils/utils.ts
import {execSync} from "child_process"; import path from "path"; import fs from "fs"; export const generateTestProject = async (projectPath: string, packageNames: string[] = [], localPackages: boolean = true) => { try{ execSync(`taq init ${projectPath}`) } catch(error){ throw new Error (`error:...
completium/taqueria
taqueria-plugin-taquito/originate.ts
import { SanitizedArgs, ActionResponse, Failure, LikeAPromise, Config, NetworkConfig, SandboxConfig, ProxyAction} from "@taqueria/node-sdk/types"; import glob from 'fast-glob' import {join} from 'path' import { TezosToolkit } from '@taquito/taquito'; import {readFile} from 'fs/promises' import { InMemorySigner, importK...
completium/taqueria
tests/e2e/taqueria-plugin-ligo.spec.ts
import {checkFolderExistsWithTimeout, generateTestProject} from "./utils/utils"; import fs from "fs"; import {execSync} from "child_process"; const taqueriaProjectPath = 'e2e/auto-test-ligo-plugin'; describe("E2E Testing for taqueria ligo plugin", () => { beforeAll(async () => { await generateTestProjec...
completium/taqueria
tests/e2e/data/help-contents.ts
export const helpContentsNoProject: string = `taq [command] Commands: taq init [projectDir] Initialize a new project Options: --version Show version number [boolean] -p, --projectDir Path to your project directory [default: "./"] -d, --configDir Config directory ...
completium/taqueria
tests/unit/cli.test.ts
import {__TEST__} from '../../cli.ts' // TODO: Finish test for exec command Deno.test("Positive scenario test for {exec} function", () => { // const result = __TEST__.exec("test", {}); });
completium/taqueria
taqueria-types.ts
<reponame>completium/taqueria import type {SanitizedPath, SanitizedAbsPath, SanitizedUrl} from './taqueria-utils/taqueria-utils-types.ts' import {SHA256} from './taqueria-utils/taqueria-utils-types.ts' import {Option, Config, ConfigArgs, PluginInfo, InstalledPlugin, Verb, UnvalidatedTask, Task, UnvalidatedNetwork, Netw...
completium/taqueria
taqueria-plugin-flextesa/proxy.ts
<gh_stars>0 import {Sandbox as theSandbox, execCmd, getArch} from '@taqueria/node-sdk' import type { SanitizedArgs, ProxyAction, Attributes, SandboxConfig, EconomicalProtocol, ActionResponse, Failure, LikeAPromise, Sandbox } from "@taqueria/node-sdk/types" import retry from 'promise-retry' type Opts = SanitizedArgs & ...
completium/taqueria
taqueria-plugin-flextesa/docker/startFlextesa.ts
<gh_stars>0 import { writeJsonFile, readJsonFile } from '@taqueria/node-sdk' import yargs from 'yargs' import {exec} from 'child_process' import retry from 'promise-retry' // @ts-ignore - partial.lenses doesn't have corresponding @types import * as L from 'partial.lenses' type Args = ReturnType<typeof yargs> & {confi...
completium/taqueria
i18n.ts
import i18next from 'https://deno.land/x/i18next/index.js' // TODO: i18next is feature-rich, but rather large. Determine whether you need all of the functionality await i18next.init({ lng: 'en', debug: false, resources: { // TODO: Move to separate language files en: { translatio...