This commit is contained in:
Tutur33
2023-11-25 00:01:46 +01:00
parent 938ad9d309
commit cb411653c8
27388 changed files with 18691 additions and 3339152 deletions
+8
View File
@@ -0,0 +1,8 @@
PORT=3333
HOST=0.0.0.0
NODE_ENV=development
APP_KEY=-WaTKbETBJLut7cGRKrYHRqW1tqnxDad
DRIVE_DISK=local
SESSION_DRIVER=cookie
CACHE_VIEWS=false
DB_CONNECTION=sqlite
-1
View File
@@ -2,5 +2,4 @@ node_modules
coverage
.vscode
.DS_STORE
.env
tmp
+57
View File
@@ -0,0 +1,57 @@
{
"typescript": false,
"commands": [
"./commands",
"@adonisjs/core/build/commands/index.js",
"@adonisjs/repl/build/commands",
"@adonisjs/lucid/build/commands"
],
"exceptionHandlerNamespace": "App/Exceptions/Handler",
"aliases": {
"App": "app",
"Config": "config",
"Database": "database",
"Contracts": "contracts"
},
"preloads": [
"./start/routes",
"./start/kernel"
],
"providers": [
"./providers/AppProvider",
"@adonisjs/core",
"@adonisjs/session",
"@adonisjs/view",
"@adonisjs/shield",
"@adonisjs/lucid",
"@adonisjs/auth"
],
"metaFiles": [
{
"pattern": "public/**",
"reloadServer": false
},
{
"pattern": "resources/views/**/*.edge",
"reloadServer": false
}
],
"aceProviders": [
"@adonisjs/repl"
],
"tests": {
"suites": [
{
"name": "functional",
"files": [
"tests/functional/**/*.spec(.ts|.js)"
],
"timeout": 60000
}
]
},
"testProviders": [
"@japa/preset-adonis/TestsProvider"
],
"lastCompiledAt": "2023-11-24T22:56:20.428Z"
}
+8
View File
@@ -0,0 +1,8 @@
PORT=3333
HOST=0.0.0.0
NODE_ENV=development
APP_KEY=-WaTKbETBJLut7cGRKrYHRqW1tqnxDad
DRIVE_DISK=local
SESSION_DRIVER=cookie
CACHE_VIEWS=false
DB_CONNECTION=sqlite
+16
View File
@@ -0,0 +1,16 @@
/*
|--------------------------------------------------------------------------
| Ace Commands
|--------------------------------------------------------------------------
|
| This file is the entry point for running ace commands.
|
*/
require('reflect-metadata')
require('source-map-support').install({ handleUncaughtExceptions: false })
const { Ignitor } = require('@adonisjs/core/build/standalone')
new Ignitor(__dirname)
.ace()
.handle(process.argv.slice(2))
+575
View File
@@ -0,0 +1,575 @@
{
"commands": {
"dump:rcfile": {
"settings": {},
"commandPath": "@adonisjs/core/build/commands/DumpRc",
"commandName": "dump:rcfile",
"description": "Dump contents of .adonisrc.json file along with defaults",
"args": [],
"aliases": [],
"flags": []
},
"list:routes": {
"settings": {
"loadApp": true,
"stayAlive": true
},
"commandPath": "@adonisjs/core/build/commands/ListRoutes/index",
"commandName": "list:routes",
"description": "List application routes",
"args": [],
"aliases": [],
"flags": [
{
"name": "verbose",
"propertyName": "verbose",
"type": "boolean",
"description": "Display more information"
},
{
"name": "reverse",
"propertyName": "reverse",
"type": "boolean",
"alias": "r",
"description": "Reverse routes display"
},
{
"name": "methods",
"propertyName": "methodsFilter",
"type": "array",
"alias": "m",
"description": "Filter routes by method"
},
{
"name": "patterns",
"propertyName": "patternsFilter",
"type": "array",
"alias": "p",
"description": "Filter routes by the route pattern"
},
{
"name": "names",
"propertyName": "namesFilter",
"type": "array",
"alias": "n",
"description": "Filter routes by route name"
},
{
"name": "json",
"propertyName": "json",
"type": "boolean",
"description": "Output as JSON"
},
{
"name": "table",
"propertyName": "table",
"type": "boolean",
"description": "Output as Table"
},
{
"name": "max-width",
"propertyName": "maxWidth",
"type": "number",
"description": "Specify maximum rendering width. Ignored for JSON Output"
}
]
},
"generate:key": {
"settings": {},
"commandPath": "@adonisjs/core/build/commands/GenerateKey",
"commandName": "generate:key",
"description": "Generate a new APP_KEY secret",
"args": [],
"aliases": [],
"flags": []
},
"repl": {
"settings": {
"loadApp": true,
"environment": "repl",
"stayAlive": true
},
"commandPath": "@adonisjs/repl/build/commands/AdonisRepl",
"commandName": "repl",
"description": "Start a new REPL session",
"args": [],
"aliases": [],
"flags": []
},
"db:seed": {
"settings": {
"loadApp": true
},
"commandPath": "@adonisjs/lucid/build/commands/DbSeed",
"commandName": "db:seed",
"description": "Execute database seeders",
"args": [],
"aliases": [],
"flags": [
{
"name": "connection",
"propertyName": "connection",
"type": "string",
"description": "Define a custom database connection for the seeders",
"alias": "c"
},
{
"name": "interactive",
"propertyName": "interactive",
"type": "boolean",
"description": "Run seeders in interactive mode",
"alias": "i"
},
{
"name": "files",
"propertyName": "files",
"type": "array",
"description": "Define a custom set of seeders files names to run",
"alias": "f"
},
{
"name": "compact-output",
"propertyName": "compactOutput",
"type": "boolean",
"description": "A compact single-line output"
}
]
},
"db:wipe": {
"settings": {
"loadApp": true
},
"commandPath": "@adonisjs/lucid/build/commands/DbWipe",
"commandName": "db:wipe",
"description": "Drop all tables, views and types in database",
"args": [],
"aliases": [],
"flags": [
{
"name": "connection",
"propertyName": "connection",
"type": "string",
"description": "Define a custom database connection",
"alias": "c"
},
{
"name": "drop-views",
"propertyName": "dropViews",
"type": "boolean",
"description": "Drop all views"
},
{
"name": "drop-types",
"propertyName": "dropTypes",
"type": "boolean",
"description": "Drop all custom types (Postgres only)"
},
{
"name": "force",
"propertyName": "force",
"type": "boolean",
"description": "Explicitly force command to run in production"
}
]
},
"db:truncate": {
"settings": {
"loadApp": true
},
"commandPath": "@adonisjs/lucid/build/commands/DbTruncate",
"commandName": "db:truncate",
"description": "Truncate all tables in database",
"args": [],
"aliases": [],
"flags": [
{
"name": "connection",
"propertyName": "connection",
"type": "string",
"description": "Define a custom database connection",
"alias": "c"
},
{
"name": "force",
"propertyName": "force",
"type": "boolean",
"description": "Explicitly force command to run in production"
}
]
},
"make:model": {
"settings": {
"loadApp": true
},
"commandPath": "@adonisjs/lucid/build/commands/MakeModel",
"commandName": "make:model",
"description": "Make a new Lucid model",
"args": [
{
"type": "string",
"propertyName": "name",
"name": "name",
"required": true,
"description": "Name of the model class"
}
],
"aliases": [],
"flags": [
{
"name": "migration",
"propertyName": "migration",
"type": "boolean",
"alias": "m",
"description": "Generate the migration for the model"
},
{
"name": "controller",
"propertyName": "controller",
"type": "boolean",
"alias": "c",
"description": "Generate the controller for the model"
},
{
"name": "factory",
"propertyName": "factory",
"type": "boolean",
"alias": "f",
"description": "Generate a factory for the model"
}
]
},
"make:migration": {
"settings": {
"loadApp": true
},
"commandPath": "@adonisjs/lucid/build/commands/MakeMigration",
"commandName": "make:migration",
"description": "Make a new migration file",
"args": [
{
"type": "string",
"propertyName": "name",
"name": "name",
"required": true,
"description": "Name of the migration file"
}
],
"aliases": [],
"flags": [
{
"name": "connection",
"propertyName": "connection",
"type": "string",
"description": "The connection flag is used to lookup the directory for the migration file"
},
{
"name": "folder",
"propertyName": "folder",
"type": "string",
"description": "Pre-select a migration directory"
},
{
"name": "create",
"propertyName": "create",
"type": "string",
"description": "Define the table name for creating a new table"
},
{
"name": "table",
"propertyName": "table",
"type": "string",
"description": "Define the table name for altering an existing table"
}
]
},
"make:seeder": {
"settings": {},
"commandPath": "@adonisjs/lucid/build/commands/MakeSeeder",
"commandName": "make:seeder",
"description": "Make a new Seeder file",
"args": [
{
"type": "string",
"propertyName": "name",
"name": "name",
"required": true,
"description": "Name of the seeder class"
}
],
"aliases": [],
"flags": []
},
"make:factory": {
"settings": {},
"commandPath": "@adonisjs/lucid/build/commands/MakeFactory",
"commandName": "make:factory",
"description": "Make a new factory",
"args": [
{
"type": "string",
"propertyName": "model",
"name": "model",
"required": true,
"description": "The name of the model"
}
],
"aliases": [],
"flags": [
{
"name": "model-path",
"propertyName": "modelPath",
"type": "string",
"description": "The path to the model"
},
{
"name": "exact",
"propertyName": "exact",
"type": "boolean",
"description": "Create the factory with the exact name as provided",
"alias": "e"
}
]
},
"migration:run": {
"settings": {
"loadApp": true
},
"commandPath": "@adonisjs/lucid/build/commands/Migration/Run",
"commandName": "migration:run",
"description": "Migrate database by running pending migrations",
"args": [],
"aliases": [],
"flags": [
{
"name": "connection",
"propertyName": "connection",
"type": "string",
"description": "Define a custom database connection",
"alias": "c"
},
{
"name": "force",
"propertyName": "force",
"type": "boolean",
"description": "Explicitly force to run migrations in production"
},
{
"name": "dry-run",
"propertyName": "dryRun",
"type": "boolean",
"description": "Do not run actual queries. Instead view the SQL output"
},
{
"name": "compact-output",
"propertyName": "compactOutput",
"type": "boolean",
"description": "A compact single-line output"
},
{
"name": "disable-locks",
"propertyName": "disableLocks",
"type": "boolean",
"description": "Disable locks acquired to run migrations safely"
}
]
},
"migration:rollback": {
"settings": {
"loadApp": true
},
"commandPath": "@adonisjs/lucid/build/commands/Migration/Rollback",
"commandName": "migration:rollback",
"description": "Rollback migrations to a specific batch number",
"args": [],
"aliases": [],
"flags": [
{
"name": "connection",
"propertyName": "connection",
"type": "string",
"description": "Define a custom database connection",
"alias": "c"
},
{
"name": "force",
"propertyName": "force",
"type": "boolean",
"description": "Explictly force to run migrations in production"
},
{
"name": "dry-run",
"propertyName": "dryRun",
"type": "boolean",
"description": "Do not run actual queries. Instead view the SQL output"
},
{
"name": "batch",
"propertyName": "batch",
"type": "number",
"description": "Define custom batch number for rollback. Use 0 to rollback to initial state"
},
{
"name": "compact-output",
"propertyName": "compactOutput",
"type": "boolean",
"description": "A compact single-line output"
},
{
"name": "disable-locks",
"propertyName": "disableLocks",
"type": "boolean",
"description": "Disable locks acquired to run migrations safely"
}
]
},
"migration:status": {
"settings": {
"loadApp": true
},
"commandPath": "@adonisjs/lucid/build/commands/Migration/Status",
"commandName": "migration:status",
"description": "View migrations status",
"args": [],
"aliases": [],
"flags": [
{
"name": "connection",
"propertyName": "connection",
"type": "string",
"description": "Define a custom database connection",
"alias": "c"
}
]
},
"migration:reset": {
"settings": {
"loadApp": true
},
"commandPath": "@adonisjs/lucid/build/commands/Migration/Reset",
"commandName": "migration:reset",
"description": "Rollback all migrations",
"args": [],
"aliases": [],
"flags": [
{
"name": "connection",
"propertyName": "connection",
"type": "string",
"description": "Define a custom database connection",
"alias": "c"
},
{
"name": "force",
"propertyName": "force",
"type": "boolean",
"description": "Explicitly force command to run in production"
},
{
"name": "dry-run",
"propertyName": "dryRun",
"type": "boolean",
"description": "Do not run actual queries. Instead view the SQL output"
},
{
"name": "disable-locks",
"propertyName": "disableLocks",
"type": "boolean",
"description": "Disable locks acquired to run migrations safely"
}
]
},
"migration:refresh": {
"settings": {
"loadApp": true
},
"commandPath": "@adonisjs/lucid/build/commands/Migration/Refresh",
"commandName": "migration:refresh",
"description": "Rollback and migrate database",
"args": [],
"aliases": [],
"flags": [
{
"name": "connection",
"propertyName": "connection",
"type": "string",
"description": "Define a custom database connection",
"alias": "c"
},
{
"name": "force",
"propertyName": "force",
"type": "boolean",
"description": "Explicitly force command to run in production"
},
{
"name": "dry-run",
"propertyName": "dryRun",
"type": "boolean",
"description": "Do not run actual queries. Instead view the SQL output"
},
{
"name": "seed",
"propertyName": "seed",
"type": "boolean",
"description": "Run seeders"
},
{
"name": "disable-locks",
"propertyName": "disableLocks",
"type": "boolean",
"description": "Disable locks acquired to run migrations safely"
}
]
},
"migration:fresh": {
"settings": {
"loadApp": true
},
"commandPath": "@adonisjs/lucid/build/commands/Migration/Fresh",
"commandName": "migration:fresh",
"description": "Drop all tables and re-migrate the database",
"args": [],
"aliases": [],
"flags": [
{
"name": "connection",
"propertyName": "connection",
"type": "string",
"description": "Define a custom database connection",
"alias": "c"
},
{
"name": "force",
"propertyName": "force",
"type": "boolean",
"description": "Explicitly force command to run in production"
},
{
"name": "seed",
"propertyName": "seed",
"type": "boolean",
"description": "Run seeders"
},
{
"name": "drop-views",
"propertyName": "dropViews",
"type": "boolean",
"description": "Drop all views"
},
{
"name": "drop-types",
"propertyName": "dropTypes",
"type": "boolean",
"description": "Drop all custom types (Postgres only)"
},
{
"name": "disable-locks",
"propertyName": "disableLocks",
"type": "boolean",
"description": "Disable locks acquired to run migrations safely"
}
]
}
},
"aliases": {}
}
@@ -0,0 +1,30 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const ModifPseudoValidator_1 = __importDefault(global[Symbol.for('ioc.use')]("App/Validators/ModifPseudoValidator"));
const ModifEmailValidator_1 = __importDefault(global[Symbol.for('ioc.use')]("App/Validators/ModifEmailValidator"));
class ComptesController {
async index({ view }) {
return view.render('compte');
}
async modifpseudo({ request, auth, session, response }) {
const user = auth.user;
await request.validate(ModifPseudoValidator_1.default);
user.pseudo = request.input('pseudo');
await user.save();
session.flash({ success: "Username updated successfully" });
response.redirect().back();
}
async modifemail({ request, auth, session, response }) {
const user = auth.user;
await request.validate(ModifEmailValidator_1.default);
user.email = request.input('email');
await user.save();
session.flash({ success: "Email updated successfully" });
response.redirect().back();
}
}
exports.default = ComptesController;
//# sourceMappingURL=ComptesController.js.map
@@ -0,0 +1 @@
{"version":3,"file":"ComptesController.js","sourceRoot":"","sources":["../../../../app/Controllers/Http/ComptesController.ts"],"names":[],"mappings":";;;;;AACA,qHAAsE;AACtE,mHAAoE;AAEpE,MAAqB,iBAAiB;IAEpC,KAAK,CAAC,KAAK,CAAC,EAAE,IAAI,EAAuB;QACvC,OAAO,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAA;IAC9B,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAuB;QACzE,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAA;QAEtB,MAAM,OAAO,CAAC,QAAQ,CAAC,8BAAoB,CAAC,CAAA;QAE5C,IAAK,CAAC,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAA;QACtC,MAAM,IAAK,CAAC,IAAI,EAAE,CAAA;QAClB,OAAO,CAAC,KAAK,CAAC,EAAC,OAAO,EAAE,+BAA+B,EAAC,CAAC,CAAA;QACzD,QAAQ,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAA;IAC5B,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAuB;QACxE,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAA;QAEtB,MAAM,OAAO,CAAC,QAAQ,CAAC,6BAAmB,CAAC,CAAA;QAE3C,IAAK,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;QACpC,MAAM,IAAK,CAAC,IAAI,EAAE,CAAA;QAClB,OAAO,CAAC,KAAK,CAAC,EAAC,OAAO,EAAE,4BAA4B,EAAC,CAAC,CAAA;QACtD,QAAQ,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAA;IAC5B,CAAC;CAEF;AA5BD,oCA4BC"}
@@ -0,0 +1,18 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
class ProjectsController {
async nups({ view }) {
return view.render('projects/nups/project-nups');
}
async nupsWeb({ view }) {
return view.render('projects/nups/nups');
}
async myNetwork({ view }) {
return view.render('projects/myNetwork/index');
}
async journal({ view }) {
return view.render('projects/journal/index');
}
}
exports.default = ProjectsController;
//# sourceMappingURL=ProjectsController.js.map
@@ -0,0 +1 @@
{"version":3,"file":"ProjectsController.js","sourceRoot":"","sources":["../../../../app/Controllers/Http/ProjectsController.ts"],"names":[],"mappings":";;AAEA,MAAqB,kBAAkB;IAErC,KAAK,CAAC,IAAI,CAAC,EAAE,IAAI,EAAuB;QACtC,OAAO,IAAI,CAAC,MAAM,CAAC,4BAA4B,CAAC,CAAA;IAClD,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,EAAE,IAAI,EAAuB;QACzC,OAAO,IAAI,CAAC,MAAM,CAAC,oBAAoB,CAAC,CAAA;IAC1C,CAAC;IAED,KAAK,CAAC,SAAS,CAAC,EAAE,IAAI,EAAuB;QAC3C,OAAO,IAAI,CAAC,MAAM,CAAC,0BAA0B,CAAC,CAAA;IAChD,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,EAAE,IAAI,EAAuB;QACzC,OAAO,IAAI,CAAC,MAAM,CAAC,wBAAwB,CAAC,CAAA;IAC9C,CAAC;CAEF;AAlBD,qCAkBC"}
@@ -0,0 +1,9 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
class TermsController {
async index({ view }) {
return view.render('terms');
}
}
exports.default = TermsController;
//# sourceMappingURL=TermsController.js.map
@@ -0,0 +1 @@
{"version":3,"file":"TermsController.js","sourceRoot":"","sources":["../../../../app/Controllers/Http/TermsController.ts"],"names":[],"mappings":";;AAEA,MAAqB,eAAe;IAElC,KAAK,CAAC,KAAK,CAAC,EAAE,IAAI,EAAuB;QACvC,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;IAC7B,CAAC;CAEF;AAND,kCAMC"}
+19
View File
@@ -0,0 +1,19 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const Logger_1 = __importDefault(global[Symbol.for('ioc.use')]("Adonis/Core/Logger"));
const HttpExceptionHandler_1 = __importDefault(global[Symbol.for('ioc.use')]("Adonis/Core/HttpExceptionHandler"));
class ExceptionHandler extends HttpExceptionHandler_1.default {
constructor() {
super(Logger_1.default);
this.statusPages = {
'403': 'errors/unauthorized',
'404': 'errors/not-found',
'500..599': 'errors/server-error',
};
}
}
exports.default = ExceptionHandler;
//# sourceMappingURL=Handler.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"Handler.js","sourceRoot":"","sources":["../../../app/Exceptions/Handler.ts"],"names":[],"mappings":";;;;;AAeA,sFAA4C;AAC5C,kHAAwE;AAExE,MAAqB,gBAAiB,SAAQ,8BAAoB;IAOhE;QACE,KAAK,CAAC,gBAAM,CAAC,CAAA;QAPL,gBAAW,GAAG;YACtB,KAAK,EAAE,qBAAqB;YAC5B,KAAK,EAAE,kBAAkB;YACzB,UAAU,EAAE,qBAAqB;SAClC,CAAA;IAID,CAAC;CACF;AAVD,mCAUC"}
+26
View File
@@ -0,0 +1,26 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const standalone_1 = require("@adonisjs/auth/build/standalone");
class AuthMiddleware {
constructor() {
this.redirectTo = '/login';
}
async authenticate(auth, guards) {
let guardLastAttempted;
for (let guard of guards) {
guardLastAttempted = guard;
if (await auth.use(guard).check()) {
auth.defaultGuard = guard;
return true;
}
}
throw new standalone_1.AuthenticationException('Unauthorized access', 'E_UNAUTHORIZED_ACCESS', guardLastAttempted, this.redirectTo);
}
async handle({ auth }, next, customGuards) {
const guards = customGuards.length ? customGuards : [auth.name];
await this.authenticate(auth, guards);
await next();
}
}
exports.default = AuthMiddleware;
//# sourceMappingURL=Auth.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"Auth.js","sourceRoot":"","sources":["../../../app/Middleware/Auth.ts"],"names":[],"mappings":";;AAAA,gEAAyE;AAWzE,MAAqB,cAAc;IAAnC;QAIY,eAAU,GAAG,QAAQ,CAAA;IA4DjC,CAAC;IAlDW,KAAK,CAAC,YAAY,CAAC,IAAiC,EAAE,MAA4B;QAO1F,IAAI,kBAAsC,CAAA;QAE1C,KAAK,IAAI,KAAK,IAAI,MAAM,EAAE;YACxB,kBAAkB,GAAG,KAAK,CAAA;YAE1B,IAAI,MAAM,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;gBAMjC,IAAI,CAAC,YAAY,GAAG,KAAK,CAAA;gBACzB,OAAO,IAAI,CAAA;aACZ;SACF;QAKD,MAAM,IAAI,oCAAuB,CAC/B,qBAAqB,EACrB,uBAAuB,EACvB,kBAAkB,EAClB,IAAI,CAAC,UAAU,CAChB,CAAA;IACH,CAAC;IAKM,KAAK,CAAC,MAAM,CACjB,EAAE,IAAI,EAAuB,EAC7B,IAAyB,EACzB,YAAkC;QAMlC,MAAM,MAAM,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QAC/D,MAAM,IAAI,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,CAAA;QACrC,MAAM,IAAI,EAAE,CAAA;IACd,CAAC;CACF;AAhED,iCAgEC"}
+10
View File
@@ -0,0 +1,10 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
class SilentAuthMiddleware {
async handle({ auth }, next) {
await auth.check();
await next();
}
}
exports.default = SilentAuthMiddleware;
//# sourceMappingURL=SilentAuth.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"SilentAuth.js","sourceRoot":"","sources":["../../../app/Middleware/SilentAuth.ts"],"names":[],"mappings":";;AAQA,MAAqB,oBAAoB;IAIhC,KAAK,CAAC,MAAM,CAAC,EAAE,IAAI,EAAuB,EAAE,IAAyB;QAK1E,MAAM,IAAI,CAAC,KAAK,EAAE,CAAA;QAClB,MAAM,IAAI,EAAE,CAAA;IACd,CAAC;CACF;AAZD,uCAYC"}
+60
View File
@@ -0,0 +1,60 @@
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const luxon_1 = require("luxon");
const Hash_1 = __importDefault(global[Symbol.for('ioc.use')]("Adonis/Core/Hash"));
const Orm_1 = global[Symbol.for('ioc.use')]("Adonis/Lucid/Orm");
class User extends Orm_1.BaseModel {
static async hashPassword(user) {
if (user.$dirty.password) {
user.password = await Hash_1.default.make(user.password);
}
}
}
__decorate([
(0, Orm_1.column)({ isPrimary: true }),
__metadata("design:type", Number)
], User.prototype, "id", void 0);
__decorate([
(0, Orm_1.column)(),
__metadata("design:type", String)
], User.prototype, "pseudo", void 0);
__decorate([
(0, Orm_1.column)(),
__metadata("design:type", String)
], User.prototype, "email", void 0);
__decorate([
(0, Orm_1.column)({ serializeAs: null }),
__metadata("design:type", String)
], User.prototype, "password", void 0);
__decorate([
(0, Orm_1.column)(),
__metadata("design:type", Object)
], User.prototype, "rememberMeToken", void 0);
__decorate([
Orm_1.column.dateTime({ autoCreate: true }),
__metadata("design:type", luxon_1.DateTime)
], User.prototype, "createdAt", void 0);
__decorate([
Orm_1.column.dateTime({ autoCreate: true, autoUpdate: true }),
__metadata("design:type", luxon_1.DateTime)
], User.prototype, "updatedAt", void 0);
__decorate([
(0, Orm_1.beforeSave)(),
__metadata("design:type", Function),
__metadata("design:paramtypes", [User]),
__metadata("design:returntype", Promise)
], User, "hashPassword", null);
exports.default = User;
//# sourceMappingURL=User.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"User.js","sourceRoot":"","sources":["../../../app/Models/User.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,iCAAgC;AAChC,kFAAwC;AACxC,gEAAqE;AAErE,MAAqB,IAAK,SAAQ,eAAS;IAuBlC,MAAM,CAAC,KAAK,CAAC,YAAY,CAAE,IAAU;QAC1C,IAAI,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE;YACxB,IAAI,CAAC,QAAQ,GAAG,MAAM,cAAI,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;SAC/C;IACH,CAAC;CACF;AA1BC;IADC,IAAA,YAAM,EAAC,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;;gCACX;AAGjB;IADC,IAAA,YAAM,GAAE;;oCACY;AAGrB;IADC,IAAA,YAAM,GAAE;;mCACW;AAGpB;IADC,IAAA,YAAM,EAAC,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC;;sCACP;AAGvB;IADC,IAAA,YAAM,GAAE;;6CAC4B;AAGrC;IADC,YAAM,CAAC,QAAQ,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC;8BACpB,gBAAQ;uCAAA;AAG1B;IADC,YAAM,CAAC,QAAQ,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC;8BACtC,gBAAQ;uCAAA;AAG1B;IADC,IAAA,gBAAU,GAAE;;qCAC2B,IAAI;;8BAI3C;AA3BH,uBA4BC"}
@@ -0,0 +1,21 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const Validator_1 = global[Symbol.for('ioc.use')]("Adonis/Core/Validator");
class CreateUserValidator {
constructor(ctx) {
this.ctx = ctx;
this.schema = Validator_1.schema.create({
pseudo: Validator_1.schema.string(),
email: Validator_1.schema.string({}, [Validator_1.rules.email(), Validator_1.rules.unique({ table: 'users', column: 'email' })]),
password: Validator_1.schema.string({}, [Validator_1.rules.minLength(4), Validator_1.rules.confirmed()])
});
this.messages = {
required: 'The {{ field }} is required to create a new account',
'email.email': 'Vous devez saisir un email dans le champ email',
'email.unique': 'Email is already in use',
'password.minLength': 'The password must be at least 4 characters long'
};
}
}
exports.default = CreateUserValidator;
//# sourceMappingURL=CreateUserValidator.js.map
@@ -0,0 +1 @@
{"version":3,"file":"CreateUserValidator.js","sourceRoot":"","sources":["../../../app/Validators/CreateUserValidator.ts"],"names":[],"mappings":";;AAAA,2EAA0E;AAG1E,MAAqB,mBAAmB;IACtC,YAAsB,GAAwB;QAAxB,QAAG,GAAH,GAAG,CAAqB;QAqBvC,WAAM,GAAG,kBAAM,CAAC,MAAM,CAAC;YAC5B,MAAM,EAAE,kBAAM,CAAC,MAAM,EAAE;YACvB,KAAK,EAAE,kBAAM,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC,iBAAK,CAAC,KAAK,EAAE,EAAE,iBAAK,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,CAAE,CAAC;YAC7F,QAAQ,EAAE,kBAAM,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC,iBAAK,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,iBAAK,CAAC,SAAS,EAAE,CAAE,CAAC;SACtE,CAAC,CAAA;QAaK,aAAQ,GAAmB;YAChC,QAAQ,EAAE,qDAAqD;YAC/D,aAAa,EAAE,gDAAgD;YAC/D,cAAc,EAAE,yBAAyB;YACzC,oBAAoB,EAAE,iDAAiD;SACxE,CAAA;IA3CgD,CAAC;CA4CnD;AA7CD,sCA6CC"}
@@ -0,0 +1,18 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const Validator_1 = global[Symbol.for('ioc.use')]("Adonis/Core/Validator");
class ModifEmailValidator {
constructor(ctx) {
this.ctx = ctx;
this.schema = Validator_1.schema.create({
email: Validator_1.schema.string({}, [Validator_1.rules.email(), Validator_1.rules.unique({ table: 'users', column: 'email' })])
});
this.messages = {
required: 'The {{ field }} is required to modifie email',
'email.email': 'You must enter an email in the email field',
'email.unique': 'Email is already in use'
};
}
}
exports.default = ModifEmailValidator;
//# sourceMappingURL=ModifEmailValidator.js.map
@@ -0,0 +1 @@
{"version":3,"file":"ModifEmailValidator.js","sourceRoot":"","sources":["../../../app/Validators/ModifEmailValidator.ts"],"names":[],"mappings":";;AAAA,2EAA0E;AAG1E,MAAqB,mBAAmB;IACtC,YAAsB,GAAwB;QAAxB,QAAG,GAAH,GAAG,CAAqB;QAqBvC,WAAM,GAAG,kBAAM,CAAC,MAAM,CAAC;YAC5B,KAAK,EAAE,kBAAM,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC,iBAAK,CAAC,KAAK,EAAE,EAAE,iBAAK,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,CAAE,CAAC;SAC9F,CAAC,CAAA;QAaK,aAAQ,GAAmB;YAChC,QAAQ,EAAE,8CAA8C;YACxD,aAAa,EAAE,4CAA4C;YAC3D,cAAc,EAAE,yBAAyB;SAC1C,CAAA;IAxCgD,CAAC;CAyCnD;AA1CD,sCA0CC"}
@@ -0,0 +1,17 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const Validator_1 = global[Symbol.for('ioc.use')]("Adonis/Core/Validator");
class ModifPseudoValidator {
constructor(ctx) {
this.ctx = ctx;
this.schema = Validator_1.schema.create({
pseudo: Validator_1.schema.string({}, [Validator_1.rules.minLength(3)])
});
this.messages = {
required: 'The {{ field }} is required to modifie pseudo',
'pseudo.minLength': 'The pseudo must be at least 3 characters long'
};
}
}
exports.default = ModifPseudoValidator;
//# sourceMappingURL=ModifPseudoValidator.js.map
@@ -0,0 +1 @@
{"version":3,"file":"ModifPseudoValidator.js","sourceRoot":"","sources":["../../../app/Validators/ModifPseudoValidator.ts"],"names":[],"mappings":";;AAAA,2EAA0E;AAG1E,MAAqB,oBAAoB;IACvC,YAAsB,GAAwB;QAAxB,QAAG,GAAH,GAAG,CAAqB;QAqBvC,WAAM,GAAG,kBAAM,CAAC,MAAM,CAAC;YAC5B,MAAM,EAAE,kBAAM,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC,iBAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;SAChD,CAAC,CAAA;QAaK,aAAQ,GAAmB;YAChC,QAAQ,EAAE,+CAA+C;YACzD,kBAAkB,EAAE,+CAA+C;SACpE,CAAA;IAvCgD,CAAC;CAwCnD;AAzCD,uCAyCC"}
+9
View File
@@ -0,0 +1,9 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const standalone_1 = require("@adonisjs/core/build/standalone");
const Application_1 = __importDefault(global[Symbol.for('ioc.use')]("Adonis/Core/Application"));
exports.default = (0, standalone_1.listDirectoryFiles)(__dirname, Application_1.default.appRoot, ['./commands/index']);
//# sourceMappingURL=index.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../commands/index.ts"],"names":[],"mappings":";;;;;AAAA,gEAAoE;AACpE,gGAAsD;AAiBtD,kBAAe,IAAA,+BAAkB,EAAC,SAAS,EAAE,qBAAW,CAAC,OAAO,EAAE,CAAC,kBAAkB,CAAC,CAAC,CAAA"}
+51
View File
@@ -0,0 +1,51 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.assets = exports.validator = exports.profiler = exports.logger = exports.http = exports.appKey = void 0;
const proxy_addr_1 = __importDefault(require("proxy-addr"));
const Env_1 = __importDefault(global[Symbol.for('ioc.use')]("Adonis/Core/Env"));
const Application_1 = __importDefault(global[Symbol.for('ioc.use')]("Adonis/Core/Application"));
exports.appKey = Env_1.default.get('APP_KEY');
exports.http = {
allowMethodSpoofing: false,
subdomainOffset: 2,
generateRequestId: false,
trustProxy: proxy_addr_1.default.compile('loopback'),
etag: false,
jsonpCallbackName: 'callback',
cookie: {
domain: '',
path: '/',
maxAge: '2h',
httpOnly: true,
secure: false,
sameSite: false,
},
};
exports.logger = {
name: Env_1.default.get('APP_NAME'),
enabled: true,
level: Env_1.default.get('LOG_LEVEL', 'info'),
prettyPrint: Env_1.default.get('NODE_ENV') === 'development',
};
exports.profiler = {
enabled: true,
blacklist: [],
whitelist: [],
};
exports.validator = {};
exports.assets = {
driver: Env_1.default.get('ASSETS_DRIVER'),
publicPath: Application_1.default.publicPath('assets'),
script: {
attributes: {
defer: true,
},
},
style: {
attributes: {},
},
};
//# sourceMappingURL=app.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"app.js","sourceRoot":"","sources":["../../config/app.ts"],"names":[],"mappings":";;;;;;AAOA,4DAAkC;AAClC,gFAAsC;AACtC,gGAAsD;AAoBzC,QAAA,MAAM,GAAW,aAAG,CAAC,GAAG,CAAC,SAAS,CAAC,CAAA;AAWnC,QAAA,IAAI,GAAiB;IAYhC,mBAAmB,EAAE,KAAK;IAO1B,eAAe,EAAE,CAAC;IAWlB,iBAAiB,EAAE,KAAK;IAWxB,UAAU,EAAE,oBAAS,CAAC,OAAO,CAAC,UAAU,CAAC;IAUzC,IAAI,EAAE,KAAK;IAOX,iBAAiB,EAAE,UAAU;IAO7B,MAAM,EAAE;QACN,MAAM,EAAE,EAAE;QACV,IAAI,EAAE,GAAG;QACT,MAAM,EAAE,IAAI;QACZ,QAAQ,EAAE,IAAI;QACd,MAAM,EAAE,KAAK;QACb,QAAQ,EAAE,KAAK;KAChB;CACF,CAAA;AAOY,QAAA,MAAM,GAAiB;IAalC,IAAI,EAAE,aAAG,CAAC,GAAG,CAAC,UAAU,CAAC;IAUzB,OAAO,EAAE,IAAI;IAYb,KAAK,EAAE,aAAG,CAAC,GAAG,CAAC,WAAW,EAAE,MAAM,CAAC;IAWnC,WAAW,EAAE,aAAG,CAAC,GAAG,CAAC,UAAU,CAAC,KAAK,aAAa;CACnD,CAAA;AAOY,QAAA,QAAQ,GAAmB;IAStC,OAAO,EAAE,IAAI;IAWb,SAAS,EAAE,EAAE;IAWb,SAAS,EAAE,EAAE;CACd,CAAA;AAWY,QAAA,SAAS,GAAoB,EAAE,CAAA;AAU/B,QAAA,MAAM,GAAwB;IAUzC,MAAM,EAAE,aAAG,CAAC,GAAG,CAAC,eAAe,CAAC;IAWhC,UAAU,EAAE,qBAAW,CAAC,UAAU,CAAC,QAAQ,CAAC;IAU5C,MAAM,EAAE;QACN,UAAU,EAAE;YACV,KAAK,EAAE,IAAI;SACZ;KACF;IAUD,KAAK,EAAE;QACL,UAAU,EAAE,EAAE;KACf;CACF,CAAA"}
+41
View File
@@ -0,0 +1,41 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
const authConfig = {
guard: 'web',
guards: {
web: {
driver: 'session',
provider: {
driver: 'lucid',
identifierKey: 'id',
uids: ['email'],
model: () => Promise.resolve().then(() => __importStar(global[Symbol.for('ioc.use')]('App/Models/User'))),
},
},
},
};
exports.default = authConfig;
//# sourceMappingURL=auth.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../config/auth.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAkBA,MAAM,UAAU,GAAe;IAC7B,KAAK,EAAE,KAAK;IACZ,MAAM,EAAE;QAWN,GAAG,EAAE;YACH,MAAM,EAAE,SAAS;YAEjB,QAAQ,EAAE;gBASR,MAAM,EAAE,OAAO;gBAWf,aAAa,EAAE,IAAI;gBAYnB,IAAI,EAAE,CAAC,OAAO,CAAC;gBAaf,KAAK,EAAE,GAAG,EAAE,yEAAQ,iBAAiB,GAAC;aACvC;SACF;KACF;CACF,CAAA;AAED,kBAAe,UAAU,CAAA"}
+40
View File
@@ -0,0 +1,40 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const bodyParserConfig = {
whitelistedMethods: ['POST', 'PUT', 'PATCH', 'DELETE'],
json: {
encoding: 'utf-8',
limit: '1mb',
strict: true,
types: [
'application/json',
'application/json-patch+json',
'application/vnd.api+json',
'application/csp-report',
],
},
form: {
encoding: 'utf-8',
limit: '1mb',
queryString: {},
convertEmptyStringsToNull: true,
types: ['application/x-www-form-urlencoded'],
},
raw: {
encoding: 'utf-8',
limit: '1mb',
queryString: {},
types: ['text/*'],
},
multipart: {
autoProcess: true,
processManually: [],
encoding: 'utf-8',
convertEmptyStringsToNull: true,
maxFields: 1000,
limit: '20mb',
types: ['multipart/form-data'],
},
};
exports.default = bodyParserConfig;
//# sourceMappingURL=bodyparser.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"bodyparser.js","sourceRoot":"","sources":["../../config/bodyparser.ts"],"names":[],"mappings":";;AASA,MAAM,gBAAgB,GAAqB;IAUzC,kBAAkB,EAAE,CAAC,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,CAAC;IAWtD,IAAI,EAAE;QACJ,QAAQ,EAAE,OAAO;QACjB,KAAK,EAAE,KAAK;QACZ,MAAM,EAAE,IAAI;QACZ,KAAK,EAAE;YACL,kBAAkB;YAClB,6BAA6B;YAC7B,0BAA0B;YAC1B,wBAAwB;SACzB;KACF;IAWD,IAAI,EAAE;QACJ,QAAQ,EAAE,OAAO;QACjB,KAAK,EAAE,KAAK;QACZ,WAAW,EAAE,EAAE;QAYf,yBAAyB,EAAE,IAAI;QAE/B,KAAK,EAAE,CAAC,mCAAmC,CAAC;KAC7C;IAYD,GAAG,EAAE;QACH,QAAQ,EAAE,OAAO;QACjB,KAAK,EAAE,KAAK;QACZ,WAAW,EAAE,EAAE;QACf,KAAK,EAAE,CAAC,QAAQ,CAAC;KAClB;IAWD,SAAS,EAAE;QAcT,WAAW,EAAE,IAAI;QAsBjB,eAAe,EAAE,EAAE;QAuBnB,QAAQ,EAAE,OAAO;QAYjB,yBAAyB,EAAE,IAAI;QAW/B,SAAS,EAAE,IAAI;QAWf,KAAK,EAAE,MAAM;QAUb,KAAK,EAAE,CAAC,qBAAqB,CAAC;KAC/B;CACF,CAAA;AAED,kBAAe,gBAAgB,CAAA"}
+20
View File
@@ -0,0 +1,20 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const corsConfig = {
enabled: false,
origin: true,
methods: ['GET', 'HEAD', 'POST', 'PUT', 'DELETE'],
headers: true,
exposeHeaders: [
'cache-control',
'content-language',
'content-type',
'expires',
'last-modified',
'pragma',
],
credentials: true,
maxAge: 90,
};
exports.default = corsConfig;
//# sourceMappingURL=cors.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"cors.js","sourceRoot":"","sources":["../../config/cors.ts"],"names":[],"mappings":";;AASA,MAAM,UAAU,GAAe;IAa7B,OAAO,EAAE,KAAK;IAwBd,MAAM,EAAE,IAAI;IAYZ,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,CAAC;IAmBjD,OAAO,EAAE,IAAI;IAsBb,aAAa,EAAE;QACb,eAAe;QACf,kBAAkB;QAClB,cAAc;QACd,SAAS;QACT,eAAe;QACf,QAAQ;KACT;IAaD,WAAW,EAAE,IAAI;IAWjB,MAAM,EAAE,EAAE;CACX,CAAA;AAED,kBAAe,UAAU,CAAA"}
+31
View File
@@ -0,0 +1,31 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const Env_1 = __importDefault(global[Symbol.for('ioc.use')]("Adonis/Core/Env"));
const Application_1 = __importDefault(global[Symbol.for('ioc.use')]("Adonis/Core/Application"));
const databaseConfig = {
connection: Env_1.default.get('DB_CONNECTION'),
connections: {
sqlite: {
client: 'sqlite',
connection: {
filename: Application_1.default.tmpPath('db.sqlite3'),
},
pool: {
afterCreate: (conn, cb) => {
conn.run('PRAGMA foreign_keys=true', cb);
}
},
migrations: {
naturalSort: true,
},
useNullAsDefault: true,
healthCheck: false,
debug: false,
},
}
};
exports.default = databaseConfig;
//# sourceMappingURL=database.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"database.js","sourceRoot":"","sources":["../../config/database.ts"],"names":[],"mappings":";;;;;AAOA,gFAAsC;AACtC,gGAAsD;AAGtD,MAAM,cAAc,GAAmB;IAWrC,UAAU,EAAE,aAAG,CAAC,GAAG,CAAC,eAAe,CAAC;IAEpC,WAAW,EAAE;QAYX,MAAM,EAAE;YACN,MAAM,EAAE,QAAQ;YAChB,UAAU,EAAE;gBACV,QAAQ,EAAE,qBAAW,CAAC,OAAO,CAAC,YAAY,CAAC;aAC5C;YACD,IAAI,EAAE;gBACJ,WAAW,EAAE,CAAC,IAAI,EAAE,EAAE,EAAE,EAAE;oBACxB,IAAI,CAAC,GAAG,CAAC,0BAA0B,EAAE,EAAE,CAAC,CAAA;gBAC1C,CAAC;aACF;YACD,UAAU,EAAE;gBACV,WAAW,EAAE,IAAI;aAClB;YACD,gBAAgB,EAAE,IAAI;YACtB,WAAW,EAAE,KAAK;YAClB,KAAK,EAAE,KAAK;SACb;KAEF;CACF,CAAA;AAED,kBAAe,cAAc,CAAA"}
+21
View File
@@ -0,0 +1,21 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const Env_1 = __importDefault(global[Symbol.for('ioc.use')]("Adonis/Core/Env"));
const config_1 = require("@adonisjs/core/build/config");
const Application_1 = __importDefault(global[Symbol.for('ioc.use')]("Adonis/Core/Application"));
exports.default = (0, config_1.driveConfig)({
disk: Env_1.default.get('DRIVE_DISK'),
disks: {
local: {
driver: 'local',
visibility: 'public',
root: Application_1.default.tmpPath('uploads'),
serveFiles: true,
basePath: '/uploads',
},
},
});
//# sourceMappingURL=drive.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"drive.js","sourceRoot":"","sources":["../../config/drive.ts"],"names":[],"mappings":";;;;;AAOA,gFAAsC;AACtC,wDAAyD;AACzD,gGAAsD;AAWtD,kBAAe,IAAA,oBAAW,EAAC;IAUzB,IAAI,EAAE,aAAG,CAAC,GAAG,CAAC,YAAY,CAAC;IAE3B,KAAK,EAAE;QAUL,KAAK,EAAE;YACL,MAAM,EAAE,OAAO;YACf,UAAU,EAAE,QAAQ;YAWpB,IAAI,EAAE,qBAAW,CAAC,OAAO,CAAC,SAAS,CAAC;YAYpC,UAAU,EAAE,IAAI;YAYhB,QAAQ,EAAE,UAAU;SACrB;KAmEF;CACF,CAAC,CAAA"}
+34
View File
@@ -0,0 +1,34 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const Env_1 = __importDefault(global[Symbol.for('ioc.use')]("Adonis/Core/Env"));
const config_1 = require("@adonisjs/core/build/config");
exports.default = (0, config_1.hashConfig)({
default: Env_1.default.get('HASH_DRIVER', 'scrypt'),
list: {
scrypt: {
driver: 'scrypt',
cost: 16384,
blockSize: 8,
parallelization: 1,
saltSize: 16,
keyLength: 64,
maxMemory: 32 * 1024 * 1024,
},
argon: {
driver: 'argon2',
variant: 'id',
iterations: 3,
memory: 4096,
parallelism: 1,
saltSize: 16,
},
bcrypt: {
driver: 'bcrypt',
rounds: 10,
},
},
});
//# sourceMappingURL=hash.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"hash.js","sourceRoot":"","sources":["../../config/hash.ts"],"names":[],"mappings":";;;;;AAOA,gFAAsC;AACtC,wDAAwD;AAWxD,kBAAe,IAAA,mBAAU,EAAC;IAUxB,OAAO,EAAE,aAAG,CAAC,GAAG,CAAC,aAAa,EAAE,QAAQ,CAAC;IAEzC,IAAI,EAAE;QAcJ,MAAM,EAAE;YACN,MAAM,EAAE,QAAQ;YAChB,IAAI,EAAE,KAAK;YACX,SAAS,EAAE,CAAC;YACZ,eAAe,EAAE,CAAC;YAClB,QAAQ,EAAE,EAAE;YACZ,SAAS,EAAE,EAAE;YACb,SAAS,EAAE,EAAE,GAAG,IAAI,GAAG,IAAI;SAC5B;QAeD,KAAK,EAAE;YACL,MAAM,EAAE,QAAQ;YAChB,OAAO,EAAE,IAAI;YACb,UAAU,EAAE,CAAC;YACb,MAAM,EAAE,IAAI;YACZ,WAAW,EAAE,CAAC;YACd,QAAQ,EAAE,EAAE;SACb;QAeD,MAAM,EAAE;YACN,MAAM,EAAE,QAAQ;YAChB,MAAM,EAAE,EAAE;SACX;KACF;CACF,CAAC,CAAA"}
+25
View File
@@ -0,0 +1,25 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const Env_1 = __importDefault(global[Symbol.for('ioc.use')]("Adonis/Core/Env"));
const Application_1 = __importDefault(global[Symbol.for('ioc.use')]("Adonis/Core/Application"));
const config_1 = require("@adonisjs/session/build/config");
exports.default = (0, config_1.sessionConfig)({
enabled: true,
driver: Env_1.default.get('SESSION_DRIVER'),
cookieName: 'adonis-session',
clearWithBrowser: false,
age: '2h',
cookie: {
path: '/',
httpOnly: true,
sameSite: false,
},
file: {
location: Application_1.default.tmpPath('sessions'),
},
redisConnection: 'local',
});
//# sourceMappingURL=session.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"session.js","sourceRoot":"","sources":["../../config/session.ts"],"names":[],"mappings":";;;;;AAOA,gFAAsC;AACtC,gGAAsD;AACtD,2DAA8D;AAE9D,kBAAe,IAAA,sBAAa,EAAC;IAU3B,OAAO,EAAE,IAAI;IAiBb,MAAM,EAAE,aAAG,CAAC,GAAG,CAAC,gBAAgB,CAAC;IAUjC,UAAU,EAAE,gBAAgB;IAW5B,gBAAgB,EAAE,KAAK;IAgBvB,GAAG,EAAE,IAAI;IAWT,MAAM,EAAE;QACN,IAAI,EAAE,GAAG;QACT,QAAQ,EAAE,IAAI;QACd,QAAQ,EAAE,KAAK;KAChB;IAWD,IAAI,EAAE;QACJ,QAAQ,EAAE,qBAAW,CAAC,OAAO,CAAC,UAAU,CAAC;KAC1C;IAWD,eAAe,EAAE,OAAO;CACzB,CAAC,CAAA"}
+32
View File
@@ -0,0 +1,32 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.contentTypeSniffing = exports.hsts = exports.xFrame = exports.dnsPrefetch = exports.csrf = exports.csp = void 0;
exports.csp = {
enabled: false,
directives: {},
reportOnly: false,
};
exports.csrf = {
enabled: true,
exceptRoutes: [],
enableXsrfCookie: true,
methods: ['POST', 'PUT', 'PATCH', 'DELETE'],
};
exports.dnsPrefetch = {
enabled: true,
allow: true,
};
exports.xFrame = {
enabled: true,
action: 'DENY',
};
exports.hsts = {
enabled: true,
maxAge: '180 days',
includeSubDomains: true,
preload: false,
};
exports.contentTypeSniffing = {
enabled: true,
};
//# sourceMappingURL=shield.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"shield.js","sourceRoot":"","sources":["../../config/shield.ts"],"names":[],"mappings":";;;AAkBa,QAAA,GAAG,GAAwB;IAStC,OAAO,EAAE,KAAK;IAkBd,UAAU,EAAE,EAAE;IAWd,UAAU,EAAE,KAAK;CAClB,CAAA;AAWY,QAAA,IAAI,GAAyB;IAMxC,OAAO,EAAE,IAAI;IAmBb,YAAY,EAAE,EAAE;IAgBhB,gBAAgB,EAAE,IAAI;IAUtB,OAAO,EAAE,CAAC,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,CAAC;CAC5C,CAAA;AAaY,QAAA,WAAW,GAAgC;IAMtD,OAAO,EAAE,IAAI;IAcb,KAAK,EAAE,IAAI;CACZ,CAAA;AAgBY,QAAA,MAAM,GAA2B;IAC5C,OAAO,EAAE,IAAI;IACb,MAAM,EAAE,MAAM;CACf,CAAA;AAaY,QAAA,IAAI,GAAyB;IACxC,OAAO,EAAE,IAAI;IAUb,MAAM,EAAE,UAAU;IAUlB,iBAAiB,EAAE,IAAI;IAWvB,OAAO,EAAE,KAAK;CACf,CAAA;AAcY,QAAA,mBAAmB,GAAwC;IACtE,OAAO,EAAE,IAAI;CACd,CAAA"}
+12
View File
@@ -0,0 +1,12 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const staticConfig = {
enabled: true,
dotFiles: 'ignore',
etag: true,
lastModified: true,
maxAge: 0,
immutable: false,
};
exports.default = staticConfig;
//# sourceMappingURL=static.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"static.js","sourceRoot":"","sources":["../../config/static.ts"],"names":[],"mappings":";;AASA,MAAM,YAAY,GAAiB;IAajC,OAAO,EAAE,IAAI;IAgBb,QAAQ,EAAE,QAAQ;IAWlB,IAAI,EAAE,IAAI;IAWV,YAAY,EAAE,IAAI;IAalB,MAAM,EAAE,CAAC;IAYT,SAAS,EAAE,KAAK;CACjB,CAAA;AAED,kBAAe,YAAY,CAAA"}
+3
View File
@@ -0,0 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=auth.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../contracts/auth.ts"],"names":[],"mappings":""}
+3
View File
@@ -0,0 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=drive.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"drive.js","sourceRoot":"","sources":["../../contracts/drive.ts"],"names":[],"mappings":""}
+1
View File
@@ -0,0 +1 @@
//# sourceMappingURL=env.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"env.js","sourceRoot":"","sources":["../../contracts/env.ts"],"names":[],"mappings":""}
+1
View File
@@ -0,0 +1 @@
//# sourceMappingURL=events.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"events.js","sourceRoot":"","sources":["../../contracts/events.ts"],"names":[],"mappings":""}
+3
View File
@@ -0,0 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=hash.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"hash.js","sourceRoot":"","sources":["../../contracts/hash.ts"],"names":[],"mappings":""}
+4
View File
@@ -0,0 +1,4 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
require("@japa/runner");
//# sourceMappingURL=tests.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"tests.js","sourceRoot":"","sources":["../../contracts/tests.ts"],"names":[],"mappings":";;AAOA,wBAAqB"}
+1
View File
@@ -0,0 +1 @@
//# sourceMappingURL=index.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../database/factories/index.ts"],"names":[],"mappings":""}
@@ -0,0 +1,28 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const Schema_1 = __importDefault(global[Symbol.for('ioc.use')]("Adonis/Lucid/Schema"));
class default_1 extends Schema_1.default {
constructor() {
super(...arguments);
this.tableName = 'users';
}
async up() {
this.schema.createTable(this.tableName, (table) => {
table.increments('id').primary();
table.string('pseudo', 50).notNullable;
table.string('email', 255).notNullable().unique();
table.string('password', 180).notNullable();
table.string('remember_me_token').nullable();
table.timestamp('created_at', { useTz: true }).notNullable();
table.timestamp('updated_at', { useTz: true }).notNullable();
});
}
async down() {
this.schema.dropTable(this.tableName);
}
}
exports.default = default_1;
//# sourceMappingURL=1698786769334_users.js.map
@@ -0,0 +1 @@
{"version":3,"file":"1698786769334_users.js","sourceRoot":"","sources":["../../../database/migrations/1698786769334_users.ts"],"names":[],"mappings":";;;;;AAAA,uFAAiD;AAEjD,eAAqB,SAAQ,gBAAU;IAAvC;;QACY,cAAS,GAAG,OAAO,CAAA;IAiB/B,CAAC;IAfQ,KAAK,CAAC,EAAE;QACb,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC,KAAK,EAAE,EAAE;YAChD,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,CAAA;YAChC,KAAK,CAAC,MAAM,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,WAAW,CAAA;YACtC,KAAK,CAAC,MAAM,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC,WAAW,EAAE,CAAC,MAAM,EAAE,CAAA;YACjD,KAAK,CAAC,MAAM,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC,WAAW,EAAE,CAAA;YAC3C,KAAK,CAAC,MAAM,CAAC,mBAAmB,CAAC,CAAC,QAAQ,EAAE,CAAA;YAC5C,KAAK,CAAC,SAAS,CAAC,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,WAAW,EAAE,CAAA;YAC5D,KAAK,CAAC,SAAS,CAAC,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,WAAW,EAAE,CAAA;QAC9D,CAAC,CAAC,CAAA;IACJ,CAAC;IAEM,KAAK,CAAC,IAAI;QACf,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;IACvC,CAAC;CACF;AAlBD,4BAkBC"}
+17
View File
@@ -0,0 +1,17 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const Env_1 = __importDefault(global[Symbol.for('ioc.use')]("Adonis/Core/Env"));
exports.default = Env_1.default.rules({
HOST: Env_1.default.schema.string({ format: 'host' }),
PORT: Env_1.default.schema.number(),
APP_KEY: Env_1.default.schema.string(),
APP_NAME: Env_1.default.schema.string(),
CACHE_VIEWS: Env_1.default.schema.boolean(),
SESSION_DRIVER: Env_1.default.schema.string(),
DRIVE_DISK: Env_1.default.schema.enum(['local']),
NODE_ENV: Env_1.default.schema.enum(['development', 'production', 'test']),
});
//# sourceMappingURL=env.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"env.js","sourceRoot":"","sources":["../env.ts"],"names":[],"mappings":";;;;;AAcA,gFAAsC;AAEtC,kBAAe,aAAG,CAAC,KAAK,CAAC;IACvB,IAAI,EAAE,aAAG,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;IAC3C,IAAI,EAAE,aAAG,CAAC,MAAM,CAAC,MAAM,EAAE;IACzB,OAAO,EAAE,aAAG,CAAC,MAAM,CAAC,MAAM,EAAE;IAC5B,QAAQ,EAAE,aAAG,CAAC,MAAM,CAAC,MAAM,EAAE;IAC7B,WAAW,EAAE,aAAG,CAAC,MAAM,CAAC,OAAO,EAAE;IACjC,cAAc,EAAE,aAAG,CAAC,MAAM,CAAC,MAAM,EAAE;IACnC,UAAU,EAAE,aAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,OAAO,CAAU,CAAC;IAC/C,QAAQ,EAAE,aAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,aAAa,EAAE,YAAY,EAAE,MAAM,CAAU,CAAC;CAC1E,CAAC,CAAA"}
-21
View File
@@ -1,21 +0,0 @@
The MIT License (MIT)
Copyright (c) 2014-2016, Jon Schlinkert
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-182
View File
@@ -1,182 +0,0 @@
# word-wrap [![NPM version](https://img.shields.io/npm/v/word-wrap.svg?style=flat)](https://www.npmjs.com/package/word-wrap) [![NPM monthly downloads](https://img.shields.io/npm/dm/word-wrap.svg?style=flat)](https://npmjs.org/package/word-wrap) [![NPM total downloads](https://img.shields.io/npm/dt/word-wrap.svg?style=flat)](https://npmjs.org/package/word-wrap) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/word-wrap.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/word-wrap)
> Wrap words to a specified length.
## Install
Install with [npm](https://www.npmjs.com/):
```sh
$ npm install --save word-wrap
```
## Usage
```js
var wrap = require('word-wrap');
wrap('Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.');
```
Results in:
```
Lorem ipsum dolor sit amet, consectetur adipiscing
elit, sed do eiusmod tempor incididunt ut labore
et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut
aliquip ex ea commodo consequat.
```
## Options
![image](https://cloud.githubusercontent.com/assets/383994/6543728/7a381c08-c4f6-11e4-8b7d-b6ba197569c9.png)
### options.width
Type: `Number`
Default: `50`
The width of the text before wrapping to a new line.
**Example:**
```js
wrap(str, {width: 60});
```
### options.indent
Type: `String`
Default: `` (none)
The string to use at the beginning of each line.
**Example:**
```js
wrap(str, {indent: ' '});
```
### options.newline
Type: `String`
Default: `\n`
The string to use at the end of each line.
**Example:**
```js
wrap(str, {newline: '\n\n'});
```
### options.escape
Type: `function`
Default: `function(str){return str;}`
An escape function to run on each line after splitting them.
**Example:**
```js
var xmlescape = require('xml-escape');
wrap(str, {
escape: function(string){
return xmlescape(string);
}
});
```
### options.trim
Type: `Boolean`
Default: `false`
Trim trailing whitespace from the returned string. This option is included since `.trim()` would also strip the leading indentation from the first line.
**Example:**
```js
wrap(str, {trim: true});
```
### options.cut
Type: `Boolean`
Default: `false`
Break a word between any two letters when the word is longer than the specified width.
**Example:**
```js
wrap(str, {cut: true});
```
## About
### Related projects
* [common-words](https://www.npmjs.com/package/common-words): Updated list (JSON) of the 100 most common words in the English language. Useful for… [more](https://github.com/jonschlinkert/common-words) | [homepage](https://github.com/jonschlinkert/common-words "Updated list (JSON) of the 100 most common words in the English language. Useful for excluding these words from arrays.")
* [shuffle-words](https://www.npmjs.com/package/shuffle-words): Shuffle the words in a string and optionally the letters in each word using the… [more](https://github.com/jonschlinkert/shuffle-words) | [homepage](https://github.com/jonschlinkert/shuffle-words "Shuffle the words in a string and optionally the letters in each word using the Fisher-Yates algorithm. Useful for creating test fixtures, benchmarking samples, etc.")
* [unique-words](https://www.npmjs.com/package/unique-words): Return the unique words in a string or array. | [homepage](https://github.com/jonschlinkert/unique-words "Return the unique words in a string or array.")
* [wordcount](https://www.npmjs.com/package/wordcount): Count the words in a string. Support for english, CJK and Cyrillic. | [homepage](https://github.com/jonschlinkert/wordcount "Count the words in a string. Support for english, CJK and Cyrillic.")
### Contributing
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).
### Contributors
| **Commits** | **Contributor** |
| --- | --- |
| 43 | [jonschlinkert](https://github.com/jonschlinkert) |
| 2 | [lordvlad](https://github.com/lordvlad) |
| 2 | [hildjj](https://github.com/hildjj) |
| 1 | [danilosampaio](https://github.com/danilosampaio) |
| 1 | [2fd](https://github.com/2fd) |
| 1 | [toddself](https://github.com/toddself) |
| 1 | [wolfgang42](https://github.com/wolfgang42) |
| 1 | [zachhale](https://github.com/zachhale) |
### Building docs
_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_
To generate the readme, run the following command:
```sh
$ npm install -g verbose/verb#dev verb-generate-readme && verb
```
### Running tests
Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:
```sh
$ npm install && npm test
```
### Author
**Jon Schlinkert**
* [github/jonschlinkert](https://github.com/jonschlinkert)
* [twitter/jonschlinkert](https://twitter.com/jonschlinkert)
### License
Copyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert).
Released under the [MIT License](LICENSE).
***
_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on June 02, 2017._
-50
View File
@@ -1,50 +0,0 @@
/**
* Wrap words to a specified length.
*/
export = wrap;
declare function wrap(str: string, options?: wrap.IOptions): string;
declare namespace wrap {
export interface IOptions {
/**
* The width of the text before wrapping to a new line.
* @default ´50´
*/
width?: number;
/**
* The string to use at the beginning of each line.
* @default ´´ (none)
*/
indent?: string;
/**
* The string to use at the end of each line.
* @default ´\n´
*/
newline?: string;
/**
* An escape function to run on each line after splitting them.
* @default (str: string) => string;
*/
escape?: (str: string) => string;
/**
* Trim trailing whitespace from the returned string.
* This option is included since .trim() would also strip
* the leading indentation from the first line.
* @default true
*/
trim?: boolean;
/**
* Break a word between any two letters when the word is longer
* than the specified width.
* @default false
*/
cut?: boolean;
}
}
-52
View File
@@ -1,52 +0,0 @@
/*!
* word-wrap <https://github.com/jonschlinkert/word-wrap>
*
* Copyright (c) 2014-2023, Jon Schlinkert.
* Released under the MIT License.
*/
function trimTabAndSpaces(str) {
const lines = str.split('\n');
const trimmedLines = lines.map((line) => line.trimEnd());
return trimmedLines.join('\n');
}
module.exports = function(str, options) {
options = options || {};
if (str == null) {
return str;
}
var width = options.width || 50;
var indent = (typeof options.indent === 'string')
? options.indent
: '';
var newline = options.newline || '\n' + indent;
var escape = typeof options.escape === 'function'
? options.escape
: identity;
var regexString = '.{1,' + width + '}';
if (options.cut !== true) {
regexString += '([\\s\u200B]+|$)|[^\\s\u200B]+?([\\s\u200B]+|$)';
}
var re = new RegExp(regexString, 'g');
var lines = str.match(re) || [];
var result = indent + lines.map(function(line) {
if (line.slice(-1) === '\n') {
line = line.slice(0, line.length - 1);
}
return escape(line);
}).join(newline);
if (options.trim === true) {
result = trimTabAndSpaces(result);
}
return result;
};
function identity(str) {
return str;
}
-81
View File
@@ -1,81 +0,0 @@
{
"name": "@aashutoshrathi/word-wrap",
"description": "Wrap words to a specified length.",
"version": "1.2.6",
"homepage": "https://github.com/aashutoshrathi/word-wrap",
"author": "Jon Schlinkert (https://github.com/jonschlinkert)",
"contributors": [
"Aashutosh Rathi <aashutoshrathi@gmail.com>",
"Danilo Sampaio <danilo.sampaio@gmail.com> (localhost:8080)",
"Fede Ramirez <i@2fd.me> (https://2fd.github.io)",
"Joe Hildebrand <joe-github@cursive.net> (https://twitter.com/hildjj)",
"Jon Schlinkert <jon.schlinkert@sellside.com> (http://twitter.com/jonschlinkert)",
"Todd Kennedy (https://tck.io)",
"Waldemar Reusch (https://github.com/lordvlad)",
"Wolfgang Faust (http://www.linestarve.com)",
"Zach Hale <zachhale@gmail.com> (http://zachhale.com)"
],
"repository": {
"type": "git",
"url": "git+https://github.com/aashutoshrathi/word-wrap.git"
},
"bugs": {
"url": "https://github.com/aashutoshrathi/word-wrap/issues"
},
"license": "MIT",
"files": [
"index.js",
"index.d.ts"
],
"main": "index.js",
"engines": {
"node": ">=0.10.0"
},
"scripts": {
"test": "mocha"
},
"devDependencies": {
"gulp-format-md": "^0.1.11",
"mocha": "^10.2.0"
},
"keywords": [
"break",
"carriage",
"line",
"new-line",
"newline",
"return",
"soft",
"text",
"word",
"word-wrap",
"words",
"wrap"
],
"typings": "index.d.ts",
"verb": {
"toc": false,
"layout": "default",
"tasks": [
"readme"
],
"plugins": [
"gulp-format-md"
],
"lint": {
"reflinks": true
},
"related": {
"list": [
"common-words",
"shuffle-words",
"unique-words",
"wordcount"
]
},
"reflinks": [
"verb",
"verb-generate-readme"
]
}
}
-9
View File
@@ -1,9 +0,0 @@
# The MIT License
Copyright 2022 Harminder Virk, contributors
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-56
View File
@@ -1,56 +0,0 @@
<div align="center">
<img src="https://res.cloudinary.com/adonisjs/image/upload/q_100/v1558612869/adonis-readme_zscycu.jpg" width="600px">
</div>
<br />
<div align="center">
<h3>Command line framework of AdonisJS</h3>
<p> Ace is command line framework embedded into AdonisJS for creating CLI commands. AdonisJS is the <strong>only Node.js framework</strong> that allows creating CLI commands as part of the application codebase. </p>
</div>
<br />
<div align="center">
[![gh-workflow-image]][gh-workflow-url] [![npm-image]][npm-url] ![][typescript-image] [![license-image]][license-url] [![synk-image]][synk-url]
</div>
<div align="center">
<h3>
<a href="https://adonisjs.com">
Website
</a>
<span> | </span>
<a href="https://docs.adonisjs.com/guides/ace-commandline">
Guides
</a>
<span> | </span>
<a href="CONTRIBUTING.md">
Contributing
</a>
<span> | </span>
<a href="flow-chart.png">
Flow chart
</a>
</h3>
</div>
<div align="center">
<sub>Built with ❤︎ by <a href="https://twitter.com/AmanVirk1">Harminder Virk</a>
</div>
[gh-workflow-image]: https://img.shields.io/github/workflow/status/adonisjs/ace/test?style=for-the-badge
[gh-workflow-url]: https://github.com/adonisjs/ace/actions/workflows/test.yml "Github action"
[npm-image]: https://img.shields.io/npm/v/@adonisjs/ace/latest.svg?style=for-the-badge&logo=npm
[npm-url]: https://npmjs.org/package/@adonisjs/ace/v/latest "npm"
[typescript-image]: https://img.shields.io/badge/Typescript-294E80.svg?style=for-the-badge&logo=typescript
[license-url]: LICENSE.md
[license-image]: https://img.shields.io/github/license/adonisjs/ace?style=for-the-badge
[synk-image]: https://img.shields.io/snyk/vulnerabilities/github/adonisjs/ace?label=Synk%20Vulnerabilities&style=for-the-badge
[synk-url]: https://snyk.io/test/github/adonisjs/ace?targetFile=package.json "synk"
-8
View File
@@ -1,8 +0,0 @@
export { Kernel } from './src/Kernel';
export { args } from './src/Decorators/args';
export { flags } from './src/Decorators/flags';
export { BaseCommand } from './src/BaseCommand';
export { handleError } from './src/utils/handleError';
export { ManifestLoader } from './src/Manifest/Loader';
export { ManifestGenerator } from './src/Manifest/Generator';
export { listDirectoryFiles } from './src/utils/listDirectoryFiles';
-27
View File
@@ -1,27 +0,0 @@
"use strict";
/*
* @adonisjs/ace
*
* (c) Harminder Virk <virk@adonisjs.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.listDirectoryFiles = exports.ManifestGenerator = exports.ManifestLoader = exports.handleError = exports.BaseCommand = exports.flags = exports.args = exports.Kernel = void 0;
var Kernel_1 = require("./src/Kernel");
Object.defineProperty(exports, "Kernel", { enumerable: true, get: function () { return Kernel_1.Kernel; } });
var args_1 = require("./src/Decorators/args");
Object.defineProperty(exports, "args", { enumerable: true, get: function () { return args_1.args; } });
var flags_1 = require("./src/Decorators/flags");
Object.defineProperty(exports, "flags", { enumerable: true, get: function () { return flags_1.flags; } });
var BaseCommand_1 = require("./src/BaseCommand");
Object.defineProperty(exports, "BaseCommand", { enumerable: true, get: function () { return BaseCommand_1.BaseCommand; } });
var handleError_1 = require("./src/utils/handleError");
Object.defineProperty(exports, "handleError", { enumerable: true, get: function () { return handleError_1.handleError; } });
var Loader_1 = require("./src/Manifest/Loader");
Object.defineProperty(exports, "ManifestLoader", { enumerable: true, get: function () { return Loader_1.ManifestLoader; } });
var Generator_1 = require("./src/Manifest/Generator");
Object.defineProperty(exports, "ManifestGenerator", { enumerable: true, get: function () { return Generator_1.ManifestGenerator; } });
var listDirectoryFiles_1 = require("./src/utils/listDirectoryFiles");
Object.defineProperty(exports, "listDirectoryFiles", { enumerable: true, get: function () { return listDirectoryFiles_1.listDirectoryFiles; } });
-148
View File
@@ -1,148 +0,0 @@
import { ParsedOptions } from 'getopts';
import { Prompt, FakePrompt } from '@poppinss/prompts';
import { instantiate } from '@poppinss/cliui/build/api';
import { ApplicationContract } from '@ioc:Adonis/Core/Application';
import { CommandArg, CommandFlag, KernelContract, CommandSettings, CommandContract, GeneratorContract } from '../Contracts';
/**
* Abstract base class other classes must extend
*/
export declare abstract class BaseCommand implements CommandContract {
application: ApplicationContract;
kernel: KernelContract;
/**
* Reference to the exit handler
*/
protected exitHandler?: () => void | Promise<void>;
/**
* Accepting AdonisJs application instance and kernel instance
*/
constructor(application: ApplicationContract, kernel: KernelContract);
/**
* Is the current command the main command executed from the
* CLI
*/
get isMain(): boolean;
/**
* Terminal is interactive
*/
get isInteractive(): boolean;
/**
* Command arguments
*/
static args: CommandArg[];
/**
* Command aliases
*/
static aliases: string[];
/**
* Command flags
*/
static flags: CommandFlag[];
/**
* Command name. The command will be registered using this name only. Make
* sure their aren't any spaces inside the command name.
*/
static commandName: string;
/**
* The description of the command displayed on the help screen.
* A good command will always have some description.
*/
static description: string;
/**
* Any settings a command wants to have. Helpful for third party
* tools to read the settings in lifecycle hooks and make
* certain decisions
*/
static settings: CommandSettings;
/**
* Whether or not the command has been booted
*/
static booted: boolean;
/**
* Boots the command by defining required static properties
*/
static boot(): void;
/**
* Define an argument directly on the command without using the decorator
*/
static $addArgument(options: Partial<CommandArg>): void;
/**
* Define a flag directly on the command without using the decorator
*/
static $addFlag(options: Partial<CommandFlag>): void;
/**
* Reference to cli ui
*/
ui: {
table: () => import("@poppinss/cliui/build/src/Table").Table;
tasks: {
(): import("@poppinss/cliui/build/src/Task/Manager").TaskManager;
verbose(): import("@poppinss/cliui/build/src/Task/Manager").TaskManager;
};
icons: {
tick: string;
cross: string;
bullet: string;
nodejs: string;
pointer: string;
info: string;
warning: string;
squareSmallFilled: string;
};
logger: import("@poppinss/cliui/build/src/Logger").Logger;
sticker: () => import("@poppinss/cliui/build/src/Instructions").Instructions;
instructions: () => import("@poppinss/cliui/build/src/Instructions").Instructions;
isInteractive: boolean;
supportsColors: boolean;
consoleRenderer: import("@poppinss/cliui/build/src/Renderer/Console").ConsoleRenderer;
testingRenderer: import("@poppinss/cliui/build/src/Renderer/Memory").MemoryRenderer;
};
/**
* Parsed options on the command. They only exist when the command
* is executed via kernel.
*/
parsed?: ParsedOptions;
/**
* The prompt for the command
*/
prompt: Prompt | FakePrompt;
/**
* Returns the instance of logger to log messages
*/
logger: import("@poppinss/cliui/build/src/Logger").Logger;
/**
* Reference to the colors
*/
colors: ReturnType<typeof instantiate>['logger']['colors'];
/**
* Generator instance to generate entity files
*/
generator: GeneratorContract;
/**
* Error raised by the command
*/
error?: any;
/**
* Command exit code
*/
exitCode?: number;
run?(...args: any[]): Promise<any>;
prepare?(...args: any[]): Promise<any>;
completed?(...args: any[]): Promise<any>;
/**
* Execute the command
*/
exec(): Promise<any>;
/**
* Register an onExit handler
*/
onExit(handler: () => void | Promise<void>): this;
/**
* Trigger exit
*/
exit(): Promise<void>;
/**
* Must be defined by the parent class
*/
handle?(...args: any[]): Promise<any>;
}
-195
View File
@@ -1,195 +0,0 @@
"use strict";
/*
* @adonisjs/ace
*
* (c) Harminder Virk <virk@adonisjs.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.BaseCommand = void 0;
const prompts_1 = require("@poppinss/prompts");
const helpers_1 = require("@poppinss/utils/build/helpers");
const api_1 = require("@poppinss/cliui/build/api");
const utils_1 = require("@poppinss/utils");
const Generator_1 = require("../Generator");
/**
* Abstract base class other classes must extend
*/
class BaseCommand {
/**
* Accepting AdonisJs application instance and kernel instance
*/
constructor(application, kernel) {
this.application = application;
this.kernel = kernel;
/**
* Reference to cli ui
*/
this.ui = (0, api_1.instantiate)(this.kernel.isMockingConsoleOutput);
/**
* The prompt for the command
*/
this.prompt = this.kernel.isMockingConsoleOutput
? new prompts_1.FakePrompt()
: new prompts_1.Prompt();
/**
* Returns the instance of logger to log messages
*/
this.logger = this.ui.logger;
/**
* Reference to the colors
*/
this.colors = this.logger.colors;
/**
* Generator instance to generate entity files
*/
this.generator = new Generator_1.Generator(this);
}
/**
* Is the current command the main command executed from the
* CLI
*/
get isMain() {
return this.kernel.isMain(this);
}
/**
* Terminal is interactive
*/
get isInteractive() {
return this.kernel.isInteractive;
}
/**
* Boots the command by defining required static properties
*/
static boot() {
if (this.booted) {
return;
}
this.booted = true;
(0, utils_1.defineStaticProperty)(this, BaseCommand, {
propertyName: 'args',
defaultValue: [],
strategy: 'inherit',
});
(0, utils_1.defineStaticProperty)(this, BaseCommand, {
propertyName: 'aliases',
defaultValue: [],
strategy: 'inherit',
});
(0, utils_1.defineStaticProperty)(this, BaseCommand, {
propertyName: 'flags',
defaultValue: [],
strategy: 'inherit',
});
(0, utils_1.defineStaticProperty)(this, BaseCommand, {
propertyName: 'settings',
defaultValue: {},
strategy: 'inherit',
});
(0, utils_1.defineStaticProperty)(this, BaseCommand, {
propertyName: 'commandName',
defaultValue: '',
strategy: 'define',
});
(0, utils_1.defineStaticProperty)(this, BaseCommand, {
propertyName: 'description',
defaultValue: '',
strategy: 'define',
});
}
/**
* Define an argument directly on the command without using the decorator
*/
static $addArgument(options) {
if (!options.propertyName) {
throw new utils_1.Exception('"propertyName" is required to register a command argument', 500, 'E_MISSING_ARGUMENT_NAME');
}
const arg = Object.assign({
type: options.type || 'string',
propertyName: options.propertyName,
name: options.name || options.propertyName,
required: options.required === false ? false : true,
}, options);
this.args.push(arg);
}
/**
* Define a flag directly on the command without using the decorator
*/
static $addFlag(options) {
if (!options.propertyName) {
throw new utils_1.Exception('"propertyName" is required to register command flag', 500, 'E_MISSING_FLAG_NAME');
}
const flag = Object.assign({
name: options.name || helpers_1.string.snakeCase(options.propertyName).replace(/_/g, '-'),
propertyName: options.propertyName,
type: options.type || 'boolean',
}, options);
this.flags.push(flag);
}
/**
* Execute the command
*/
async exec() {
const hasRun = typeof this.run === 'function';
const hasHandle = typeof this.handle === 'function';
let commandResult;
/**
* Print depreciation warning
*/
if (hasHandle) {
process.emitWarning('DeprecationWarning', `${this.constructor.name}.handle() is deprecated. Define run() method instead`);
}
/**
* Run command and catch any raised exceptions
*/
try {
/**
* Run prepare method when exists on the command instance
*/
if (typeof this.prepare === 'function') {
await this.application.container.callAsync(this, 'prepare', []);
}
/**
* Execute the command handle or run method
*/
commandResult = await this.application.container.callAsync(this, hasRun ? 'run' : 'handle', []);
}
catch (error) {
this.error = error;
}
let errorHandled = false;
/**
* Run completed method when exists
*/
if (typeof this.completed === 'function') {
errorHandled = await this.application.container.callAsync(this, 'completed', []);
}
/**
* Throw error when error exists and the completed method didn't
* handled it
*/
if (this.error && !errorHandled) {
throw this.error;
}
return commandResult;
}
/**
* Register an onExit handler
*/
onExit(handler) {
this.exitHandler = handler;
return this;
}
/**
* Trigger exit
*/
async exit() {
if (typeof this.exitHandler === 'function') {
await this.exitHandler();
}
await this.kernel.exit(this);
}
}
exports.BaseCommand = BaseCommand;
-381
View File
@@ -1,381 +0,0 @@
import * as ui from '@poppinss/cliui';
import { ParsedOptions } from 'getopts';
import { PromptContract } from '@poppinss/prompts';
import { ApplicationContract, AppEnvironments } from '@ioc:Adonis/Core/Application';
/**
* Settings excepted by the command
*/
export declare type CommandSettings = {
loadApp?: boolean;
stayAlive?: boolean;
environment?: AppEnvironments;
} & {
[key: string]: any;
};
/**
* The types of flags can be defined on a command.
*/
export declare type FlagTypes = 'string' | 'number' | 'boolean' | 'array' | 'numArray';
/**
* The types of arguments can be defined on a command.
*/
export declare type ArgTypes = 'string' | 'spread';
/**
* The shape of command argument
*/
export declare type CommandArg = {
propertyName: string;
name: string;
type: ArgTypes;
required: boolean;
description?: string;
};
/**
* The shape of a command flag
*/
export declare type CommandFlag = {
propertyName: string;
name: string;
type: FlagTypes;
description?: string;
alias?: string;
};
/**
* The handler that handles the global
* flags
*/
export declare type GlobalFlagHandler = (value: any, parsed: ParsedOptions, command?: CommandConstructorContract) => any;
/**
* Shape of grouped commands. Required when displaying
* help
*/
export declare type CommandsGroup = {
group: string;
commands: SerializedCommand[];
}[];
/**
* The shared properties that exists on the command implementation
* as well as it's serialized version
*/
export declare type SerializedCommand = {
args: CommandArg[];
aliases: string[];
settings: CommandSettings;
flags: CommandFlag[];
commandName: string;
description: string;
};
/**
* Command constructor shape with it's static properties
*/
export interface CommandConstructorContract extends SerializedCommand {
new (application: ApplicationContract, kernel: KernelContract, ...args: any[]): CommandContract;
/**
* A boolean to know if the command has been booted or not. We initialize some
* static properties to the class during the boot process.
*/
booted: boolean;
/**
* Boot the command. You won't have to run this method by yourself. Ace will internally
* boot the commands by itself.
*/
boot(): void;
/**
* Add an argument directly on the command without using the decorator
*/
$addArgument(options: Partial<CommandArg>): void;
/**
* Add a flag directly on the command without using the decorator
*/
$addFlag(options: Partial<CommandFlag>): void;
}
/**
* The shape of command class
*/
export interface CommandContract {
parsed?: ParsedOptions;
error?: any;
exitCode?: number;
logger: typeof ui.logger;
prompt: PromptContract;
colors: typeof ui.logger.colors;
ui: typeof ui;
generator: GeneratorContract;
kernel: KernelContract;
/**
* The flag is set to true, when the command is executed as the main command
* from the terminal.
*
* However, set to false when command is executed programmatically.
*/
readonly isMain: boolean;
/**
* The flag is set to true, when the commandline is in interactive mode.
* Can be disabled manually via the kernel
*/
readonly isInteractive: boolean;
onExit(callback: () => Promise<void> | void): this;
exit(): Promise<void>;
exec(): Promise<any>;
handle?(...args: any[]): Promise<any>;
run?(...args: any[]): Promise<any>;
prepare?(...args: any[]): Promise<any>;
completed?(...args: any[]): Promise<any>;
}
/**
* Shape of the serialized command inside the manifest JSON file.
*/
export declare type ManifestCommand = SerializedCommand & {
commandPath: string;
};
/**
* Shape of defined aliases
*/
export declare type Aliases = {
[key: string]: string;
};
/**
* Shape of the manifest JSON file
*/
export declare type ManifestNode = {
commands: {
[command: string]: ManifestCommand;
};
aliases: Aliases;
};
/**
* Manifest loader interface
*/
export interface ManifestLoaderContract {
booted: boolean;
boot(): Promise<void>;
/**
* Returns the base path for a given command. Helps in loading
* the command relative from that path
*/
getCommandBasePath(commandName: string): string | undefined;
/**
* Returns manifest command node. One must load the command
* in order to use it
*/
getCommand(commandName: string): {
basePath: string;
command: ManifestCommand;
} | undefined;
/**
* Find if a command exists or not
*/
hasCommand(commandName: string): boolean;
/**
* Load command from the disk. Make sure to use [[hasCommand]] before
* calling this method
*/
loadCommand(commandName: string): Promise<CommandConstructorContract>;
/**
* Returns an array of manifest commands by concatenating the
* commands and aliases from all the manifest files
*/
getCommands(): {
commands: ManifestCommand[];
aliases: Aliases;
};
}
/**
* Callbacks for different style of hooks
*/
export declare type FindHookCallback = (command: SerializedCommand | null) => Promise<any> | any;
export declare type RunHookCallback = (command: CommandContract) => Promise<any> | any;
/**
* Shape of ace kernel
*/
export interface KernelContract {
/**
* The exit code to be used for exiting the process. One should use
* this to exit the process
*/
exitCode?: number;
/**
* Reference to the process error. It can come from the command, flags
* or any other intermediate code.
*/
error?: Error;
/**
* Reference to the default command. Feel free to overwrite it
*/
defaultCommand: CommandConstructorContract;
/**
* A map of locally registered commands
*/
commands: {
[name: string]: CommandConstructorContract;
};
/**
* Registered command aliases
*/
aliases: Aliases;
/**
* A map of global flags
*/
flags: {
[name: string]: CommandFlag & {
handler: GlobalFlagHandler;
};
};
/**
* Register before hooks
*/
before(action: 'run', callback: RunHookCallback): this;
before(action: 'find', callback: FindHookCallback): this;
before(action: 'run' | 'find', callback: RunHookCallback | FindHookCallback): this;
/**
* Register after hooks
*/
after(action: 'run', callback: RunHookCallback): this;
after(action: 'find', callback: FindHookCallback): this;
after(action: 'run' | 'find', callback: RunHookCallback | FindHookCallback): this;
/**
* Register a command directly via class
*/
register(commands: CommandConstructorContract[]): this;
/**
* Register a global flag
*/
flag(name: string, handler: GlobalFlagHandler, options: Partial<Exclude<CommandFlag, 'name' | 'propertyName'>>): this;
/**
* Register the manifest loader
*/
useManifest(manifestLoacder: ManifestLoaderContract): this;
/**
* Register an on exit callback listener. It should always
* exit the process
*/
onExit(callback: (kernel: this) => void | Promise<void>): this;
/**
* Preload the manifest file
*/
preloadManifest(): void;
/**
* Get command suggestions
*/
getSuggestions(name: string, distance?: number): string[];
/**
* Find a command using the command line `argv`
*/
find(argv: string[]): Promise<CommandConstructorContract | null>;
/**
* Run the default command
*/
runDefaultCommand(): Promise<any>;
/**
* Handle the command line argv to execute commands
*/
handle(args: string[]): Promise<any>;
/**
* Execute a command by its name and args
*/
exec(commandName: string, args: string[]): Promise<CommandContract>;
/**
* Print help for all commands or a given command
*/
printHelp(command?: CommandConstructorContract, commandsToAppend?: ManifestCommand[], aliasesToAppend?: Record<string, string>): void;
/**
* Find if a command is the main command. Main commands are executed
* directly from the terminal
*/
isMain(command: CommandContract): boolean;
/**
* Find if CLI process is interactive.
*/
isInteractive: boolean;
/**
* Toggle isInteractive state
*/
interactive(state: boolean): this;
/**
* Find if console output is mocked
*/
isMockingConsoleOutput: boolean;
/**
* Enforce mocking the console output. Command logs, tables, prompts
* will be mocked
*/
mockConsoleOutput(): this;
/**
* Trigger exit flow
*/
exit(command: CommandContract, error?: any): Promise<void>;
}
/**
* Template generator options
*/
export declare type GeneratorFileOptions = {
pattern?: 'pascalcase' | 'camelcase' | 'snakecase' | 'dashcase';
form?: 'singular' | 'plural';
formIgnoreList?: string[];
suffix?: string;
prefix?: string;
extname?: string;
};
/**
* Shape of the individual generator file
*/
export interface GeneratorFileContract {
state: 'persisted' | 'removed' | 'pending';
/**
* Define path to the stub template. You can also define inline text instead
* of relying on a template file, but do make sure to set `raw=true` inside
* the options when using inline text.
*/
stub(fileOrContents: string, options?: {
raw: boolean;
}): this;
/**
* Instruct to use mustache templating syntax, instead of template literals
*/
useMustache(): this;
/**
* The relative path to the destination directory.
*/
destinationDir(directory: string): this;
/**
* Define a custom application root. Otherwise `process.cwd()` is used.
*/
appRoot(directory: string): this;
/**
* Apply data to the stub
*/
apply(contents: any): this;
/**
* Get file properties as a JSON object
*/
toJSON(): {
filename: string;
filepath: string;
extension: string;
contents: string;
relativepath: string;
state: 'persisted' | 'removed' | 'pending';
};
}
/**
* Shape of the files generator
*/
export interface GeneratorContract {
/**
* Add a new file to the files generator. You can add multiple files
* together and they will be created when `run` is invoked.
*/
addFile(name: string, options?: GeneratorFileOptions): GeneratorFileContract;
/**
* Run the generator and create all files registered using `addFiles`
*/
run(): Promise<GeneratorFileContract[]>;
/**
* Clear the registered files from the generator
*/
clear(): void;
}
/**
* Filter function for filtering files during the `readdir` scan
*/
export declare type CommandsListFilterFn = ((name: string) => boolean) | string[];
-10
View File
@@ -1,10 +0,0 @@
"use strict";
/*
* @adonisjs/ace
*
* (c) Harminder Virk <virk@adonisjs.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
Object.defineProperty(exports, "__esModule", { value: true });
-12
View File
@@ -1,12 +0,0 @@
import { CommandArg } from '../Contracts';
export declare const args: {
/**
* Define argument that accepts string value
*/
string(options?: Partial<Omit<CommandArg, "type" | "propertyName">> | undefined): <TKey extends string, TTarget extends { [K in TKey]?: string | undefined; }>(target: TTarget, propertyName: TKey) => void;
/**
* Define argument that accepts multiple values. Must be
* the last argument.
*/
spread(options?: Partial<Omit<CommandArg, "type" | "propertyName">> | undefined): <TKey_1 extends string, TTarget_1 extends { [K_1 in TKey_1]?: string[] | undefined; }>(target: TTarget_1, propertyName: TKey_1) => void;
};
-37
View File
@@ -1,37 +0,0 @@
"use strict";
/*
* @adonisjs/ace
*
* (c) Harminder Virk <virk@adonisjs.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.args = void 0;
/**
* Adds arg to the list of command arguments with pre-defined
* type.
*/
function addArg(type, options) {
return function arg(target, propertyName) {
const Command = target.constructor;
Command.boot();
Command.$addArgument(Object.assign({ type, propertyName }, options));
};
}
exports.args = {
/**
* Define argument that accepts string value
*/
string(options) {
return addArg('string', options || {});
},
/**
* Define argument that accepts multiple values. Must be
* the last argument.
*/
spread(options) {
return addArg('spread', options || {});
},
};
-23
View File
@@ -1,23 +0,0 @@
import { CommandFlag } from '../Contracts';
export declare const flags: {
/**
* Create a flag that excepts string values
*/
string<T extends unknown>(options?: Partial<Omit<CommandFlag, "type" | "propertyName">> | undefined): <TKey extends string, TTarget extends { [K in TKey]: T; }>(target: TTarget, propertyName: TKey) => void;
/**
* Create a flag that excepts numeric values
*/
number<T_1 extends unknown>(options?: Partial<Omit<CommandFlag, "type" | "propertyName">> | undefined): <TKey_1 extends string, TTarget_1 extends { [K_1 in TKey_1]: T_1; }>(target: TTarget_1, propertyName: TKey_1) => void;
/**
* Create a flag that excepts boolean values
*/
boolean<T_2 extends unknown>(options?: Partial<Omit<CommandFlag, "type" | "propertyName">> | undefined): <TKey_2 extends string, TTarget_2 extends { [K_2 in TKey_2]: T_2; }>(target: TTarget_2, propertyName: TKey_2) => void;
/**
* Create a flag that excepts array of string values
*/
array<T_3 extends unknown>(options?: Partial<Omit<CommandFlag, "type" | "propertyName">> | undefined): <TKey_3 extends string, TTarget_3 extends { [K_3 in TKey_3]: T_3; }>(target: TTarget_3, propertyName: TKey_3) => void;
/**
* Create a flag that excepts array of numeric values
*/
numArray<T_4 extends unknown>(options?: Partial<Omit<CommandFlag, "type" | "propertyName">> | undefined): <TKey_4 extends string, TTarget_4 extends { [K_4 in TKey_4]: T_4; }>(target: TTarget_4, propertyName: TKey_4) => void;
};
-54
View File
@@ -1,54 +0,0 @@
"use strict";
/*
* @adonisjs/ace
*
* (c) Harminder Virk <virk@adonisjs.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.flags = void 0;
/**
* Pushes flag to the list of command flags with predefined
* types.
*/
function addFlag(type, options) {
return function flag(target, propertyName) {
const Command = target.constructor;
Command.boot();
Command.$addFlag(Object.assign({ type, propertyName }, options));
};
}
exports.flags = {
/**
* Create a flag that excepts string values
*/
string(options) {
return addFlag('string', options || {});
},
/**
* Create a flag that excepts numeric values
*/
number(options) {
return addFlag('number', options || {});
},
/**
* Create a flag that excepts boolean values
*/
boolean(options) {
return addFlag('boolean', options || {});
},
/**
* Create a flag that excepts array of string values
*/
array(options) {
return addFlag('array', options || {});
},
/**
* Create a flag that excepts array of numeric values
*/
numArray(options) {
return addFlag('numArray', options || {});
},
};
-58
View File
@@ -1,58 +0,0 @@
import { Exception } from '@poppinss/utils';
import { CommandConstructorContract } from '../Contracts';
/**
* Raised when a required argument is missing
*/
export declare class MissingArgumentException extends Exception {
command: CommandConstructorContract;
argumentName: string;
/**
* A required argument is missing
*/
static invoke(name: string, command: CommandConstructorContract): MissingArgumentException;
/**
* Handle itself
*/
handle(error: MissingArgumentException): void;
}
/**
* Raised when an the type of a flag is not as one of the excepted type
*/
export declare class InvalidFlagException extends Exception {
command?: CommandConstructorContract;
flagName: string;
expectedType: string;
/**
* Flag type validation failed.
*/
static invoke(prop: string, expected: string, command?: CommandConstructorContract): InvalidFlagException;
/**
* Handle itself
*/
handle(error: InvalidFlagException): void;
}
/**
* Raised when command is not registered with kernel
*/
export declare class InvalidCommandException extends Exception {
commandName: string;
suggestions: string[];
static invoke(commandName: string, suggestions: string[]): InvalidCommandException;
/**
* Handle itself
*/
handle(error: InvalidCommandException): void;
}
/**
* Raised when an unknown flag is defined
*/
export declare class UnknownFlagException extends Exception {
/**
* Unknown flag
*/
static invoke(prop: string): UnknownFlagException;
/**
* Handle itself
*/
handle(error: UnknownFlagException): void;
}
-118
View File
@@ -1,118 +0,0 @@
"use strict";
/*
* @adonisjs/ace
*
* (c) Harminder Virk <virk@adonisjs.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.UnknownFlagException = exports.InvalidCommandException = exports.InvalidFlagException = exports.MissingArgumentException = void 0;
const cliui_1 = require("@poppinss/cliui");
const utils_1 = require("@poppinss/utils");
/**
* Raised when a required argument is missing
*/
class MissingArgumentException extends utils_1.Exception {
/**
* A required argument is missing
*/
static invoke(name, command) {
const exception = new this(`Missing required argument "${name}"`, 500, 'E_MISSING_ARGUMENT');
exception.argumentName = name;
exception.command = command;
return exception;
}
/**
* Handle itself
*/
handle(error) {
cliui_1.logger.error(cliui_1.logger.colors.red(`Missing required argument "${error.argumentName}"`));
}
}
exports.MissingArgumentException = MissingArgumentException;
/**
* Raised when an the type of a flag is not as one of the excepted type
*/
class InvalidFlagException extends utils_1.Exception {
/**
* Flag type validation failed.
*/
static invoke(prop, expected, command) {
let article = 'a';
if (expected === 'number') {
expected = 'numeric';
}
if (expected === 'array') {
article = 'an';
expected = 'array of strings';
}
if (expected === 'numArray') {
article = 'an';
expected = 'array of numbers';
}
const exception = new this(`"${prop}" flag expects ${article} "${expected}" value`, 500, 'E_INVALID_FLAG');
exception.flagName = prop;
exception.command = command;
exception.expectedType = expected;
return exception;
}
/**
* Handle itself
*/
handle(error) {
cliui_1.logger.error(cliui_1.logger.colors.red(`Expected "--${error.flagName}" to be a valid "${error.expectedType}"`));
}
}
exports.InvalidFlagException = InvalidFlagException;
/**
* Raised when command is not registered with kernel
*/
class InvalidCommandException extends utils_1.Exception {
constructor() {
super(...arguments);
this.suggestions = [];
}
static invoke(commandName, suggestions) {
const exception = new this(`"${commandName}" is not a registered command`, 500, 'E_INVALID_COMMAND');
exception.commandName = commandName;
exception.suggestions = suggestions;
return exception;
}
/**
* Handle itself
*/
handle(error) {
cliui_1.logger.error(`"${error.commandName}" command not found`);
if (!error.suggestions.length) {
return;
}
cliui_1.logger.log('');
const suggestionLog = (0, cliui_1.sticker)().heading('Did you mean one of these?');
error.suggestions.forEach((commandName) => {
suggestionLog.add(cliui_1.logger.colors.yellow(commandName));
});
suggestionLog.render();
}
}
exports.InvalidCommandException = InvalidCommandException;
/**
* Raised when an unknown flag is defined
*/
class UnknownFlagException extends utils_1.Exception {
/**
* Unknown flag
*/
static invoke(prop) {
const exception = new this(`Unknown flag "${prop}"`, 500, 'E_INVALID_FLAG');
return exception;
}
/**
* Handle itself
*/
handle(error) {
cliui_1.logger.error(cliui_1.logger.colors.red(error.message));
}
}
exports.UnknownFlagException = UnknownFlagException;
-57
View File
@@ -1,57 +0,0 @@
import { GeneratorFileOptions, GeneratorFileContract } from '../Contracts';
/**
* Exposes the API to construct the output file content, path
* and template source.
*/
export declare class GeneratorFile implements GeneratorFileContract {
private name;
private options;
private stubContents;
private isStubRaw;
private templateData;
private customDestinationPath?;
private customAppRoot?;
private mustache;
state: 'persisted' | 'removed' | 'pending';
constructor(name: string, options?: GeneratorFileOptions);
/**
* Returns relative path for the file. Useful for
* printing log info
*/
private getFileRelativePath;
/**
* Set stub for the contents source. When `raw` is true, then string
* is considered as the raw content and not the file path.
*/
stub(fileOrContents: string, options?: {
raw: boolean;
}): this;
/**
* Optionally define destination directory from the project root.
*/
destinationDir(directory: string): this;
/**
* Define `appRoot`. This is just to shorten the logged
* file names. For example:
*/
appRoot(directory: string): this;
/**
* Instruct to use mustache
*/
useMustache(): this;
/**
* Variables for stub subsitution
*/
apply(contents: any): this;
/**
* Returns the file json
*/
toJSON(): {
filename: string;
filepath: string;
relativepath: string;
extension: string;
contents: any;
state: "persisted" | "removed" | "pending";
};
}
-129
View File
@@ -1,129 +0,0 @@
"use strict";
/*
* @adonisjs/ace
*
* (c) Harminder Virk <virk@adonisjs.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.GeneratorFile = void 0;
const path_1 = require("path");
const StringTransformer_1 = require("./StringTransformer");
const template_1 = require("../utils/template");
/**
* Exposes the API to construct the output file content, path
* and template source.
*/
class GeneratorFile {
constructor(name, options = {}) {
this.name = name;
this.options = options;
this.templateData = {};
this.mustache = false;
this.state = 'pending';
}
/**
* Returns relative path for the file. Useful for
* printing log info
*/
getFileRelativePath(filepath) {
if (this.customAppRoot) {
return filepath.replace(`${this.customAppRoot}${path_1.sep}`, '');
}
return filepath;
}
/**
* Set stub for the contents source. When `raw` is true, then string
* is considered as the raw content and not the file path.
*/
stub(fileOrContents, options) {
this.stubContents = fileOrContents;
this.isStubRaw = !!(options && options.raw);
return this;
}
/**
* Optionally define destination directory from the project root.
*/
destinationDir(directory) {
this.customDestinationPath = directory;
return this;
}
/**
* Define `appRoot`. This is just to shorten the logged
* file names. For example:
*/
appRoot(directory) {
this.customAppRoot = directory;
return this;
}
/**
* Instruct to use mustache
*/
useMustache() {
this.mustache = true;
return this;
}
/**
* Variables for stub subsitution
*/
apply(contents) {
this.templateData = contents;
return this;
}
/**
* Returns the file json
*/
toJSON() {
const extension = this.options.extname || '.ts';
const filename = new StringTransformer_1.StringTransformer((0, path_1.basename)(this.name))
.dropExtension()
.cleanSuffix(this.options.suffix)
.cleanPrefix(this.options.prefix)
.changeForm(this.options.form, this.options.formIgnoreList)
.addSuffix(this.options.suffix)
.addPrefix(this.options.prefix)
.changeCase(this.options.pattern)
.toValue();
const initialFilePath = this.name.replace((0, path_1.basename)(this.name), filename);
const appRoot = this.customAppRoot || process.cwd();
/**
* Computes the file absolute path, where the file will be created.
*
* 1. If `customDestinationPath` is not defined, we will merge the
* `appRoot` + `initialFilePath`.
*
* 2. If `customDestinationPath` is absolute, then we ignore the appRoot
* and merge `customDestinationPath` + `initialFilePath`
*
* 3. Otherwise we merge `appRoot` + `customDestinationPath` + `initialFilePath`.
*/
const filepath = this.customDestinationPath
? (0, path_1.isAbsolute)(this.customDestinationPath)
? (0, path_1.join)(this.customDestinationPath, initialFilePath)
: (0, path_1.join)(appRoot, this.customDestinationPath, initialFilePath)
: (0, path_1.join)(appRoot, initialFilePath);
/**
* Passing user values + the filename and extension
*/
const templateContents = Object.assign({ extension, filename }, this.templateData);
/**
* Contents of the template file
*/
const contents = this.stubContents
? this.isStubRaw
? (0, template_1.template)(this.stubContents, templateContents, undefined, this.mustache)
: (0, template_1.templateFromFile)(this.stubContents, templateContents, this.mustache)
: '';
return {
filename,
filepath: `${filepath}${extension}`,
relativepath: this.getFileRelativePath(`${filepath}${extension}`),
extension,
contents,
state: this.state,
};
}
}
exports.GeneratorFile = GeneratorFile;
@@ -1,40 +0,0 @@
/**
* Exposes the API to transform a string
*/
export declare class StringTransformer {
private input;
constructor(input: string);
/**
* Cleans suffix from the input.
*/
cleanSuffix(suffix?: string): this;
/**
* Cleans prefix from the input.
*/
cleanPrefix(prefix?: string): this;
/**
* Add suffix to the file name
*/
addSuffix(suffix?: string): this;
/**
* Add prefix to the file name
*/
addPrefix(prefix?: string): this;
/**
* Changes the name form by converting it to singular
* or plural case
*/
changeForm(form?: 'singular' | 'plural', ignoreList?: string[]): this;
/**
* Changes the input case
*/
changeCase(pattern?: 'pascalcase' | 'camelcase' | 'snakecase' | 'dashcase'): this;
/**
* Drops the extension from the input
*/
dropExtension(): this;
/**
* Returns the transformed value
*/
toValue(): string;
}
@@ -1,114 +0,0 @@
"use strict";
/*
* @adonisjs/ace
*
* (c) Harminder Virk <virk@adonisjs.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.StringTransformer = void 0;
const path_1 = require("path");
const helpers_1 = require("@poppinss/utils/build/helpers");
/**
* Exposes the API to transform a string
*/
class StringTransformer {
constructor(input) {
this.input = input;
}
/**
* Cleans suffix from the input.
*/
cleanSuffix(suffix) {
if (!suffix) {
return this;
}
this.input = this.input.replace(new RegExp(`[-_]?${suffix}$`, 'i'), '');
return this;
}
/**
* Cleans prefix from the input.
*/
cleanPrefix(prefix) {
if (!prefix) {
return this;
}
this.input = this.input.replace(new RegExp(`^${prefix}[-_]?`, 'i'), '');
return this;
}
/**
* Add suffix to the file name
*/
addSuffix(suffix) {
if (!suffix) {
return this;
}
this.input = `${this.input}_${suffix}`;
return this;
}
/**
* Add prefix to the file name
*/
addPrefix(prefix) {
if (!prefix) {
return this;
}
this.input = `${prefix}_${this.input}`;
return this;
}
/**
* Changes the name form by converting it to singular
* or plural case
*/
changeForm(form, ignoreList) {
if (!form) {
return this;
}
/**
* Do not change form when word is in ignore list
*/
if ((ignoreList || []).find((word) => word.toLowerCase() === this.input.toLowerCase())) {
return this;
}
this.input = form === 'singular' ? helpers_1.string.singularize(this.input) : helpers_1.string.pluralize(this.input);
return this;
}
/**
* Changes the input case
*/
changeCase(pattern) {
switch (pattern) {
case 'camelcase':
this.input = helpers_1.string.camelCase(this.input);
return this;
case 'pascalcase':
const camelCase = helpers_1.string.camelCase(this.input);
this.input = `${camelCase.charAt(0).toUpperCase()}${camelCase.slice(1)}`;
return this;
case 'snakecase':
this.input = helpers_1.string.snakeCase(this.input);
return this;
case 'dashcase':
this.input = helpers_1.string.dashCase(this.input);
return this;
default:
return this;
}
}
/**
* Drops the extension from the input
*/
dropExtension() {
this.input = this.input.replace(new RegExp(`${(0, path_1.extname)(this.input)}$`), '');
return this;
}
/**
* Returns the transformed value
*/
toValue() {
return this.input;
}
}
exports.StringTransformer = StringTransformer;
-25
View File
@@ -1,25 +0,0 @@
import { GeneratorFile } from './File';
import { GeneratorFileOptions, GeneratorContract, CommandContract } from '../Contracts';
/**
* Exposes the API to generate entity files, like project
* `Controllers`, `Models` and so on.
*/
export declare class Generator implements GeneratorContract {
private command;
private destinationDir?;
private files;
constructor(command: CommandContract, destinationDir?: string | undefined);
/**
* Add a new file to the files generator. You can add multiple files
* together and they will be created when `run` is invoked.
*/
addFile(name: string, options?: GeneratorFileOptions): GeneratorFile;
/**
* Run the generator and create all files registered using `addFiles`
*/
run(): Promise<GeneratorFile[]>;
/**
* Clear the registered files from the generator
*/
clear(): void;
}
-61
View File
@@ -1,61 +0,0 @@
"use strict";
/*
* @adonisjs/ace
*
* (c) Harminder Virk <virk@adonisjs.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.Generator = void 0;
const fs_extra_1 = require("fs-extra");
const File_1 = require("./File");
/**
* Exposes the API to generate entity files, like project
* `Controllers`, `Models` and so on.
*/
class Generator {
constructor(command, destinationDir) {
this.command = command;
this.destinationDir = destinationDir;
this.files = [];
}
/**
* Add a new file to the files generator. You can add multiple files
* together and they will be created when `run` is invoked.
*/
addFile(name, options) {
const file = new File_1.GeneratorFile(name, options);
if (this.destinationDir) {
file.destinationDir(this.destinationDir);
}
this.files.push(file);
return file;
}
/**
* Run the generator and create all files registered using `addFiles`
*/
async run() {
for (let file of this.files) {
const fileJSON = file.toJSON();
const exists = await (0, fs_extra_1.pathExists)(fileJSON.filepath);
if (exists) {
this.command.logger.action('create').skipped(fileJSON.relativepath, 'File already exists');
}
else {
await (0, fs_extra_1.outputFile)(fileJSON.filepath, fileJSON.contents);
file.state = 'persisted';
this.command.logger.action('create').succeeded(fileJSON.relativepath);
}
}
return this.files;
}
/**
* Clear the registered files from the generator
*/
clear() {
this.files = [];
}
}
exports.Generator = Generator;
-10
View File
@@ -1,10 +0,0 @@
import { BaseCommand } from '../BaseCommand';
import { CommandContract } from '../Contracts';
/**
* The help command for print the help output
*/
export declare class HelpCommand extends BaseCommand implements CommandContract {
static commandName: string;
static description: string;
run(): Promise<void>;
}
-23
View File
@@ -1,23 +0,0 @@
"use strict";
/*
* @adonisjs/ace
*
* (c) Harminder Virk <virk@adonisjs.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.HelpCommand = void 0;
const BaseCommand_1 = require("../BaseCommand");
/**
* The help command for print the help output
*/
class HelpCommand extends BaseCommand_1.BaseCommand {
async run() {
this.kernel.printHelp();
}
}
exports.HelpCommand = HelpCommand;
HelpCommand.commandName = 'help';
HelpCommand.description = 'See help for all the commands';
-14
View File
@@ -1,14 +0,0 @@
/**
* Exposes the API to register and execute async hooks
*/
export declare class Hooks {
private hooks;
/**
* Register hook for a given action and lifecycle
*/
add(lifecycle: 'before' | 'after', action: string, handler: (...args: any[]) => void | Promise<void>): this;
/**
* Execute hooks for a given action and lifecycle
*/
execute(lifecycle: 'before' | 'after', action: string, data: any): Promise<void>;
}
-48
View File
@@ -1,48 +0,0 @@
"use strict";
/*
* @adonisjs/ace
*
* (c) Harminder Virk <virk@adonisjs.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.Hooks = void 0;
/**
* Exposes the API to register and execute async hooks
*/
class Hooks {
constructor() {
this.hooks = {
before: new Map(),
after: new Map(),
};
}
/**
* Register hook for a given action and lifecycle
*/
add(lifecycle, action, handler) {
const handlers = this.hooks[lifecycle].get(action);
if (handlers) {
handlers.push(handler);
}
else {
this.hooks[lifecycle].set(action, [handler]);
}
return this;
}
/**
* Execute hooks for a given action and lifecycle
*/
async execute(lifecycle, action, data) {
const handlers = this.hooks[lifecycle].get(action);
if (!handlers) {
return;
}
for (let handler of handlers) {
await handler(data);
}
}
}
exports.Hooks = Hooks;
-180
View File
@@ -1,180 +0,0 @@
import { ApplicationContract } from '@ioc:Adonis/Core/Application';
import { ManifestLoader } from '../Manifest/Loader';
import { CommandFlag, KernelContract, CommandContract, ManifestCommand, RunHookCallback, FindHookCallback, GlobalFlagHandler, CommandConstructorContract } from '../Contracts';
/**
* Ace kernel class is used to register, find and invoke commands by
* parsing `process.argv.splice(2)` value.
*/
export declare class Kernel implements KernelContract {
application: ApplicationContract;
/**
* Reference to hooks class to execute lifecycle
* hooks
*/
private hooks;
/**
* Reference to the manifest loader. If defined, we will give preference
* to the manifest files.
*/
private manifestLoader;
/**
* The command that started the process
*/
private entryCommand?;
/**
* The state of the kernel
*/
private state;
/**
* Exit handler for gracefully exiting the process
*/
private exitHandler;
/**
* Find if CLI process is interactive. This flag can be
* toggled programmatically
*/
isInteractive: boolean;
/**
* Find if console output is mocked
*/
isMockingConsoleOutput: boolean;
/**
* The default command that will be invoked when no command is
* defined
*/
defaultCommand: CommandConstructorContract;
/**
* List of registered commands
*/
commands: {
[name: string]: CommandConstructorContract;
};
aliases: {
[alias: string]: string;
};
/**
* List of registered flags
*/
flags: {
[name: string]: CommandFlag & {
handler: GlobalFlagHandler;
};
};
/**
* The exit code for the process
*/
exitCode?: number;
/**
* The error collected as part of the running commands or executing
* flags
*/
error?: any;
constructor(application: ApplicationContract);
/**
* Executing global flag handlers. The global flag handlers are
* not async as of now, but later we can look into making them
* async.
*/
private executeGlobalFlagsHandlers;
/**
* Returns an array of all registered commands
*/
private getAllCommandsAndAliases;
/**
* Processes the args and sets values on the command instance
*/
private processCommandArgsAndFlags;
/**
* Execute the main command. For calling commands within commands,
* one must call "kernel.exec".
*/
private execMain;
/**
* Handles exiting the process
*/
private exitProcess;
/**
* Register a before hook
*/
before(action: 'run', callback: RunHookCallback): this;
before(action: 'find', callback: FindHookCallback): this;
/**
* Register an after hook
*/
after(action: 'run', callback: RunHookCallback): this;
after(action: 'find', callback: FindHookCallback): this;
/**
* Register an array of command constructors
*/
register(commands: CommandConstructorContract[]): this;
/**
* Register a global flag. It can be defined in combination with
* any command.
*/
flag(name: string, handler: GlobalFlagHandler, options: Partial<Exclude<CommandFlag, 'name' | 'propertyName'>>): this;
/**
* Use manifest instance to lazy load commands
*/
useManifest(manifestLoader: ManifestLoader): this;
/**
* Register an exit handler
*/
onExit(callback: (kernel: this) => void | Promise<void>): this;
/**
* Returns an array of command names suggestions for a given name.
*/
getSuggestions(name: string, distance?: number): string[];
/**
* Preload the manifest file. Re-running this method twice will
* result in a noop
*/
preloadManifest(): Promise<void>;
/**
* Finds the command from the command line argv array. If command for
* the given name doesn't exists, then it will return `null`.
*
* Does executes the before and after hooks regardless of whether the
* command has been found or not
*/
find(argv: string[]): Promise<CommandConstructorContract | null>;
/**
* Run the default command. The default command doesn't accept
* and args or flags.
*/
runDefaultCommand(): Promise<any>;
/**
* Find if a command is the main command. Main commands are executed
* directly from the terminal.
*/
isMain(command: CommandContract): boolean;
/**
* Enforce mocking the console output. Command logs, tables, prompts
* will be mocked
*/
mockConsoleOutput(): this;
/**
* Toggle interactive state
*/
interactive(state: boolean): this;
/**
* Execute a command as a sub-command. Do not call "handle" and
* always use this method to invoke command programatically
*/
exec(commandName: string, args: string[]): Promise<CommandContract>;
/**
* Makes instance of a given command by processing command line arguments
* and setting them on the command instance
*/
handle(argv: string[]): Promise<void>;
/**
* Print the help screen for a given command or all commands/flags
*/
printHelp(command?: CommandConstructorContract, commandsToAppend?: ManifestCommand[], aliasesToAppend?: Record<string, string>): void;
/**
* Trigger kernel to exit the process. The call to this method
* is ignored when command is not same the `entryCommand`.
*
* In other words, subcommands cannot trigger exit
*/
exit(command: CommandContract, error?: any): Promise<void>;
}
-609
View File
@@ -1,609 +0,0 @@
"use strict";
/*
* @adonisjs/ace
*
* (c) Harminder Virk <virk@adonisjs.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.Kernel = void 0;
const Hooks_1 = require("../Hooks");
const Parser_1 = require("../Parser");
const HelpCommand_1 = require("../HelpCommand");
const Exceptions_1 = require("../Exceptions");
const help_1 = require("../utils/help");
const validateCommand_1 = require("../utils/validateCommand");
const cliui_1 = require("@poppinss/cliui");
/**
* Ace kernel class is used to register, find and invoke commands by
* parsing `process.argv.splice(2)` value.
*/
class Kernel {
constructor(application) {
this.application = application;
/**
* Reference to hooks class to execute lifecycle
* hooks
*/
this.hooks = new Hooks_1.Hooks();
/**
* The state of the kernel
*/
this.state = 'idle';
/**
* Exit handler for gracefully exiting the process
*/
this.exitHandler = (kernel) => {
if (kernel.error && typeof kernel.error.handle === 'function') {
kernel.error.handle(kernel.error);
}
else if (kernel.error) {
cliui_1.logger.fatal(kernel.error);
}
process.exit(kernel.exitCode === undefined ? 0 : kernel.exitCode);
};
/**
* Find if CLI process is interactive. This flag can be
* toggled programmatically
*/
this.isInteractive = cliui_1.isInteractive;
/**
* Find if console output is mocked
*/
this.isMockingConsoleOutput = false;
/**
* The default command that will be invoked when no command is
* defined
*/
this.defaultCommand = HelpCommand_1.HelpCommand;
/**
* List of registered commands
*/
this.commands = {};
this.aliases = this.application.rcFile.commandsAliases;
/**
* List of registered flags
*/
this.flags = {};
}
/**
* Executing global flag handlers. The global flag handlers are
* not async as of now, but later we can look into making them
* async.
*/
executeGlobalFlagsHandlers(argv, command) {
const globalFlags = Object.keys(this.flags);
const parsedOptions = new Parser_1.Parser(this.flags).parse(argv, command);
globalFlags.forEach((name) => {
const value = parsedOptions[name];
/**
* Flag was not specified
*/
if (value === undefined) {
return;
}
/**
* Calling the handler
*/
this.flags[name].handler(parsedOptions[name], parsedOptions, command);
});
}
/**
* Returns an array of all registered commands
*/
getAllCommandsAndAliases() {
let commands = Object.keys(this.commands).map((name) => this.commands[name]);
let aliases = {};
/**
* Concat manifest commands when they exists
*/
if (this.manifestLoader && this.manifestLoader.booted) {
const { commands: manifestCommands, aliases: manifestAliases } = this.manifestLoader.getCommands();
commands = commands.concat(manifestCommands);
aliases = Object.assign(aliases, manifestAliases);
}
return {
commands,
aliases: Object.assign(aliases, this.aliases),
};
}
/**
* Processes the args and sets values on the command instance
*/
async processCommandArgsAndFlags(commandInstance, args) {
const parser = new Parser_1.Parser(this.flags);
const command = commandInstance.constructor;
/**
* Parse the command arguments. The `parse` method will raise exception if flag
* or arg is not
*/
const parsedOptions = parser.parse(args, command);
/**
* We validate the command arguments after the global flags have been
* executed. It is required, since flags may have nothing to do
* with the validaty of command itself
*/
command.args.forEach((arg, index) => {
parser.validateArg(arg, index, parsedOptions, command);
});
/**
* Creating a new command instance and setting
* parsed options on it.
*/
commandInstance.parsed = parsedOptions;
/**
* Setup command instance argument and flag
* properties.
*/
for (let i = 0; i < command.args.length; i++) {
const arg = command.args[i];
const defaultValue = commandInstance[arg.propertyName];
if (arg.type === 'spread') {
const value = parsedOptions._.slice(i);
/**
* Set the property value to arguments defined via the CLI
* If no arguments are supplied, then use the default value assigned to the class property
* If the default value is undefined, then assign an empty array
*/
commandInstance[arg.propertyName] = value.length
? value
: defaultValue !== undefined
? defaultValue
: [];
break;
}
else {
const value = parsedOptions._[i];
commandInstance[arg.propertyName] = value !== undefined ? value : defaultValue;
}
}
/**
* Set flag value on the command instance
*/
for (let flag of command.flags) {
const flagValue = parsedOptions[flag.name];
if (flagValue !== undefined) {
commandInstance[flag.propertyName] = flagValue;
}
}
}
/**
* Execute the main command. For calling commands within commands,
* one must call "kernel.exec".
*/
async execMain(commandName, args) {
const command = await this.find([commandName]);
/**
* Command not found. So execute global flags handlers and
* raise an exception
*/
if (!command) {
this.executeGlobalFlagsHandlers(args);
throw Exceptions_1.InvalidCommandException.invoke(commandName, this.getSuggestions(commandName));
}
/**
* Make an instance of the command
*/
const commandInstance = await this.application.container.makeAsync(command, [
this.application,
this,
]);
/**
* Execute global flags
*/
this.executeGlobalFlagsHandlers(args, command);
/**
* Process the arguments and flags for the command
*/
await this.processCommandArgsAndFlags(commandInstance, args);
/**
* Keep a reference to the entry command. So that we know if we
* want to entertain `.exit` or not
*/
this.entryCommand = commandInstance;
/**
* Execute before run hooks
*/
await this.hooks.execute('before', 'run', commandInstance);
/**
* Execute command
*/
return commandInstance.exec();
}
/**
* Handles exiting the process
*/
async exitProcess(error) {
/**
* Check for state to avoid exiting the process multiple times
*/
if (this.state === 'completed') {
return;
}
this.state = 'completed';
/**
* Re-assign error if entry command exists and has error
*/
if (!error && this.entryCommand && this.entryCommand.error) {
error = this.entryCommand.error;
}
/**
* Execute the after run hooks. Wrapping inside try/catch since this is the
* cleanup handler for the process and must handle all exceptions
*/
try {
if (this.entryCommand) {
await this.hooks.execute('after', 'run', this.entryCommand);
}
}
catch (hookError) {
error = hookError;
}
/**
* Assign error to the kernel instance
*/
if (error) {
this.error = error;
}
/**
* Figure out the exit code for the process
*/
const exitCode = error ? 1 : 0;
const commandExitCode = this.entryCommand && this.entryCommand.exitCode;
this.exitCode = commandExitCode === undefined ? exitCode : commandExitCode;
try {
await this.exitHandler(this);
}
catch (exitHandlerError) {
cliui_1.logger.warning('Expected exit handler to exit the process. Instead it raised an exception');
cliui_1.logger.fatal(exitHandlerError);
}
}
before(action, callback) {
this.hooks.add('before', action, callback);
return this;
}
after(action, callback) {
this.hooks.add('after', action, callback);
return this;
}
/**
* Register an array of command constructors
*/
register(commands) {
commands.forEach((command) => {
command.boot();
(0, validateCommand_1.validateCommand)(command);
this.commands[command.commandName] = command;
/**
* Registering command aliaes
*/
command.aliases.forEach((alias) => (this.aliases[alias] = command.commandName));
});
return this;
}
/**
* Register a global flag. It can be defined in combination with
* any command.
*/
flag(name, handler, options) {
this.flags[name] = Object.assign({
name,
propertyName: name,
handler,
type: 'boolean',
}, options);
return this;
}
/**
* Use manifest instance to lazy load commands
*/
useManifest(manifestLoader) {
this.manifestLoader = manifestLoader;
return this;
}
/**
* Register an exit handler
*/
onExit(callback) {
this.exitHandler = callback;
return this;
}
/**
* Returns an array of command names suggestions for a given name.
*/
getSuggestions(name, distance = 3) {
const leven = require('leven');
const { commands, aliases } = this.getAllCommandsAndAliases();
const suggestions = commands
.filter(({ commandName }) => leven(name, commandName) <= distance)
.map(({ commandName }) => commandName);
return suggestions.concat(Object.keys(aliases).filter((alias) => leven(name, alias) <= distance));
}
/**
* Preload the manifest file. Re-running this method twice will
* result in a noop
*/
async preloadManifest() {
/**
* Load manifest commands when instance of manifest loader exists.
*/
if (this.manifestLoader) {
await this.manifestLoader.boot();
}
}
/**
* Finds the command from the command line argv array. If command for
* the given name doesn't exists, then it will return `null`.
*
* Does executes the before and after hooks regardless of whether the
* command has been found or not
*/
async find(argv) {
/**
* ----------------------------------------------------------------------------
* Even though in `Unix` the command name may appear in between or at last, with
* ace we always want the command name to be the first argument. However, the
* arguments to the command itself can appear in any sequence. For example:
*
* Works
* - node ace make:controller foo
* - node ace make:controller --http foo
*
* Doesn't work
* - node ace foo make:controller
* ----------------------------------------------------------------------------
*/
const [commandName] = argv;
/**
* Command name from the registered aliases
*/
const aliasCommandName = this.aliases[commandName];
/**
* Manifest commands gets preference over manually registered commands.
*
* - We check the manifest loader is register
* - The manifest loader has the command
* - Or the manifest loader has the alias command
*/
const commandNode = this.manifestLoader
? this.manifestLoader.hasCommand(commandName)
? this.manifestLoader.getCommand(commandName)
: this.manifestLoader.hasCommand(aliasCommandName)
? this.manifestLoader.getCommand(aliasCommandName)
: undefined
: undefined;
if (commandNode) {
commandNode.command.aliases = commandNode.command.aliases || [];
if (aliasCommandName && !commandNode.command.aliases.includes(commandName)) {
commandNode.command.aliases.push(commandName);
}
await this.hooks.execute('before', 'find', commandNode.command);
const command = await this.manifestLoader.loadCommand(commandNode.command.commandName);
await this.hooks.execute('after', 'find', command);
return command;
}
else {
/**
* Try to find command inside manually registered command or fallback
* to null
*/
const command = this.commands[commandName] || this.commands[aliasCommandName] || null;
/**
* Share main command name as an alias with the command
*/
if (command) {
command.aliases = command.aliases || [];
if (aliasCommandName && !command.aliases.includes(commandName)) {
command.aliases.push(commandName);
}
}
/**
* Executing before and after together to be compatible
* with the manifest find before and after hooks
*/
await this.hooks.execute('before', 'find', command);
await this.hooks.execute('after', 'find', command);
return command;
}
}
/**
* Run the default command. The default command doesn't accept
* and args or flags.
*/
async runDefaultCommand() {
this.defaultCommand.boot();
(0, validateCommand_1.validateCommand)(this.defaultCommand);
/**
* Execute before/after find hooks
*/
await this.hooks.execute('before', 'find', this.defaultCommand);
await this.hooks.execute('after', 'find', this.defaultCommand);
/**
* Make the command instance using the container
*/
const commandInstance = await this.application.container.makeAsync(this.defaultCommand, [
this.application,
this,
]);
/**
* Execute before run hook
*/
await this.hooks.execute('before', 'run', commandInstance);
/**
* Keep a reference to the entry command
*/
this.entryCommand = commandInstance;
/**
* Execute the command
*/
return commandInstance.exec();
}
/**
* Find if a command is the main command. Main commands are executed
* directly from the terminal.
*/
isMain(command) {
return !!this.entryCommand && this.entryCommand === command;
}
/**
* Enforce mocking the console output. Command logs, tables, prompts
* will be mocked
*/
mockConsoleOutput() {
this.isMockingConsoleOutput = true;
return this;
}
/**
* Toggle interactive state
*/
interactive(state) {
this.isInteractive = state;
return this;
}
/**
* Execute a command as a sub-command. Do not call "handle" and
* always use this method to invoke command programatically
*/
async exec(commandName, args) {
const command = await this.find([commandName]);
/**
* Command not found.
*/
if (!command) {
throw Exceptions_1.InvalidCommandException.invoke(commandName, this.getSuggestions(commandName));
}
/**
* Make an instance of command and keep a reference of it as `this.entryCommand`
*/
const commandInstance = await this.application.container.makeAsync(command, [
this.application,
this,
]);
/**
* Process args and flags for the command
*/
await this.processCommandArgsAndFlags(commandInstance, args);
let commandError;
/**
* Wrapping the command execution inside a try/catch, so that
* we can run the after hooks regardless of success or
* failure
*/
try {
await this.hooks.execute('before', 'run', commandInstance);
await commandInstance.exec();
}
catch (error) {
commandError = error;
}
/**
* Execute after hooks
*/
await this.hooks.execute('after', 'run', commandInstance);
/**
* Re-throw error (if any)
*/
if (commandError) {
throw commandError;
}
return commandInstance;
}
/**
* Makes instance of a given command by processing command line arguments
* and setting them on the command instance
*/
async handle(argv) {
if (this.state !== 'idle') {
return;
}
this.state = 'running';
try {
/**
* Preload the manifest file to load the manifest files
*/
this.preloadManifest();
/**
* Branch 1
* Run default command and invoke the exit handler
*/
if (!argv.length) {
await this.runDefaultCommand();
await this.exitProcess();
return;
}
/**
* Branch 2
* No command has been mentioned and hence execute all the global flags
* invoke the exit handler
*/
const hasMentionedCommand = !argv[0].startsWith('-');
if (!hasMentionedCommand) {
this.executeGlobalFlagsHandlers(argv);
await this.exitProcess();
return;
}
/**
* Branch 3
* Execute the given command as the main command
*/
const [commandName, ...args] = argv;
await this.execMain(commandName, args);
/**
* Exit the process if there isn't any entry command
*/
if (!this.entryCommand) {
await this.exitProcess();
return;
}
const entryCommandConstructor = this.entryCommand.constructor;
/**
* Exit the process if entry command isn't a stayalive command. Stayalive
* commands should call `this.exit` to exit the process.
*/
if (!entryCommandConstructor.settings.stayAlive) {
await this.exitProcess();
}
}
catch (error) {
await this.exitProcess(error);
}
}
/**
* Print the help screen for a given command or all commands/flags
*/
printHelp(command, commandsToAppend, aliasesToAppend) {
let { commands, aliases } = this.getAllCommandsAndAliases();
/**
* Append additional commands and aliases for help screen only
*/
if (commandsToAppend) {
commands = commands.concat(commandsToAppend);
}
if (aliasesToAppend) {
aliases = Object.assign({}, aliases, aliasesToAppend);
}
if (command) {
(0, help_1.printHelpFor)(command, aliases);
}
else {
const flags = Object.keys(this.flags).map((name) => this.flags[name]);
(0, help_1.printHelp)(commands, flags, aliases);
}
}
/**
* Trigger kernel to exit the process. The call to this method
* is ignored when command is not same the `entryCommand`.
*
* In other words, subcommands cannot trigger exit
*/
async exit(command, error) {
if (command !== this.entryCommand) {
return;
}
await this.exitProcess(error);
}
}
exports.Kernel = Kernel;
-29
View File
@@ -1,29 +0,0 @@
/**
* Exposes the API to generate the ace manifest file. The manifest file
* contains the meta data of all the registered commands. This speeds
* up the boot cycle of ace
*/
export declare class ManifestGenerator {
private basePath;
private commands;
/**
* Here we keep track of processed command files to prevent loops. Mainly when using
* listDirectoryFiles to export command paths from directory and not excluding current file.
*/
private processedFiles;
constructor(basePath: string, commands: string[]);
/**
* Loads a given command from the disk. A command line can recursively
* exposed sub command paths. But they should be resolvable using
* the base path
*/
private loadCommand;
/**
* Loads all the commands from the disk recursively.
*/
private loadCommands;
/**
* Generates and writes the ace manifest file to the base path
*/
generate(): Promise<void>;
}
-96
View File
@@ -1,96 +0,0 @@
"use strict";
/*
* @adonisjs/ace
*
* (c) Harminder Virk <virk@adonisjs.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.ManifestGenerator = void 0;
const fs_extra_1 = require("fs-extra");
const path_1 = require("path");
const utils_1 = require("@poppinss/utils");
const helpers_1 = require("@poppinss/utils/build/helpers");
const validateCommand_1 = require("../utils/validateCommand");
/**
* Exposes the API to generate the ace manifest file. The manifest file
* contains the meta data of all the registered commands. This speeds
* up the boot cycle of ace
*/
class ManifestGenerator {
constructor(basePath, commands) {
this.basePath = basePath;
this.commands = commands;
/**
* Here we keep track of processed command files to prevent loops. Mainly when using
* listDirectoryFiles to export command paths from directory and not excluding current file.
*/
this.processedFiles = new Set();
}
/**
* Loads a given command from the disk. A command line can recursively
* exposed sub command paths. But they should be resolvable using
* the base path
*/
async loadCommand(commandPath) {
if ((0, path_1.isAbsolute)(commandPath)) {
throw new utils_1.Exception('Absolute path to a command is not allowed when generating the manifest file');
}
const resolvedPath = (0, helpers_1.resolveFrom)(this.basePath, commandPath);
if (this.processedFiles.has(resolvedPath)) {
return [];
}
const commandOrSubCommandsPaths = (0, utils_1.esmRequire)(resolvedPath);
this.processedFiles.add(resolvedPath);
if (Array.isArray(commandOrSubCommandsPaths)) {
return this.loadCommands(commandOrSubCommandsPaths);
}
/**
* File export has command constructor
*/
(0, validateCommand_1.validateCommand)(commandOrSubCommandsPaths, commandPath);
return [
{
command: commandOrSubCommandsPaths,
commandPath,
},
];
}
/**
* Loads all the commands from the disk recursively.
*/
async loadCommands(commandPaths) {
let commands = [];
for (const commandPath of commandPaths) {
const command = await this.loadCommand(commandPath);
commands = commands.concat(command);
}
return commands;
}
/**
* Generates and writes the ace manifest file to the base path
*/
async generate() {
const commands = await this.loadCommands(this.commands);
const manifest = commands.reduce((result, { command, commandPath }) => {
const manifestNode = {
settings: command.settings || {},
commandPath: commandPath.replace(new RegExp(`${(0, path_1.extname)(commandPath)}$`), ''),
commandName: command.commandName,
description: command.description,
args: command.args,
aliases: command.aliases,
flags: command.flags,
};
result.commands[command.commandName] = manifestNode;
command.aliases.forEach((alias) => {
result.aliases[alias] = command.commandName;
});
return result;
}, { commands: {}, aliases: {} });
await (0, fs_extra_1.outputJSON)((0, path_1.join)(this.basePath, 'ace-manifest.json'), manifest, { spaces: 2 });
}
}
exports.ManifestGenerator = ManifestGenerator;
-57
View File
@@ -1,57 +0,0 @@
import { Aliases, ManifestCommand, ManifestLoaderContract, CommandConstructorContract } from '../Contracts';
/**
* The manifest loader exposes the API to load ace commands from one
* or more manifest files.
*/
export declare class ManifestLoader implements ManifestLoaderContract {
private files;
/**
* An array of defined manifest files
*/
private manifestFiles;
booted: boolean;
constructor(files: {
basePath: string;
manifestAbsPath: string;
}[]);
/**
* Loads the manifest file from the disk
*/
private loadManifestFile;
/**
* Returns the command manifest node for a give command
*/
private getCommandManifest;
/**
* Boot manifest loader to read all manifest files from the disk
*/
boot(): Promise<void>;
/**
* Returns base path for a given command
*/
getCommandBasePath(commandName: string): string | undefined;
/**
* Returns manifest command node. One must load the command
* in order to use it
*/
getCommand(commandName: string): {
basePath: string;
command: ManifestCommand;
} | undefined;
/**
* Find if a command exists or not
*/
hasCommand(commandName: string): boolean;
/**
* Load command from the disk. Make sure to use [[hasCommand]] before
* calling this method
*/
loadCommand(commandName: string): Promise<CommandConstructorContract>;
/**
* Returns an array of manifest commands
*/
getCommands(): {
commands: ManifestCommand[];
aliases: Aliases;
};
}

Some files were not shown because too many files have changed in this diff Show More