Aktueller Stand
This commit is contained in:
16
backend/node_modules/find-my-way/lib/handler-storage.js
generated
vendored
16
backend/node_modules/find-my-way/lib/handler-storage.js
generated
vendored
@@ -1,5 +1,6 @@
|
||||
'use strict'
|
||||
|
||||
const { NullObject } = require('./null-object')
|
||||
const httpMethodStrategy = require('./strategies/http-method')
|
||||
|
||||
class HandlerStorage {
|
||||
@@ -61,11 +62,20 @@ class HandlerStorage {
|
||||
}
|
||||
|
||||
_compileCreateParamsObject (params) {
|
||||
const lines = []
|
||||
const fnBody = []
|
||||
|
||||
fnBody.push('const fn = function _createParamsObject (paramsArray) {')
|
||||
|
||||
fnBody.push('const params = new NullObject()')
|
||||
for (let i = 0; i < params.length; i++) {
|
||||
lines.push(`'${params[i]}': paramsArray[${i}]`)
|
||||
fnBody.push(`params['${params[i]}'] = paramsArray[${i}]`)
|
||||
}
|
||||
return new Function('paramsArray', `return {${lines.join(',')}}`) // eslint-disable-line
|
||||
fnBody.push('return params')
|
||||
fnBody.push('}')
|
||||
|
||||
fnBody.push('return fn')
|
||||
|
||||
return new Function('NullObject', fnBody.join('\n'))(NullObject) // eslint-disable-line
|
||||
}
|
||||
|
||||
_getHandlerMatchingConstraints () {
|
||||
|
||||
4
backend/node_modules/find-my-way/lib/http-methods.js
generated
vendored
4
backend/node_modules/find-my-way/lib/http-methods.js
generated
vendored
@@ -1,11 +1,11 @@
|
||||
'use strict'
|
||||
|
||||
// defined by Node.js http module, a snapshot from Node.js 18.12.0
|
||||
// defined by Node.js http module, a snapshot from Node.js 22.9.0
|
||||
const httpMethods = [
|
||||
'ACL', 'BIND', 'CHECKOUT', 'CONNECT', 'COPY', 'DELETE',
|
||||
'GET', 'HEAD', 'LINK', 'LOCK', 'M-SEARCH', 'MERGE',
|
||||
'MKACTIVITY', 'MKCALENDAR', 'MKCOL', 'MOVE', 'NOTIFY', 'OPTIONS',
|
||||
'PATCH', 'POST', 'PROPFIND', 'PROPPATCH', 'PURGE', 'PUT',
|
||||
'PATCH', 'POST', 'PROPFIND', 'PROPPATCH', 'PURGE', 'PUT', 'QUERY',
|
||||
'REBIND', 'REPORT', 'SEARCH', 'SOURCE', 'SUBSCRIBE', 'TRACE',
|
||||
'UNBIND', 'UNLINK', 'UNLOCK', 'UNSUBSCRIBE'
|
||||
]
|
||||
|
||||
8
backend/node_modules/find-my-way/lib/null-object.js
generated
vendored
Normal file
8
backend/node_modules/find-my-way/lib/null-object.js
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
'use strict'
|
||||
|
||||
const NullObject = function () {}
|
||||
NullObject.prototype = Object.create(null)
|
||||
|
||||
module.exports = {
|
||||
NullObject
|
||||
}
|
||||
2
backend/node_modules/find-my-way/lib/pretty-print.js
generated
vendored
2
backend/node_modules/find-my-way/lib/pretty-print.js
generated
vendored
@@ -17,7 +17,7 @@ function printObjectTree (obj, parentPrefix = '') {
|
||||
const childPrefix = isLast ? ' ' : '│ '
|
||||
|
||||
const nodeData = value[treeDataSymbol] || ''
|
||||
const prefixedNodeData = nodeData.split('\n').join('\n' + parentPrefix + childPrefix)
|
||||
const prefixedNodeData = nodeData.replaceAll('\n', '\n' + parentPrefix + childPrefix)
|
||||
|
||||
tree += parentPrefix + nodePrefix + key + prefixedNodeData + '\n'
|
||||
tree += printObjectTree(value, parentPrefix + childPrefix)
|
||||
|
||||
6
backend/node_modules/find-my-way/lib/strategies/accept-host.js
generated
vendored
6
backend/node_modules/find-my-way/lib/strategies/accept-host.js
generated
vendored
@@ -2,11 +2,11 @@
|
||||
const assert = require('node:assert')
|
||||
|
||||
function HostStorage () {
|
||||
const hosts = {}
|
||||
const hosts = new Map()
|
||||
const regexHosts = []
|
||||
return {
|
||||
get: (host) => {
|
||||
const exact = hosts[host]
|
||||
const exact = hosts.get(host)
|
||||
if (exact) {
|
||||
return exact
|
||||
}
|
||||
@@ -20,7 +20,7 @@ function HostStorage () {
|
||||
if (host instanceof RegExp) {
|
||||
regexHosts.push({ host, value })
|
||||
} else {
|
||||
hosts[host] = value
|
||||
hosts.set(host, value)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
23
backend/node_modules/find-my-way/lib/strategies/accept-version.js
generated
vendored
23
backend/node_modules/find-my-way/lib/strategies/accept-version.js
generated
vendored
@@ -7,8 +7,7 @@ function SemVerStore () {
|
||||
return new SemVerStore()
|
||||
}
|
||||
|
||||
this.store = {}
|
||||
|
||||
this.store = new Map()
|
||||
this.maxMajor = 0
|
||||
this.maxMinors = {}
|
||||
this.maxPatches = {}
|
||||
@@ -18,7 +17,7 @@ SemVerStore.prototype.set = function (version, store) {
|
||||
if (typeof version !== 'string') {
|
||||
throw new TypeError('Version should be a string')
|
||||
}
|
||||
let [major, minor, patch] = version.split('.')
|
||||
let [major, minor, patch] = version.split('.', 3)
|
||||
|
||||
if (isNaN(major)) {
|
||||
throw new TypeError('Major version must be a numeric value')
|
||||
@@ -30,29 +29,29 @@ SemVerStore.prototype.set = function (version, store) {
|
||||
|
||||
if (major >= this.maxMajor) {
|
||||
this.maxMajor = major
|
||||
this.store.x = store
|
||||
this.store['*'] = store
|
||||
this.store['x.x'] = store
|
||||
this.store['x.x.x'] = store
|
||||
this.store.set('x', store)
|
||||
this.store.set('*', store)
|
||||
this.store.set('x.x', store)
|
||||
this.store.set('x.x.x', store)
|
||||
}
|
||||
|
||||
if (minor >= (this.maxMinors[major] || 0)) {
|
||||
this.maxMinors[major] = minor
|
||||
this.store[`${major}.x`] = store
|
||||
this.store[`${major}.x.x`] = store
|
||||
this.store.set(`${major}.x`, store)
|
||||
this.store.set(`${major}.x.x`, store)
|
||||
}
|
||||
|
||||
if (patch >= (this.maxPatches[`${major}.${minor}`] || 0)) {
|
||||
this.maxPatches[`${major}.${minor}`] = patch
|
||||
this.store[`${major}.${minor}.x`] = store
|
||||
this.store.set(`${major}.${minor}.x`, store)
|
||||
}
|
||||
|
||||
this.store[`${major}.${minor}.${patch}`] = store
|
||||
this.store.set(`${major}.${minor}.${patch}`, store)
|
||||
return this
|
||||
}
|
||||
|
||||
SemVerStore.prototype.get = function (version) {
|
||||
return this.store[version]
|
||||
return this.store.get(version)
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
|
||||
9
backend/node_modules/find-my-way/lib/strategies/http-method.js
generated
vendored
9
backend/node_modules/find-my-way/lib/strategies/http-method.js
generated
vendored
@@ -3,12 +3,13 @@
|
||||
module.exports = {
|
||||
name: '__fmw_internal_strategy_merged_tree_http_method__',
|
||||
storage: function () {
|
||||
const handlers = {}
|
||||
const handlers = new Map()
|
||||
return {
|
||||
get: (type) => { return handlers[type] || null },
|
||||
set: (type, store) => { handlers[type] = store }
|
||||
get: (type) => { return handlers.get(type) || null },
|
||||
set: (type, store) => { handlers.set(type, store) }
|
||||
}
|
||||
},
|
||||
deriveConstraint: /* istanbul ignore next */ (req) => req.method,
|
||||
/* c8 ignore next 1 */
|
||||
deriveConstraint: (req) => req.method,
|
||||
mustMatchWhenDerived: true
|
||||
}
|
||||
|
||||
9
backend/node_modules/find-my-way/lib/url-sanitizer.js
generated
vendored
9
backend/node_modules/find-my-way/lib/url-sanitizer.js
generated
vendored
@@ -34,6 +34,15 @@ function decodeComponentChar (highCharCode, lowCharCode) {
|
||||
return null
|
||||
}
|
||||
|
||||
/**
|
||||
* Safely decodes a URI path, preserving reserved characters in querystring.
|
||||
*
|
||||
* @param {string} path - The full request path, possibly including querystring.
|
||||
* @param {boolean} [useSemicolonDelimiter] - When true, also treat `;` as a query delimiter.
|
||||
* @returns {{ path: string, querystring: string, shouldDecodeParam: boolean }}
|
||||
* An object containing the decoded path, the raw querystring, and a flag indicating
|
||||
* whether any path parameters contain percent-encoded reserved characters.
|
||||
*/
|
||||
function safeDecodeURI (path, useSemicolonDelimiter) {
|
||||
let shouldDecode = false
|
||||
let shouldDecodeParam = false
|
||||
|
||||
Reference in New Issue
Block a user