feat(auth): implement user authentication system
This commit is contained in:
parent
4847ab793a
commit
25cea4fbe8
12051 changed files with 1462377 additions and 0 deletions
110
backend/node_modules/zod/v4/locales/sv.js
generated
vendored
Normal file
110
backend/node_modules/zod/v4/locales/sv.js
generated
vendored
Normal file
|
|
@ -0,0 +1,110 @@
|
|||
import * as util from "../core/util.js";
|
||||
const error = () => {
|
||||
const Sizable = {
|
||||
string: { unit: "tecken", verb: "att ha" },
|
||||
file: { unit: "bytes", verb: "att ha" },
|
||||
array: { unit: "objekt", verb: "att innehålla" },
|
||||
set: { unit: "objekt", verb: "att innehålla" },
|
||||
};
|
||||
function getSizing(origin) {
|
||||
return Sizable[origin] ?? null;
|
||||
}
|
||||
const FormatDictionary = {
|
||||
regex: "reguljärt uttryck",
|
||||
email: "e-postadress",
|
||||
url: "URL",
|
||||
emoji: "emoji",
|
||||
uuid: "UUID",
|
||||
uuidv4: "UUIDv4",
|
||||
uuidv6: "UUIDv6",
|
||||
nanoid: "nanoid",
|
||||
guid: "GUID",
|
||||
cuid: "cuid",
|
||||
cuid2: "cuid2",
|
||||
ulid: "ULID",
|
||||
xid: "XID",
|
||||
ksuid: "KSUID",
|
||||
datetime: "ISO-datum och tid",
|
||||
date: "ISO-datum",
|
||||
time: "ISO-tid",
|
||||
duration: "ISO-varaktighet",
|
||||
ipv4: "IPv4-intervall",
|
||||
ipv6: "IPv6-intervall",
|
||||
cidrv4: "IPv4-spektrum",
|
||||
cidrv6: "IPv6-spektrum",
|
||||
base64: "base64-kodad sträng",
|
||||
base64url: "base64url-kodad sträng",
|
||||
json_string: "JSON-sträng",
|
||||
e164: "E.164-nummer",
|
||||
jwt: "JWT",
|
||||
template_literal: "mall-literal",
|
||||
};
|
||||
const TypeDictionary = {
|
||||
nan: "NaN",
|
||||
number: "antal",
|
||||
array: "lista",
|
||||
};
|
||||
return (issue) => {
|
||||
switch (issue.code) {
|
||||
case "invalid_type": {
|
||||
const expected = TypeDictionary[issue.expected] ?? issue.expected;
|
||||
const receivedType = util.parsedType(issue.input);
|
||||
const received = TypeDictionary[receivedType] ?? receivedType;
|
||||
if (/^[A-Z]/.test(issue.expected)) {
|
||||
return `Ogiltig inmatning: förväntat instanceof ${issue.expected}, fick ${received}`;
|
||||
}
|
||||
return `Ogiltig inmatning: förväntat ${expected}, fick ${received}`;
|
||||
}
|
||||
case "invalid_value":
|
||||
if (issue.values.length === 1)
|
||||
return `Ogiltig inmatning: förväntat ${util.stringifyPrimitive(issue.values[0])}`;
|
||||
return `Ogiltigt val: förväntade en av ${util.joinValues(issue.values, "|")}`;
|
||||
case "too_big": {
|
||||
const adj = issue.inclusive ? "<=" : "<";
|
||||
const sizing = getSizing(issue.origin);
|
||||
if (sizing) {
|
||||
return `För stor(t): förväntade ${issue.origin ?? "värdet"} att ha ${adj}${issue.maximum.toString()} ${sizing.unit ?? "element"}`;
|
||||
}
|
||||
return `För stor(t): förväntat ${issue.origin ?? "värdet"} att ha ${adj}${issue.maximum.toString()}`;
|
||||
}
|
||||
case "too_small": {
|
||||
const adj = issue.inclusive ? ">=" : ">";
|
||||
const sizing = getSizing(issue.origin);
|
||||
if (sizing) {
|
||||
return `För lite(t): förväntade ${issue.origin ?? "värdet"} att ha ${adj}${issue.minimum.toString()} ${sizing.unit}`;
|
||||
}
|
||||
return `För lite(t): förväntade ${issue.origin ?? "värdet"} att ha ${adj}${issue.minimum.toString()}`;
|
||||
}
|
||||
case "invalid_format": {
|
||||
const _issue = issue;
|
||||
if (_issue.format === "starts_with") {
|
||||
return `Ogiltig sträng: måste börja med "${_issue.prefix}"`;
|
||||
}
|
||||
if (_issue.format === "ends_with")
|
||||
return `Ogiltig sträng: måste sluta med "${_issue.suffix}"`;
|
||||
if (_issue.format === "includes")
|
||||
return `Ogiltig sträng: måste innehålla "${_issue.includes}"`;
|
||||
if (_issue.format === "regex")
|
||||
return `Ogiltig sträng: måste matcha mönstret "${_issue.pattern}"`;
|
||||
return `Ogiltig(t) ${FormatDictionary[_issue.format] ?? issue.format}`;
|
||||
}
|
||||
case "not_multiple_of":
|
||||
return `Ogiltigt tal: måste vara en multipel av ${issue.divisor}`;
|
||||
case "unrecognized_keys":
|
||||
return `${issue.keys.length > 1 ? "Okända nycklar" : "Okänd nyckel"}: ${util.joinValues(issue.keys, ", ")}`;
|
||||
case "invalid_key":
|
||||
return `Ogiltig nyckel i ${issue.origin ?? "värdet"}`;
|
||||
case "invalid_union":
|
||||
return "Ogiltig input";
|
||||
case "invalid_element":
|
||||
return `Ogiltigt värde i ${issue.origin ?? "värdet"}`;
|
||||
default:
|
||||
return `Ogiltig input`;
|
||||
}
|
||||
};
|
||||
};
|
||||
export default function () {
|
||||
return {
|
||||
localeError: error(),
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue