added doga

This commit is contained in:
szabomarton
2025-02-25 09:55:29 +01:00
parent 5174ab4cc4
commit 13254e5623
1149 changed files with 80161 additions and 0 deletions

21
25_02_24/node_modules/@tinyhttp/router/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2020 v 1 r t l
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.

26
25_02_24/node_modules/@tinyhttp/router/README.md generated vendored Normal file
View File

@@ -0,0 +1,26 @@
# @tinyhttp/router
[![npm (scoped)][npm-badge]](https://npmjs.com/package/@tinyhttp/router) [![npm][dl-badge]](https://npmjs.com/package/@tinyhttp/router)
Framework-agnostic HTTP router.
## Install
```sh
pnpm i @tinyhttp/router
```
## Example
```js
import { Router } from '@tinyhttp/router'
const router = new Router()
router.get('/', (req, res) => res.send('Hello World'))
console.log(router.middleware)
```
[npm-badge]: https://img.shields.io/npm/v/@tinyhttp/router?style=flat-square
[dl-badge]: https://img.shields.io/npm/dt/@tinyhttp/router?style=flat-square

95
25_02_24/node_modules/@tinyhttp/router/dist/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,95 @@
export type NextFunction = (err?: any) => void;
export type SyncHandler<Request = any, Response = any> = (req: Request, res: Response, next?: NextFunction) => void;
export type AsyncHandler<Request = any, Response = any> = (req: Request, res: Response, next?: NextFunction) => Promise<void>;
export type Handler<Request = any, Response = any> = AsyncHandler<Request, Response> | SyncHandler<Request, Response>;
declare const METHODS: readonly ["ACL", "BIND", "CHECKOUT", "CONNECT", "COPY", "DELETE", "GET", "HEAD", "LINK", "LOCK", "M-SEARCH", "MERGE", "MKACTIVITY", "MKCALENDAR", "MKCOL", "MOVE", "NOTIFY", "OPTIONS", "PATCH", "POST", "PRI", "PROPFIND", "PROPPATCH", "PURGE", "PUT", "REBIND", "REPORT", "SEARCH", "SOURCE", "SUBSCRIBE", "TRACE", "UNBIND", "UNLINK", "UNLOCK", "UNSUBSCRIBE"];
export type Method = (typeof METHODS)[number];
export type MiddlewareType = 'mw' | 'route';
type RegexParams = {
keys: string[] | false;
pattern: RegExp;
};
type RIM<Req, Res, App> = (...args: RouterMethodParams<Req, Res>) => App;
export interface Middleware<Req = any, Res = any> {
method?: Method;
handler: Handler<Req, Res>;
path?: string;
type: MiddlewareType;
regex?: RegexParams;
fullPath?: string;
}
export type MethodHandler<Req = any, Res = any> = {
path?: string | string[] | Handler<Req, Res>;
handler?: Handler<Req, Res>;
type: MiddlewareType;
regex?: RegexParams;
fullPath?: string;
};
export type RouterHandler<Req = any, Res = any> = Handler<Req, Res> | Handler<Req, Res>[] | string[];
export type RouterPathOrHandler<Req = any, Res = any> = string | RouterHandler<Req, Res>;
export type RouterMethod<Req = any, Res = any> = (path: string | string[] | Handler<Req, Res>, handler?: RouterHandler<Req, Res>, ...handlers: RouterHandler<Req, Res>[]) => any;
type RouterMethodParams<Req = any, Res = any> = Parameters<RouterMethod<Req, Res>>;
export type UseMethod<Req = any, Res = any, App extends Router = any> = (path: RouterPathOrHandler<Req, Res> | App, handler?: RouterHandler<Req, Res> | App, ...handlers: (RouterHandler<Req, Res> | App)[]) => any;
export type UseMethodParams<Req = any, Res = any, App extends Router = any> = Parameters<UseMethod<Req, Res, App>>;
/**
* Push wares to a middleware array
* @param mw Middleware arrays
*/
export declare const pushMiddleware: <Req = any, Res = any>(mw: Middleware[]) => ({ path, handler, method, handlers, type, fullPaths }: MethodHandler<Req, Res> & {
method?: Method;
handlers?: RouterHandler<Req, Res>[];
fullPaths?: string[];
}) => void;
/**
* tinyhttp Router. Manages middleware and has HTTP methods aliases, e.g. `app.get`, `app.put`
*/
export declare class Router<App extends Router = any, Req = any, Res = any> {
middleware: Middleware[];
mountpath: string;
parent: App;
apps: Record<string, App>;
acl: RIM<Req, Res, this>;
bind: RIM<Req, Res, this>;
checkout: RIM<Req, Res, this>;
connect: RIM<Req, Res, this>;
copy: RIM<Req, Res, this>;
delete: RIM<Req, Res, this>;
get: RIM<Req, Res, this>;
head: RIM<Req, Res, this>;
link: RIM<Req, Res, this>;
lock: RIM<Req, Res, this>;
merge: RIM<Req, Res, this>;
mkactivity: RIM<Req, Res, this>;
mkcalendar: RIM<Req, Res, this>;
mkcol: RIM<Req, Res, this>;
move: RIM<Req, Res, this>;
notify: RIM<Req, Res, this>;
options: RIM<Req, Res, this>;
patch: RIM<Req, Res, this>;
post: RIM<Req, Res, this>;
pri: RIM<Req, Res, this>;
propfind: RIM<Req, Res, this>;
proppatch: RIM<Req, Res, this>;
purge: RIM<Req, Res, this>;
put: RIM<Req, Res, this>;
rebind: RIM<Req, Res, this>;
report: RIM<Req, Res, this>;
search: RIM<Req, Res, this>;
source: RIM<Req, Res, this>;
subscribe: RIM<Req, Res, this>;
trace: RIM<Req, Res, this>;
unbind: RIM<Req, Res, this>;
unlink: RIM<Req, Res, this>;
unlock: RIM<Req, Res, this>;
unsubscribe: RIM<Req, Res, this>;
constructor();
add(method: Method): (path: string | string[] | Handler<Req, Res>, handler?: RouterHandler<Req, Res> | undefined, ...handlers: RouterHandler<Req, Res>[]) => this;
msearch(...args: RouterMethodParams<Req, Res>): this;
all(...args: RouterMethodParams<Req, Res>): this;
/**
* Push middleware to the stack
*/
use(...args: UseMethodParams<Req, Res, App>): this;
}
export {};
//# sourceMappingURL=index.d.ts.map

File diff suppressed because one or more lines are too long

154
25_02_24/node_modules/@tinyhttp/router/dist/index.js generated vendored Normal file
View File

@@ -0,0 +1,154 @@
/* HELPER TYPES */
const METHODS = [
'ACL',
'BIND',
'CHECKOUT',
'CONNECT',
'COPY',
'DELETE',
'GET',
'HEAD',
'LINK',
'LOCK',
'M-SEARCH',
'MERGE',
'MKACTIVITY',
'MKCALENDAR',
'MKCOL',
'MOVE',
'NOTIFY',
'OPTIONS',
'PATCH',
'POST',
'PRI',
'PROPFIND',
'PROPPATCH',
'PURGE',
'PUT',
'REBIND',
'REPORT',
'SEARCH',
'SOURCE',
'SUBSCRIBE',
'TRACE',
'UNBIND',
'UNLINK',
'UNLOCK',
'UNSUBSCRIBE'
];
/** HELPER METHODS */
const createMiddlewareFromRoute = ({ path, handler, fullPath, method }) => ({
method,
handler: handler || path,
path: typeof path === 'string' ? path : '/',
fullPath: typeof path === 'string' ? fullPath : path
});
/**
* Push wares to a middleware array
* @param mw Middleware arrays
*/
export const pushMiddleware = (mw) => ({ path, handler, method, handlers, type, fullPaths }) => {
const m = createMiddlewareFromRoute({ path, handler, method, type, fullPath: fullPaths === null || fullPaths === void 0 ? void 0 : fullPaths[0] });
let waresFromHandlers = [];
let idx = 1;
if (handlers) {
waresFromHandlers = handlers.flat().map((handler) => createMiddlewareFromRoute({
path,
handler: handler,
method,
type,
fullPath: fullPaths == null ? undefined : fullPaths[idx++]
}));
}
for (const mdw of [m, ...waresFromHandlers])
mw.push({ ...mdw, type });
};
/**
* tinyhttp Router. Manages middleware and has HTTP methods aliases, e.g. `app.get`, `app.put`
*/
export class Router {
constructor() {
this.middleware = [];
this.mountpath = '/';
this.apps = {};
for (const m of METHODS) {
this[m.toLowerCase()] = this.add(m);
}
}
add(method) {
return (...args) => {
const handlers = args.slice(1).flat();
if (Array.isArray(args[0])) {
for (const arg of Object.values(args[0])) {
if (typeof arg === 'string') {
pushMiddleware(this.middleware)({
path: arg,
handler: handlers[0],
handlers: handlers.slice(1),
method,
type: 'route'
});
}
}
}
else {
pushMiddleware(this.middleware)({
path: args[0],
handler: handlers[0],
handlers: handlers.slice(1),
method,
type: 'route'
});
}
return this;
};
}
msearch(...args) {
const handlers = args.slice(1).flat();
pushMiddleware(this.middleware)({
path: args[0],
handler: handlers[0],
handlers: handlers.slice(1),
method: 'M-SEARCH',
type: 'route'
});
return this;
}
all(...args) {
const handlers = args.slice(1).flat();
pushMiddleware(this.middleware)({
path: args[0],
handler: handlers[0],
handlers: handlers.slice(1),
type: 'route'
});
return this;
}
/**
* Push middleware to the stack
*/
use(...args) {
const base = args[0];
const handlers = args.slice(1).flat();
if (typeof base === 'string') {
pushMiddleware(this.middleware)({
path: base,
handler: handlers[0],
handlers: handlers.slice(1),
type: 'mw'
});
}
else {
pushMiddleware(this.middleware)({
path: '/',
handler: Array.isArray(base) ? base[0] : base,
handlers: Array.isArray(base)
? [...base.slice(1), ...handlers]
: handlers,
type: 'mw'
});
}
return this;
}
}
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,kBAAkB;AAclB,MAAM,OAAO,GAAG;IACd,KAAK;IACL,MAAM;IACN,UAAU;IACV,SAAS;IACT,MAAM;IACN,QAAQ;IACR,KAAK;IACL,MAAM;IACN,MAAM;IACN,MAAM;IACN,UAAU;IACV,OAAO;IACP,YAAY;IACZ,YAAY;IACZ,OAAO;IACP,MAAM;IACN,QAAQ;IACR,SAAS;IACT,OAAO;IACP,MAAM;IACN,KAAK;IACL,UAAU;IACV,WAAW;IACX,OAAO;IACP,KAAK;IACL,QAAQ;IACR,QAAQ;IACR,QAAQ;IACR,QAAQ;IACR,WAAW;IACX,OAAO;IACP,QAAQ;IACR,QAAQ;IACR,QAAQ;IACR,aAAa;CACL,CAAA;AAkDV,qBA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OAAO,EAAE,QAAQ,CAAC,CAAC,CAAY;gBAC/B,QAAQ,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAc;gBACxC,IAAI,EAAE,IAAI;aACX,CAAC,CAAA;QACJ,CAAC;aAAM,CAAC;YACN,cAAc,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;gBAC9B,IAAI,EAAE,GAAG;gBACT,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAE,IAAI,CAAC,CAAC,CAAa,CAAC,CAAC,CAAE,IAAgB;gBACvE,QAAQ,EAAE,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC;oBAC3B,CAAC,CAAC,CAAC,GAAI,IAAI,CAAC,KAAK,CAAC,CAAC,CAAe,EAAE,GAAI,QAAsB,CAAC;oBAC/D,CAAC,CAAE,QAAsB;gBAC3B,IAAI,EAAE,IAAI;aACX,CAAC,CAAA;QACJ,CAAC;QAED,OAAO,IAAI,CAAA;IACb,CAAC;CACF"}

30
25_02_24/node_modules/@tinyhttp/router/package.json generated vendored Normal file
View File

@@ -0,0 +1,30 @@
{
"name": "@tinyhttp/router",
"version": "2.2.3",
"type": "module",
"description": "Router for tinyhttp",
"homepage": "https://tinyhttp.v1rtl.site",
"repository": {
"type": "git",
"url": "https://github.com/tinyhttp/tinyhttp.git",
"directory": "packages/router"
},
"types": "./dist/index.d.ts",
"exports": "./dist/index.js",
"keywords": [
"tinyhttp",
"node.js",
"web framework",
"web",
"backend",
"router"
],
"engines": {
"node": ">=12.20.0"
},
"author": "v1rtl",
"license": "MIT",
"scripts": {
"build": "tsc"
}
}

File diff suppressed because one or more lines are too long