- Delete old Vite+Svelte frontend - Initialize new SvelteKit project with TypeScript - Configure Tailwind CSS v4 + DaisyUI - Implement JWT authentication with auto-refresh - Create login page with form validation (Zod) - Add protected route guards - Update Docker configuration for single-stage build - Add E2E tests with Playwright (6/11 passing) - Fix Svelte 5 reactivity with $state() runes Known issues: - 5 E2E tests failing (timing/async issues) - Token refresh implementation needs debugging - Validation error display timing
37 lines
1.1 KiB
JavaScript
37 lines
1.1 KiB
JavaScript
import { createAdapter } from './adapters.js';
|
|
import { memoize } from '../memoize.js';
|
|
import convert from './joi-to-json-schema/index.js';
|
|
async function validate(schema, data) {
|
|
const result = schema.validate(data, { abortEarly: false });
|
|
if (result.error == null) {
|
|
return {
|
|
data: result.value,
|
|
success: true
|
|
};
|
|
}
|
|
return {
|
|
issues: result.error.details.map(({ message, path }) => ({
|
|
message,
|
|
path
|
|
})),
|
|
success: false
|
|
};
|
|
}
|
|
/* @__NO_SIDE_EFFECTS__ */
|
|
function _joi(schema, options) {
|
|
return createAdapter({
|
|
superFormValidationLibrary: 'joi',
|
|
jsonSchema: options?.jsonSchema ?? convert(schema),
|
|
defaults: options?.defaults,
|
|
validate: async (data) => validate(schema, data)
|
|
});
|
|
}
|
|
function _joiClient(schema) {
|
|
return {
|
|
superFormValidationLibrary: 'joi',
|
|
validate: async (data) => validate(schema, data)
|
|
};
|
|
}
|
|
export const joi = /* @__PURE__ */ memoize(_joi);
|
|
export const joiClient = /* @__PURE__ */ memoize(_joiClient);
|