Aktueller Stand
This commit is contained in:
20
backend/node_modules/@fastify/fast-json-stringify-compiler/standalone.js
generated
vendored
20
backend/node_modules/@fastify/fast-json-stringify-compiler/standalone.js
generated
vendored
@@ -1,6 +1,21 @@
|
||||
'use strict'
|
||||
|
||||
const SerializerSelector = require('./index')
|
||||
const fastJsonStringify = require('fast-json-stringify')
|
||||
|
||||
function SerializerSelector () {
|
||||
return function buildSerializerFactory (externalSchemas, serializerOpts) {
|
||||
const fjsOpts = Object.assign({}, serializerOpts, { schema: externalSchemas })
|
||||
return responseSchemaCompiler.bind(null, fjsOpts)
|
||||
}
|
||||
}
|
||||
|
||||
function responseSchemaCompiler (fjsOpts, { schema /* method, url, httpStatus */ }) {
|
||||
if (fjsOpts.schema && schema.$id && fjsOpts.schema[schema.$id]) {
|
||||
fjsOpts.schema = { ...fjsOpts.schema }
|
||||
delete fjsOpts.schema[schema.$id]
|
||||
}
|
||||
return fastJsonStringify(schema, fjsOpts)
|
||||
}
|
||||
|
||||
function StandaloneSerializer (options = { readMode: true }) {
|
||||
if (options.readMode === true && typeof options.restoreFunction !== 'function') {
|
||||
@@ -38,5 +53,6 @@ function StandaloneSerializer (options = { readMode: true }) {
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = StandaloneSerializer
|
||||
module.exports.SerializerSelector = SerializerSelector
|
||||
module.exports.StandaloneSerializer = StandaloneSerializer
|
||||
module.exports.default = StandaloneSerializer
|
||||
|
||||
Reference in New Issue
Block a user