repo_name
stringlengths
5
122
path
stringlengths
3
232
text
stringlengths
6
1.05M
WhiteSky7/bookappts2
frontend/components/Book.tsx
import React from 'react'; const Book = () => { return ( <h1>Hello world</h1> ) } export default Book
WhiteSky7/bookappts2
frontend/router.tsx
import * as React from 'react'; import { hot } from 'react-hot-loader'; import {BrowserRouter , Switch, Route} from 'react-router-dom'; import {Page} from 'components/Page' import Book from 'components/Book'; export const RouterComponent = () => ( <BrowserRouter> <Switch> <Route path="/" component={...
WhiteSky7/bookappts2
frontend/app.tsx
import "./globals"; import * as React from "react"; import * as ReactDOM from "react-dom"; import {RouterComponent} from "./router"; import {UserContextProvider} from "contexts/UserContext" import "app/css/style.pcss" ReactDOM.render( <UserContextProvider> <RouterComponent /> </UserContextProvider>, ...
nodespull/nodespull
src/database/systems/mysql/connection.ts
import sequelize from "sequelize"; import functions_placeholders from "../../helpers/functions-placeholders" import { db_mySQLConnectionArg } from "./model"; import { Table } from "./Table"; import { DB_Connection } from "../../models/db-connection"; import { Log } from "../../../etc/log"; export class DB_MySQL_Conne...
nodespull/nodespull
src/cli/route/index.ts
import {cmd} from "../exe/exe.log" import fs from "fs" import {PathVar} from "../../etc/other/paths" import del from "./templates/delete/delete.template" import get from "./templates/get/get.template" import post from "./templates/post/post.template" import put from "./templates/put/put.template" import head from "./t...
nodespull/nodespull
src/crypt/index.ts
import { AuthProfile, JwtAuthProfileInterface, oauth2AuthProfileInterface, AuthControllerProfileStorage_interface } from "./models/interface"; import { Log } from "../etc/log"; import { StringParser } from "../etc/system-tools/string-validator"; import { npJWT } from "./models/jwt"; import { npOauth2 } from "./models/o...
nodespull/nodespull
src/bootstrap/boot-env/interfaces.ts
<gh_stars>1-10 export enum EnvType { process = "process", app = "app" } export interface npEnv_interface{ process:any app:any }
nodespull/nodespull
src/database/systems/mysql/user-interface.ts
<reponame>nodespull/nodespull<gh_stars>1-10 import {DataTypes, Sequelize} from "sequelize"; import { DatabaseUserPortalInterface } from "../../user-interface"; import sequelize from "sequelize"; import { RawQueryResponse, QueryInterface } from "../../models/query"; import {Table, TableRelation, TableDefinition, ModelDe...
nodespull/nodespull
src/cli/auth/templates/jwt.template.ts
<gh_stars>1-10 export default function getJwtTemplate(authSelector:string):string{ return `const { npAuthProfile } = require("@nodespull/core") const { JwtAlg, Duration } = require("@nodespull/core/crypt") const { sysEnv } = require("@nodespull/core/env") npAuthProfile.jwt({ selector: "${authSelector}", ...
nodespull/nodespull
src/files-runner/env-files.ts
import { FilesEngine } from "./common" ; import { PathVar } from "../etc/other/paths" export class Env_FilesLoader extends FilesEngine{ static isLoaded:boolean = false static load(){ if(Env_FilesLoader.isLoaded) return new Env_FilesLoader() // Env_FilesLoader.isLoaded = true } c...
nodespull/nodespull
src/database/migration.ts
import { Log } from "../etc/log" import {DatabaseConnectionController} from "./connection" import {DB_Model_Rel_FilesLoader} from "../files-runner/db-model-rel-files" import { getCurrentDBVersion } from "./helpers/common" import cmd from "../cli/exe/exe" import { FilesEngine } from "../files-runner/common" // import st...
nodespull/nodespull
src/env/templates/index.ts
export default function getAppEnvTemplate(env:string):string{ return `const { npEnv } = require("@nodespull/core") /** * accessible within app modules */ npEnv.app.loadVars(forTags = [${env=="local"?'':("'"+env+"'")}], { })` }
nodespull/nodespull
src/etc/system-tools/string-validator.ts
import { Log } from "../log" export class StringParser { /** * alphanumeric extended with "_" * does not start with numeric */ static isExtendedAlphaNum(str:string){ if(!isNaN(Number(str[0]))) return false return str.match(/^[0-9a-zA-Z_]+$/) !== null } static isValidCLIF...
nodespull/nodespull
src/cli/auth/index.ts
<filename>src/cli/auth/index.ts import {cmd} from "../exe/exe.log" import fs from "fs" import {PathVar} from "../../etc/other/paths" import getJwtTemplate from "./templates/jwt.template" import getOauth2Template from "./templates/oauth2.template" import { StringParser } from "../../etc/system-tools/string-validator" im...
nodespull/nodespull
src/cli/route/templates/get/get.template.ts
<filename>src/cli/route/templates/get/get.template.ts import { JSReservedWords } from "../../../../etc/js-reserved-words"; import { Log } from "../../../../etc/log"; export default function get(path:string, moduleVarName:string, locationDepth:number):string{ let name = path.split("/").pop()// remove slash, get las...
nodespull/nodespull
src/cli/exe/exe.ts
export default async function runCmd(cmd:string, options:string[],stream?:boolean){ let execa = require('execa'); if(stream){ const exe = execa(cmd, options) //exe.stdout.pipe(process.stdout); //exe.stderr.pipe(process.stderr); } else{ (async () => { const {...
nodespull/nodespull
src/crypt/models/interface.ts
<reponame>nodespull/nodespull<filename>src/crypt/models/interface.ts import { npJWT } from "./jwt"; import { DurationInstance } from ".."; export interface AuthProfile { } export interface npJWTGuard extends npJWT{} export interface JwtAuthProfileInterface{ selector: string, expiresIn: DurationInstance, //s...
nodespull/nodespull
src/cli/link/database/db/templates/database.template.ts
export default function getDatabaseTemplate(dbSelector:string):string{ return `const { npLink } = require("@nodespull/core") const { system } = require("@nodespull/core/utils/db") const { sysEnv, appEnv } = require("@nodespull/core/env") /** * database access configs */ npLink.database({ isActive: false, ...
nodespull/nodespull
src/cli/brew/brew.ts
<filename>src/cli/brew/brew.ts import cmd from "../exe/exe" // install brew export const downloadBrew = ()=>{ cmd("sudo", ["/bin/bash","-c", "\"$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)\""]); }
nodespull/nodespull
src/install.ts
const execa = require('execa'); const fs = require("fs"); import {getCmd as cliCmd} from "./cli" // files list import dockerfile from "./etc/developer-op-files/dockerfile"; import dockerComposeAll from "./etc/developer-op-files/docker-compose-all"; import dockerComposeDB from "./etc/developer-op-files/docker-compose...
nodespull/nodespull
src/bootstrap/bootconf/bootconf-user-config/index.ts
import {NpUserConfigServer_interface, NpUserConfigSecurity_interface} from "./interfaces" import bootconfStore from "../bootconf-store" import { NpServer } from "../.." import { NpLifecycle } from "../bootconf-lifecycle" export class NpUserConfig { static isCorsPolicySet:boolean = false // used at npBoot.liste...
nodespull/nodespull
src/cli/service/index.ts
import {cmd} from "../exe/exe.log" import fs from "fs" import {error} from ".." import {PathVar} from "../../etc/other/paths" import getDefaultTemplate from "./templates/service.template" import getBootTemplate from "./templates/service.boot.template" import getPipeTemplate from "./templates/service.pipe.template" imp...
nodespull/nodespull
src/cli/service/templates/service.pipe.template.ts
export default function getTemplate(serviceVarName:string, moduleVarName:string):string{ if(moduleVarName.slice(-1*"Module".length) != "Module") moduleVarName = moduleVarName.toLowerCase()+"Module" let moduleFileName = moduleVarName.substr(0, moduleVarName.length-1*"Module".length)+".mod" return `const { l...
nodespull/nodespull
src/files-runner/common.ts
<gh_stars>1-10 import fs from "fs" // runner template export abstract class FilesEngine { constructor(){} /** * run all .js file recursively, given a folder */ recursiveSearch(path: string, extension:string, options:RecursiveSearchOptions):string[]{ try{ const dirents = fs....
nodespull/nodespull
src/cli/auth/templates/oauth2.template.ts
export default function getOauth2Template(authSelector:string):string{ return `const { npAuthProfile } = require("@nodespull/core") const { sysEnv, sysApp } = require("@nodespull/core/env") npAuthProfile.oauth2({ selector: "${authSelector}", onInit: (authorizationCode, next)=>{ next(null) } }...
nodespull/nodespull
src/files-runner/database-files.ts
import { FilesEngine } from "./common" ; import { PathVar } from "../etc/other/paths" import { DatabaseConnectionController } from "../database/connection"; export class Database_FilesLoader extends FilesEngine{ static isLoaded:boolean = false static load(){ if(Database_FilesLoader.isLoaded) return ...
nodespull/nodespull
src/cli/link/index.ts
<filename>src/cli/link/index.ts<gh_stars>1-10 import { error } from ".." import {newDB} from "./database/db" export async function newLink(args:string[]){ let type:string = args[0] let name:string = args[1] if(!type || !name) throw error.wrongUsage switch(type){ case("--db"): tr...
nodespull/nodespull
src/database/systems/mysql/Table.ts
import sequelize, { Sequelize } from "sequelize" import { DataTypes } from "sequelize" import { DatabaseConnectionController } from "../../connection" import error, { Log } from "../../../etc/log" import { QueryOption } from "../../models/option"; export class Table{ private _model:sequelize.ModelCtor<sequelize....
nodespull/nodespull
src/etc/other/paths.ts
<gh_stars>1-10 export class PathVar { static isProcessFromMocha = process.argv[1].split("/").pop() == "mocha" static isProcessFromRoot = PathVar.isProcessFromMocha static getPackageJson = ():string=>{ if(PathVar.isProcessFromRoot) return process.cwd()+"/package.json" return process.argv[...
nodespull/nodespull
src/cli/exe/exe.log.ts
import spawn from "cross-spawn" export async function cmd(cmd:string, options:string[],stream?:boolean){ if(stream !== undefined && stream === false){ spawn(cmd, options); } else{ const result = spawn.sync(cmd, options, { stdio: 'inherit' }); return new Promise((resolve,reject)=>{...
nodespull/nodespull
src/database/models/db-connection.ts
import { db_mySQLConnectionArg } from "../systems/mysql/model"; export interface DB_Connection { conf: db_mySQLConnectionArg start: Function }
nodespull/nodespull
src/env/index.ts
import { AppEnv } from "../bootstrap/boot-env/store" import { Boot_Env } from "../bootstrap/boot-env" Boot_Env.ensureInstanceRunning() export const sysEnv = process.env export const appEnv = AppEnv.storedVars
nodespull/nodespull
src/bootstrap/bootconf/bootconf-user-config/interfaces.ts
export interface NpUserConfigServer_interface { port:number|string, useSwagger: boolean } export interface NpUserConfigSecurity_interface { cors: any[] }
nodespull/nodespull
src/http/model.ts
<reponame>nodespull/nodespull import { npJWT } from "../crypt/models/jwt"; export interface npHttpInterfaceArg_interface { handler:Function, isRouteActive:boolean, urlParams:string[], path:string, jwtProfile:npJWT|null }
nodespull/nodespull
src/etc/system-tools/clone-object.ts
<reponame>nodespull/nodespull export default function cloneObject(obj:any) { if (null == obj || "object" != typeof obj) return obj; var copy:any = {} for (var attr in obj) { copy[attr] = obj[attr]; } return copy; }
nodespull/nodespull
src/module/controllers/npModuleController.ts
<filename>src/module/controllers/npModuleController.ts import { npModule } from "../npmodule"; import { npModuleArgInterface } from "../models"; export class npModuleController{ static registeredModules:npModule[] = [] static handler(args:npModuleArgInterface):npModule{ args.jwtProfile = args.useGuar...
nodespull/nodespull
src/database/models/option.ts
export interface QueryOption { softDeleted: boolean }
nodespull/nodespull
src/database/helpers/common.ts
<reponame>nodespull/nodespull<filename>src/database/helpers/common.ts import fs from "fs" import {PathVar} from "../../etc/other/paths" import { DatabaseConnectionController } from "../connection" import { Log } from "../../etc/log" export function getCurrentDBVersion(dbName:string):number{ const dbPath = dbName+"...
nodespull/nodespull
src/bootstrap/bootconf/bootconf-action-switch/index.ts
import {UserActions} from "./interfaces" import { NpServer } from "../.." import { FilesLoader } from "../../../files-runner" import * as cli from "../../../cli" import { cmd } from "../../../cli/exe/exe.log" import { deploy } from "../../../cli/deploy/deploy" import { Migration } from "../../../database/migration" im...
nodespull/nodespull
src/cli/link/database/table/index.ts
import cmd from "../../../exe/exe" import fs from "fs" import {PathVar} from "../../../../etc/other/paths" import attribute from "./templates/attribute" import relation from "./templates/relation" import { getCurrentDBVersion } from "../../../../database/helpers/common" import { DatabaseConnectionController } from ".....
nodespull/nodespull
src/database/user-interface.ts
<reponame>nodespull/nodespull<filename>src/database/user-interface.ts import { DataTypes } from "sequelize"; import { TableRelation } from "./systems/mysql/Table"; import {DatabaseConnectionController} from "./connection"; import { DatabaseUserPortal_mySQL } from "./systems/mysql/user-interface"; import { Log } from "...
nodespull/nodespull
src/files-runner/db-model-rel-files.ts
<reponame>nodespull/nodespull<gh_stars>1-10 import fs from "fs" import { FilesEngine } from "./common" ; import {DatabaseConnectionController} from "../database/connection"; import { Log } from "../etc/log"; import { getCurrentDBVersion } from "../database/helpers/common"; import stageModelTemplate from "../cli/link/da...
nodespull/nodespull
src/etc/developer-op-files/nodespull-README.ts
<reponame>nodespull/nodespull export default function file(projectName:string){ return `# ${projectName} This project was generated with [Nodespull CLI](https://github.com/nodespull/nodespull-cli) version 1.0.0 ## Local server Run \`pull serve\` for a local server. Navigate to \`http://localhost:3000/\`. The se...
nodespull/nodespull
src/http/controller.ts
<reponame>nodespull/nodespull<gh_stars>1-10 import express from "express" import {Application} from "express" import { npJWT } from "../crypt/models/jwt"; import { npHttpInterfaceArg_interface } from "./model"; import { NpServer } from "../bootstrap"; export class npHttpInterface { // auth:Authentication; co...
nodespull/nodespull
src/bootstrap/bootconf/bootconf-lifecycle/index.ts
<gh_stars>1-10 export class NpLifecycle { static beforeServe: Function static afterServe: Function static setBeforeServe(func:Function){ NpLifecycle.beforeServe = func } static setAfterServe(func:Function){ NpLifecycle.afterServe = func } }
nodespull/nodespull
src/database/connection.ts
<reponame>nodespull/nodespull<filename>src/database/connection.ts // import sequelize from "sequelize"; // import { DatabaseTools } from "./tools"; // import { Table } from "./Table"; // import functions_placeholders from "./etc/functions-placeholders" import { DB_MySQL_Connection } from "./systems/mysql/connection"; i...
nodespull/nodespull
src/http/guard/jwt.ts
// import jwt from "jsonwebtoken" // import strGen from "../../etc/system-tools/string-gen" // export class JWT{ // static verify = jwt.verify; // static secret = strGen(30); // static duration = "24h"; // constructor(){ // } // static checkToken(req:any, res:any, cb:Function){ // ...
nodespull/nodespull
src/cli/route/templates/put/swagger.put.template.ts
<reponame>nodespull/nodespull export default function put(path:string):string{ return `{ "${path}":{ "put":{ "summary": "no summary", "description":"no description", "parameters":[ { "in": "body", "name": "body"...
nodespull/nodespull
src/module/controllers/npServiceController.ts
<filename>src/module/controllers/npServiceController.ts import { npModuleUserInterface, npServiceInterface } from "../models"; export class npServiceController{ static handler(args:npServiceInterface):npModuleUserInterface{ args.loader._addService(args) return args.loader.getSelfObject() } } ...
nodespull/nodespull
src/bootstrap/index.ts
import express from "express"; import { SwaggerController } from "../swagger/loader" import bootconf_Message from "./bootconf/bootconf-message"; import bootconfStore from "./bootconf/bootconf-store" import bodyParser from "body-parser" import morgan from "morgan" import { DatabaseConnectionController } from "../databas...
nodespull/nodespull
src/swagger/loader.ts
<gh_stars>1-10 import swagger_defaultContent from "./templates/master" import swagger from "swagger-ui-express" import fs from "fs" import { writeJSON, parseJSON } from "../etc/system-tools/json" import { cmd } from "../cli/exe/exe.log" import { PathVar } from "../etc/other/paths" import { npModuleController } from "....
nodespull/nodespull
src/cli/module/index.ts
<gh_stars>1-10 import {cmd} from "../exe/exe.log" import fs from "fs" import {PathVar} from "../../etc/other/paths" import getModuleTemplate from "./templates/module.template" import { npModuleController } from "../../module/controllers/npModuleController"; import { Log } from "../../etc/log"; const root = PathVar.ge...
nodespull/nodespull
src/etc/log.ts
<reponame>nodespull/nodespull import colors from "colors" let errors = { db:{ modelNotSaved, missingWhere_for } } export default errors; function modelNotSaved(){ throw Error("Tried to get a Table before saving Tables to database") } function missingWhere_for(action:string){ throw E...
nodespull/nodespull
src/utils/index.ts
<reponame>nodespull/nodespull import {Hash_Algorithm} from "../etc/system-tools/hash" import { AuthController } from "../crypt"; export const jwt = AuthController._profiles.jwt export const oauth2 = AuthController._profiles.oauth2 export const hash = { SHA256:{createWith: (str:string)=>{return Hash_Algorithm.s...
nodespull/nodespull
src/bootstrap/bootconf/bootconf-message.ts
import { Log } from "../../etc/log"; import _bootStore from "./bootconf-store"; export default { cors:{ missing: ()=>{ new Log("CORS config not set. please add (and edit if needed) the codes below to your 'server.js' file before calling $.server.ready():\n\n\ \t$.config.cors([ {dom...
nodespull/nodespull
src/cli/deploy/deploy.ts
import fs from "fs" import {herokuCreateApp, herokuLogin, herokuPush} from "../heroku/heroku" import {rootFile_name} from "../../install" import strGen from "../../etc/system-tools/string-gen" import {cmd} from "../exe/exe.log" import {parseJSON, writeJSON} from "../../etc/system-tools/json" import { Log } from "../.....
nodespull/nodespull
src/bootstrap/bootconf/bootconf-action-switch/interfaces.ts
export enum UserActions { serve = "serve", deploy = "deploy", test = "test", migrate = "migrate", cli = "cli", init = "init" //should not be here }
nodespull/nodespull
src/utils/sys.ts
<filename>src/utils/sys.ts export interface json{ [key:string] : any; }
nodespull/nodespull
src/cloud-adapter/index.ts
<filename>src/cloud-adapter/index.ts export class npAdapterUserInterface { static setKey(key:string){ } }
nodespull/nodespull
src/etc/system-tools/string-gen.ts
export default function randomString(len:any, an?:any){ an = an&&an.toLowerCase(); var str="", i=0, min=an=="a"?10:0, max=an=="n"?10:62; for(;i++<len;){ var r = Math.random()*(max-min)+min <<0; str += String.fromCharCode(r+=r>9?r<36?55:61:48); } return str; }
nodespull/nodespull
src/module/npmodule.ts
import { npServiceInterface, npModuleUserInterface, npRouteInterface, npModuleSelfObjectInterface } from "./models" import { http } from "../entrypoint" import { Log } from "../etc/log" import { npJWT } from "../crypt/models/jwt" import { npHttpInterfaceArg_interface } from "../http/model" export class npModule { ...
nodespull/nodespull
src/files-runner/module-files.ts
import { FilesEngine } from "./common" ; import { PathVar } from "../etc/other/paths" export class Module_FilesLoader extends FilesEngine{ static isLoaded:boolean = false static load(){ if(Module_FilesLoader.isLoaded) return new Module_FilesLoader() // Module_FilesLoader.isLoaded = true ...
nodespull/nodespull
src/bootstrap/boot-env/store.ts
<filename>src/bootstrap/boot-env/store.ts export class AppEnv { static storedVars = {} }
nodespull/nodespull
src/files-runner/route-files.ts
import { FilesEngine } from "./common" ; import { PathVar } from "../etc/other/paths" export class RestRoute_FilesLoader extends FilesEngine{ static isLoaded:boolean = false static load(){ if(RestRoute_FilesLoader.isLoaded) return new RestRoute_FilesLoader() // RestRoute_FilesLoader.is...
nodespull/nodespull
src/cli/heroku/heroku.ts
<reponame>nodespull/nodespull import {cmd} from "../exe/exe.log" import fs from "fs" import {appDockerfile,heroku_db_dockerfile} from "../deploy/templates/dockerfile" import {writeJSON, parseJSON} from "../../etc/system-tools/json" import {userInput} from "../../etc/system-tools/stdin"; import {PathVar} from "../../et...
nodespull/nodespull
src/etc/system-tools/json.ts
<gh_stars>1-10 import fs from "fs" export function parseJSON(pathFromRootFile:string){ return JSON.parse(fs.readFileSync(pathFromRootFile, 'utf8')); } export function writeJSON(pathFromRootFile:string, json:any){ fs.writeFileSync(pathFromRootFile, JSON.stringify(json)); }
nodespull/nodespull
src/swagger/templates/master.ts
<reponame>nodespull/nodespull<gh_stars>1-10 import {parseJSON} from "../../etc/system-tools/json" import {PathVar} from "../../etc/other/paths" export default function(){ const packageJSON = parseJSON(PathVar.getPackageJson()); return { "swagger": "2.0", "info": { "description": p...
nodespull/nodespull
src/etc/developer-op-files/docker-compose-all.ts
<reponame>nodespull/nodespull export default function file(data:any){ return `version: '3.1' services: ${data.rootFile_name}: image: nodespull build: context: ../ dockerfile: nodespull/Dockerfile command: npm run dev volumes: - ..:/usr/app/ ...
nodespull/nodespull
src/cli/route/templates/delete/swagger.delete.template.ts
<gh_stars>1-10 export default function del(path:string):string{ return `{ "${path}":{ "delete":{ "summary": "no summary", "description":"no description", "parameters":[], "tags":["${path.slice(1)}"], "responses":{ "204":{ ...
nodespull/nodespull
src/etc/developer-op-files/wait-for-it.ts
export default function file(){ return `#!/usr/bin/env bash # Use this script to test if a given TCP host/port are available WAITFORIT_cmdname=\${0##*/} echoerr() { if [[ $WAITFORIT_QUIET -ne 1 ]]; then echo "$@" 1>&2; fi } usage() { cat << USAGE >&2 Usage: $WAITFORIT_cmdname host:port [-s] [-t timeout]...
nodespull/nodespull
src/etc/js-reserved-words.ts
<filename>src/etc/js-reserved-words.ts export class JSReservedWords { static getList():string[]{ return [] } }
nodespull/nodespull
src/utils/pipe.ts
import { npServiceInterface, npServicePipeFunction } from "../module/models"; import { Log } from "../etc/log"; export class npPipe{ static channels:any = {} // not used, just keeps track of running channels static registerChannel(pipeChannel:PipeChannel){ npPipe.channels[pipeChannel.id] = pipeChann...
nodespull/nodespull
src/cli/route/templates/put/spec.put.template.ts
export default function spec(path:string, moduleVarName:string, locationDepth:number):string{ let moduleFileName = moduleVarName.substr(0, moduleVarName.length-1*"Module".length)+".mod" return `const { http, link } = require("@nodespull/core") const { ${moduleVarName} } = require("${'../'.repeat(locationDepth)...
nodespull/nodespull
src/database/helpers/functions-placeholders.ts
function _(){} const placeholders = { getName:_, where:_, select:_, selectAll:_, edit:_, insert:_, delete:_, as:_, one_to_one:_, one_to_many:_, many_to_many:_, linkTable:_, defineTable:_, table:_, model:_,define:_, sync:()=>{return Promise.resolve()} } export default placeholders;
nodespull/nodespull
src/module/models.ts
<filename>src/module/models.ts import { npModule } from "./npmodule"; import { npJWT } from "../crypt/models/jwt"; export interface npModuleUserInterface { // interface for object returned to user readonly name: string, readonly imports: npModule[], readonly forward: Function, readonly service: { [name...
nodespull/nodespull
src/cli/deploy/templates/dockerfile.ts
<gh_stars>1-10 export function appDockerfile(){ let rootFile_name:string = process.argv[1].split("/").pop()!; return `FROM node:10 COPY ./package.json /usr/app/ RUN npm install RUN npm i @nodespull/core COPY . /usr/app/ RUN mkdir -p /usr/app WORKDIR /usr/app CMD ["node","src/${rootFile_name}","s...
nodespull/nodespull
src/cli/service/templates/service.socket.template.ts
export default function getTemplate(serviceVarName:string, moduleVarName:string):string{ if(moduleVarName.slice(-1*"Module".length) != "Module") moduleVarName = moduleVarName.toLowerCase()+"Module" let moduleFileName = moduleVarName.substr(0, moduleVarName.length-1*"Module".length)+".mod" return `const { l...
nodespull/nodespull
src/cli/link/database/table/templates/stage.attribute.ts
export default function stageModelTemplate(text:string|null, connectionSelector:string):string{ let val = `const { editor } = require("@nodespull/core/database")("${connectionSelector}") const { type, onUpload, onRevert, rawQuery } = editor ` if(!text) val += ` onUpload(() => { }) onRevert(() => { }) ` ...
nodespull/nodespull
src/files-runner/service-files.ts
<reponame>nodespull/nodespull import { FilesEngine } from "./common" ; import { PathVar } from "../etc/other/paths" export class Service_FilesLoader extends FilesEngine{ static isLoaded:boolean = false static load(){ if(Service_FilesLoader.isLoaded) return new Service_FilesLoader() // ...
nodespull/nodespull
src/bootstrap/bootconf/bootconf-store.ts
<filename>src/bootstrap/bootconf/bootconf-store.ts export default { server: { PORT: 3000, IS_SWAGGER_ACTIVE: false } }
nodespull/nodespull
src/entrypoint.ts
/** * ==================== * NODESPULL ENTRYPOINT * ==================== */ import { NpServer } from "./bootstrap" import { NpUserConfig } from "./bootstrap/bootconf/bootconf-user-config" import { Boot_Env } from "./bootstrap/boot-env" import { npModuleController } from "./module/controllers/npModuleController" imp...
nodespull/nodespull
src/cli/link/database/db/index.ts
<gh_stars>1-10 import {cmd} from "../../../exe/exe.log" import fs from "fs" import {PathVar} from "../../../../etc/other/paths" import getDatabaseTemplate from "./templates/database.template" import { StringParser } from "../../../../etc/system-tools/string-validator"; import { Log } from "../../../../etc/log"; import...
nodespull/nodespull
src/database/systems/mysql/model.ts
<reponame>nodespull/nodespull<filename>src/database/systems/mysql/model.ts import { DbConnectionArg } from "../../models/connectionArg"; export interface db_mySQLConnectionArg extends DbConnectionArg{ }
nodespull/nodespull
src/cli/git.ts
import fs from "fs" import {cmd} from "./exe/exe.log"; //initialize git export async function init(){ await cmd("touch",[".gitignore"], false); fs.writeFile(".gitignore","node_modules/",()=>{}); await cmd("git", ["init"], false); } export async function commit(){ await cmd("git", ["add", "."], false)...
nodespull/nodespull
src/cli/module/templates/module.template.ts
<reponame>nodespull/nodespull export default function getModuleTemplate(moduleVarName:string):string{ if(moduleVarName.slice(-1*"Module".length) != "Module") moduleVarName = moduleVarName.toLowerCase()+"Module" return `const { npModule } = require("@nodespull/core") const { jwt } = require("@nodespull/core/cry...
nodespull/nodespull
src/utils/db.ts
<reponame>nodespull/nodespull // const {DataTypes} = require("sequelize"); // /** // * SQL Database types // */ // class Type{ // constructor(){} // string = DataTypes.STRING; // int = DataTypes.INTEGER; // text = DataTypes.TEXT; // float = DataTypes.FLOAT; // time = DataTypes.TIME; ...
nodespull/nodespull
src/database/models/connectionArg.ts
export interface DbConnectionArg { isActive: boolean, system: string, selector: string, database: string, host: string, port: string|number, username: string, password: string }
nodespull/nodespull
src/bootstrap/boot-env/collector.ts
import { EnvType } from "./interfaces" import { AppEnv } from "./store" import { StringParser } from "../../etc/system-tools/string-validator" export class EnvCollector { constructor(private envType:EnvType){} loadVars = (userTags:string[], varsMap: {[varName:string]:string})=>{ let collectedVars:any ...
nodespull/nodespull
src/crypt/models/oauth2.ts
import { oauth2AuthProfileInterface } from "./interface"; export class npOauth2 { constructor(public _args: oauth2AuthProfileInterface){} /** * parse authorization code as defined in the profile */ parse(authorization: string, callback: Function){ this._args.onInit(authorization, callbac...
nodespull/nodespull
src/setup-depreciated/install.ts
<filename>src/setup-depreciated/install.ts const execa = require('execa'); const fs = require("fs"); import {userInput} from "../etc/system-tools/stdin" // import {DB_PORT_TEST} from "../entrypoint" import {getCmd as cliCmd} from "../cli" // files list import dockerfile from "../etc/developer-op-files/dockerfile"; i...
nodespull/nodespull
src/bootstrap/boot-env/index.ts
<gh_stars>1-10 import { Env_FilesLoader } from "../../files-runner/env-files" import { npEnv_interface } from "./interfaces" import { EnvType } from "./interfaces" import { EnvCollector } from "./collector" export class Boot_Env { static hasBooted:boolean = false static npEnv: npEnv_interface static ens...
nodespull/nodespull
src/crypt/models/jwt.ts
import jwt from "jsonwebtoken" import { JwtAuthProfileInterface, npJWTGuard } from "./interface"; import { Log } from "../../etc/log"; import { JwtAlg } from ".."; export class npJWT{ constructor(private _args: JwtAuthProfileInterface){} /** * a JWT Guard is used to protect a route or all routes ...
nodespull/nodespull
src/module/controllers/npRouteController.ts
<gh_stars>1-10 import { npRouteInterface, npModuleUserInterface } from "../models"; export class npRouteController{ static handler(args:npRouteInterface):npModuleUserInterface|null{ args.jwtProfile = args.useGuard if(args.loader && args.loader._loadRoutes){ args.loader._addAndLoadRoute...
nodespull/nodespull
src/cli/index.ts
import { customStdinResponse, userInput } from "../etc/system-tools/stdin" import { newRoute } from "./route" import { newLink } from "./link"; import { newTable } from "./link/database/table" import { newModule } from "./module"; import { newService } from "./service"; import { Log } from "../etc/log"; import { cliSta...
nodespull/nodespull
src/files-runner/index.ts
import { DB_Model_Rel_FilesLoader } from "./db-model-rel-files" import { Module_FilesLoader } from "./module-files" import { Service_FilesLoader } from "./service-files" import { RestRoute_FilesLoader } from "./route-files" import { Env_FilesLoader } from "./env-files" import { Database_FilesLoader } from "./database-f...
nodespull/nodespull
src/cli/link/database/table/templates/relation.ts
export default function relation(tableName:string, connectionSelector:string):string{ return `const { editor } = require("@nodespull/core/database")("${connectionSelector}") const { relations, onUpload, onRevert, rawQuery } = editor onUpload(() => { relations.set(forTable = "${tableName}", { /** add FK t...
nodespull/nodespull
src/database/models/query.ts
<filename>src/database/models/query.ts export interface RawQueryResponse { results: any[], metadata: any } export interface QueryInterface{ /** * Add a new column to a table: async * @param {string} table * @param {string} key * @param {any} attribute * @param {any} options ...
nodespull/nodespull
src/cli/link/database/table/templates/attribute.ts
export default function model(tableName:string, connectionSelector:string):string{ return `const { editor } = require("@nodespull/core/database")("${connectionSelector}") const { type, onUpload, onRevert, rawQuery } = editor onUpload(() => { editor.defineModel(withTable = "${tableName}").as({ /* add attr...
nodespull/nodespull
src/files-runner/auth-files.ts
import { FilesEngine } from "./common" ; import { PathVar } from "../etc/other/paths" export class Auth_FilesLoader extends FilesEngine{ static isLoaded:boolean = false static load(){ if(Auth_FilesLoader.isLoaded) return new Auth_FilesLoader() // Auth_FilesLoader.isLoaded = true } ...
nodespull/nodespull
src/database/user-loader.ts
import { DbConnectionArg } from "./models/connectionArg"; import { DatabaseConnectionController } from "./connection"; export class npDatabaseConnectionLoader{ static register(args:DbConnectionArg){ if(args.system == "mySQL") DatabaseConnectionController.createMySQLConnection(args) } }