@feathersjs/typebox
Version:
TypeBox integration for @feathersjs/schema
75 lines • 4.39 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.defaultAppConfiguration = exports.sqlSettingsSchema = exports.authenticationSettingsSchema = void 0;
const typebox_1 = require("@sinclair/typebox");
exports.authenticationSettingsSchema = typebox_1.Type.Object({
secret: typebox_1.Type.String({ description: 'The JWT signing secret' }),
entity: typebox_1.Type.Optional(typebox_1.Type.Union([
typebox_1.Type.String({ description: 'The name of the authentication entity (e.g. user)' }),
typebox_1.Type.Null()
])),
entityId: typebox_1.Type.Optional(typebox_1.Type.String({ description: 'The name of the authentication entity id property' })),
service: typebox_1.Type.Optional(typebox_1.Type.String({ description: 'The path of the entity service' })),
authStrategies: typebox_1.Type.Array(typebox_1.Type.String(), {
description: 'A list of authentication strategy names that are allowed to create JWT access tokens'
}),
parseStrategies: typebox_1.Type.Optional(typebox_1.Type.Array(typebox_1.Type.String(), {
description: 'A list of authentication strategy names that should parse HTTP headers for authentication information (defaults to `authStrategies`)'
})),
jwtOptions: typebox_1.Type.Optional(typebox_1.Type.Object({})),
jwt: typebox_1.Type.Optional(typebox_1.Type.Object({
header: typebox_1.Type.String({ default: 'Authorization', description: 'The HTTP header containing the JWT' }),
schemes: typebox_1.Type.String({ description: 'An array of schemes to support' })
})),
local: typebox_1.Type.Optional(typebox_1.Type.Object({
usernameField: typebox_1.Type.String({ description: 'Name of the username field (e.g. `email`)' }),
passwordField: typebox_1.Type.String({ description: 'Name of the password field (e.g. `password`)' }),
hashSize: typebox_1.Type.Optional(typebox_1.Type.Number({ description: 'The BCrypt salt length' })),
errorMessage: typebox_1.Type.Optional(typebox_1.Type.String({ description: 'The error message to return on errors' })),
entityUsernameField: typebox_1.Type.Optional(typebox_1.Type.String({
description: 'Name of the username field on the entity if authentication request data and entity field names are different'
})),
entityPasswordField: typebox_1.Type.Optional(typebox_1.Type.String({
description: 'Name of the password field on the entity if authentication request data and entity field names are different'
}))
})),
oauth: typebox_1.Type.Optional(typebox_1.Type.Object({
redirect: typebox_1.Type.Optional(typebox_1.Type.String()),
origins: typebox_1.Type.Optional(typebox_1.Type.Array(typebox_1.Type.String())),
defaults: typebox_1.Type.Optional(typebox_1.Type.Object({
key: typebox_1.Type.Optional(typebox_1.Type.String()),
secret: typebox_1.Type.Optional(typebox_1.Type.String())
}))
}))
});
exports.sqlSettingsSchema = typebox_1.Type.Optional(typebox_1.Type.Object({
client: typebox_1.Type.String(),
connection: typebox_1.Type.Union([
typebox_1.Type.String(),
typebox_1.Type.Partial(typebox_1.Type.Object({
host: typebox_1.Type.String(),
port: typebox_1.Type.Number(),
user: typebox_1.Type.String(),
password: typebox_1.Type.String(),
database: typebox_1.Type.String()
}))
]),
pool: typebox_1.Type.Optional(typebox_1.Type.Object({
min: typebox_1.Type.Number(),
max: typebox_1.Type.Number()
}))
}));
exports.defaultAppConfiguration = typebox_1.Type.Object({
authentication: typebox_1.Type.Optional(exports.authenticationSettingsSchema),
paginate: typebox_1.Type.Optional(typebox_1.Type.Object({
default: typebox_1.Type.Number(),
max: typebox_1.Type.Number()
}, { additionalProperties: false })),
origins: typebox_1.Type.Optional(typebox_1.Type.Array(typebox_1.Type.String())),
mongodb: typebox_1.Type.Optional(typebox_1.Type.String()),
mysql: exports.sqlSettingsSchema,
postgresql: exports.sqlSettingsSchema,
sqlite: exports.sqlSettingsSchema,
mssql: exports.sqlSettingsSchema
}, { $id: 'ApplicationConfiguration', additionalProperties: false });
//# sourceMappingURL=default-schemas.js.map