feat(api): declare identity contract for registration, verification, and sessions

This commit is contained in:
shira committed 2026-10-05 22:57:19 +03:00
1 parent 197661145e
commit 653f3775f8
86 files changed
+11826 -148

No files matched your search

@@ -0,0 +1,150 @@
/**
* Generated by orval 🍺
* Do not edit manually.
* Lincodex API
* OpenAPI spec version: 0.1.0
*/
import {
faker
} from '@faker-js/faker';
import {
HttpResponse,
http
} from 'msw';
import type {
RequestHandlerOptions
} from 'msw';
import {
AccountScenario,
ConsentPurpose,
OnboardingStep
} from '../../schemas';
import type {
Account,
ConsentText,
EmailVerificationResult,
IdentityRequestAccepted,
Session
} from '../../schemas';
export const getGetConsentTextResponseMock = (overrideResponse: Partial<Extract<ConsentText, object>> = {}): ConsentText => ({purpose: faker.helpers.arrayElement(Object.values(ConsentPurpose)), text_version: faker.helpers.fromRegExp("^[A-Za-z0-9._-]+$"), text: faker.string.alpha({length: {min: 1, max: 100000}}), published_at: faker.date.past().toISOString().slice(0, 19) + 'Z', ...overrideResponse})
export const getRegisterAccountResponseMock = (overrideResponse: Partial<Extract<IdentityRequestAccepted, object>> = {}): IdentityRequestAccepted => ({status: faker.helpers.arrayElement(['accepted'] as const), ...overrideResponse})
export const getResendEmailVerificationResponseMock = (overrideResponse: Partial<Extract<IdentityRequestAccepted, object>> = {}): IdentityRequestAccepted => ({status: faker.helpers.arrayElement(['accepted'] as const), ...overrideResponse})
export const getConfirmEmailResponseMock = (overrideResponse: Partial<Extract<EmailVerificationResult, object>> = {}): EmailVerificationResult => ({email_verified: faker.helpers.arrayElement([true] as const), scenario: faker.helpers.arrayElement(Object.values(AccountScenario)), onboarding_step: faker.helpers.arrayElement(Object.values(OnboardingStep)), ...overrideResponse})
export const getLoginResponseMock = (overrideResponse: Partial<Extract<Session, object>> = {}): Session => ({account: {id: faker.string.uuid(), email: faker.internet.email(), email_verified: faker.datatype.boolean(), scenario: faker.helpers.arrayElement(Object.values(AccountScenario)), onboarding_step: faker.helpers.arrayElement(Object.values(OnboardingStep)), created_at: faker.date.past().toISOString().slice(0, 19) + 'Z'}, csrf_token: faker.helpers.fromRegExp("^[A-Za-z0-9_-]+$"), ...overrideResponse})
export const getGetCurrentSessionResponseMock = (overrideResponse: Partial<Extract<Session, object>> = {}): Session => ({account: {id: faker.string.uuid(), email: faker.internet.email(), email_verified: faker.datatype.boolean(), scenario: faker.helpers.arrayElement(Object.values(AccountScenario)), onboarding_step: faker.helpers.arrayElement(Object.values(OnboardingStep)), created_at: faker.date.past().toISOString().slice(0, 19) + 'Z'}, csrf_token: faker.helpers.fromRegExp("^[A-Za-z0-9_-]+$"), ...overrideResponse})
export const getGetCurrentAccountResponseMock = (overrideResponse: Partial<Extract<Account, object>> = {}): Account => ({id: faker.string.uuid(), email: faker.internet.email(), email_verified: faker.datatype.boolean(), scenario: faker.helpers.arrayElement(Object.values(AccountScenario)), onboarding_step: faker.helpers.arrayElement(Object.values(OnboardingStep)), created_at: faker.date.past().toISOString().slice(0, 19) + 'Z', ...overrideResponse})
export const getGetConsentTextMockHandler = (overrideResponse?: ConsentText | ((info: Parameters<Parameters<typeof http.get>[1]>[0]) => Promise<ConsentText> | ConsentText), options?: RequestHandlerOptions) => {
return http.get('*/api/v1/identity/consent-texts/:purpose', async (info: Parameters<Parameters<typeof http.get>[1]>[0]) => {
return HttpResponse.json(overrideResponse !== undefined
? (typeof overrideResponse === "function" ? await overrideResponse(info) : overrideResponse)
: getGetConsentTextResponseMock(),
{ status: 200
})
}, options)
}
export const getRegisterAccountMockHandler = (overrideResponse?: IdentityRequestAccepted | ((info: Parameters<Parameters<typeof http.post>[1]>[0]) => Promise<IdentityRequestAccepted> | IdentityRequestAccepted), options?: RequestHandlerOptions) => {
return http.post('*/api/v1/identity/registrations', async (info: Parameters<Parameters<typeof http.post>[1]>[0]) => {
return HttpResponse.json(overrideResponse !== undefined
? (typeof overrideResponse === "function" ? await overrideResponse(info) : overrideResponse)
: getRegisterAccountResponseMock(),
{ status: 202
})
}, options)
}
export const getResendEmailVerificationMockHandler = (overrideResponse?: IdentityRequestAccepted | ((info: Parameters<Parameters<typeof http.post>[1]>[0]) => Promise<IdentityRequestAccepted> | IdentityRequestAccepted), options?: RequestHandlerOptions) => {
return http.post('*/api/v1/identity/email-verification-requests', async (info: Parameters<Parameters<typeof http.post>[1]>[0]) => {
return HttpResponse.json(overrideResponse !== undefined
? (typeof overrideResponse === "function" ? await overrideResponse(info) : overrideResponse)
: getResendEmailVerificationResponseMock(),
{ status: 202
})
}, options)
}
export const getConfirmEmailMockHandler = (overrideResponse?: EmailVerificationResult | ((info: Parameters<Parameters<typeof http.post>[1]>[0]) => Promise<EmailVerificationResult> | EmailVerificationResult), options?: RequestHandlerOptions) => {
return http.post('*/api/v1/identity/email-verifications', async (info: Parameters<Parameters<typeof http.post>[1]>[0]) => {
return HttpResponse.json(overrideResponse !== undefined
? (typeof overrideResponse === "function" ? await overrideResponse(info) : overrideResponse)
: getConfirmEmailResponseMock(),
{ status: 200
})
}, options)
}
export const getLoginMockHandler = (overrideResponse?: Session | ((info: Parameters<Parameters<typeof http.post>[1]>[0]) => Promise<Session> | Session), options?: RequestHandlerOptions) => {
return http.post('*/api/v1/identity/sessions', async (info: Parameters<Parameters<typeof http.post>[1]>[0]) => {
return HttpResponse.json(overrideResponse !== undefined
? (typeof overrideResponse === "function" ? await overrideResponse(info) : overrideResponse)
: getLoginResponseMock(),
{ status: 201
})
}, options)
}
export const getGetCurrentSessionMockHandler = (overrideResponse?: Session | ((info: Parameters<Parameters<typeof http.get>[1]>[0]) => Promise<Session> | Session), options?: RequestHandlerOptions) => {
return http.get('*/api/v1/identity/sessions/current', async (info: Parameters<Parameters<typeof http.get>[1]>[0]) => {
return HttpResponse.json(overrideResponse !== undefined
? (typeof overrideResponse === "function" ? await overrideResponse(info) : overrideResponse)
: getGetCurrentSessionResponseMock(),
{ status: 200
})
}, options)
}
export const getLogoutMockHandler = (overrideResponse?: void | ((info: Parameters<Parameters<typeof http.delete>[1]>[0]) => Promise<void> | void), options?: RequestHandlerOptions) => {
return http.delete('*/api/v1/identity/sessions/current', async (info: Parameters<Parameters<typeof http.delete>[1]>[0]) => {
if (typeof overrideResponse === 'function') {await overrideResponse(info); }
return new HttpResponse(null,
{ status: 204
})
}, options)
}
export const getGetCurrentAccountMockHandler = (overrideResponse?: Account | ((info: Parameters<Parameters<typeof http.get>[1]>[0]) => Promise<Account> | Account), options?: RequestHandlerOptions) => {
return http.get('*/api/v1/identity/me', async (info: Parameters<Parameters<typeof http.get>[1]>[0]) => {
return HttpResponse.json(overrideResponse !== undefined
? (typeof overrideResponse === "function" ? await overrideResponse(info) : overrideResponse)
: getGetCurrentAccountResponseMock(),
{ status: 200
})
}, options)
}
export const getIdentityMock = () => [
getGetConsentTextMockHandler(),
getRegisterAccountMockHandler(),
getResendEmailVerificationMockHandler(),
getConfirmEmailMockHandler(),
getLoginMockHandler(),
getGetCurrentSessionMockHandler(),
getLogoutMockHandler(),
getGetCurrentAccountMockHandler()
]
@@ -0,0 +1,821 @@
/**
* Generated by orval 🍺
* Do not edit manually.
* Lincodex API
* OpenAPI spec version: 0.1.0
*/
import {
useMutation,
useQuery
} from '@tanstack/react-query';
import type {
DataTag,
DefinedInitialDataOptions,
DefinedUseQueryResult,
MutationFunction,
QueryClient,
QueryFunction,
QueryKey,
UndefinedInitialDataOptions,
UseMutationOptions,
UseMutationResult,
UseQueryOptions,
UseQueryResult
} from '@tanstack/react-query';
import type {
Account,
ConsentPurpose,
ConsentText,
EmailVerificationRequest,
EmailVerificationResendRequest,
EmailVerificationResult,
IdentityRequestAccepted,
LoginRequest,
Problem,
RegisterAccountHeaders,
RegistrationRequest,
Session
} from '../../schemas';
import { apiRequest } from '../../client';
import type { ErrorType } from '../../client';
type SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];
const withQueryKey = <T extends object, K>(query: T, queryKey: K): T & { queryKey: K } => {
const result = { queryKey } as T & { queryKey: K };
for (const key of Object.keys(query)) {
// The explicit queryKey always wins, matching the previous
// `{ ...query, queryKey }` spread where it was set last.
if (key === 'queryKey') continue;
Object.defineProperty(result, key, {
enumerable: true,
configurable: true,
get: () => (query as Record<string, unknown>)[key],
});
}
return result;
};
export const getGetConsentTextUrl = (purpose: ConsentPurpose,) => {
return `/api/v1/identity/consent-texts/${purpose}`
}
/**
* Public operation without a session. Returns the current text of a consent that is given before an account exists; only `c1` is available. The registration page shows this text and sends its `text_version` with RegisterAccount, and the server hashes the same stored text when it records the acceptance. If the text changes while the page is open, RegisterAccount answers 400 validation_failed with the pointer `/consent_c1/text_version`, and the page reads the text again. An unknown purpose fails parameter validation with 400.
* @summary Read the currently published text of a registration consent.
*/
export const getConsentText = async (purpose: ConsentPurpose, options?: Parameters<typeof apiRequest>[1]): Promise<ConsentText> => {
return apiRequest<ConsentText>(getGetConsentTextUrl(purpose),
{
...options,
method: 'GET'
}
);}
export const getGetConsentTextQueryKey = (purpose: ConsentPurpose,) => {
return [
`/api/v1/identity/consent-texts/${purpose}`
] as const;
}
export const getGetConsentTextQueryOptions = <TData = Awaited<ReturnType<typeof getConsentText>>, TError = ErrorType<Problem>>(purpose: ConsentPurpose, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getConsentText>>, TError, TData>>, request?: SecondParameter<typeof apiRequest>}
) => {
const {query: queryOptions, request: requestOptions} = options ?? {};
const queryKey = queryOptions?.queryKey ?? getGetConsentTextQueryKey(purpose);
const queryFn: QueryFunction<Awaited<ReturnType<typeof getConsentText>>> = ({ signal }) => getConsentText(purpose, { signal, ...requestOptions });
return { queryKey, queryFn, enabled: purpose !== null && purpose !== undefined, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getConsentText>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }
}
export type GetConsentTextQueryResult = NonNullable<Awaited<ReturnType<typeof getConsentText>>>
export type GetConsentTextQueryError = ErrorType<Problem>
export function useGetConsentText<TData = Awaited<ReturnType<typeof getConsentText>>, TError = ErrorType<Problem>>(
purpose: ConsentPurpose, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof getConsentText>>, TError, TData>> & Pick<
DefinedInitialDataOptions<
Awaited<ReturnType<typeof getConsentText>>,
TError,
Awaited<ReturnType<typeof getConsentText>>
> , 'initialData'
>, request?: SecondParameter<typeof apiRequest>}
, queryClient?: QueryClient
): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetConsentText<TData = Awaited<ReturnType<typeof getConsentText>>, TError = ErrorType<Problem>>(
purpose: ConsentPurpose, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getConsentText>>, TError, TData>> & Pick<
UndefinedInitialDataOptions<
Awaited<ReturnType<typeof getConsentText>>,
TError,
Awaited<ReturnType<typeof getConsentText>>
> , 'initialData'
>, request?: SecondParameter<typeof apiRequest>}
, queryClient?: QueryClient
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetConsentText<TData = Awaited<ReturnType<typeof getConsentText>>, TError = ErrorType<Problem>>(
purpose: ConsentPurpose, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getConsentText>>, TError, TData>>, request?: SecondParameter<typeof apiRequest>}
, queryClient?: QueryClient
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
/**
* @summary Read the currently published text of a registration consent.
*/
export function useGetConsentText<TData = Awaited<ReturnType<typeof getConsentText>>, TError = ErrorType<Problem>>(
purpose: ConsentPurpose, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getConsentText>>, TError, TData>>, request?: SecondParameter<typeof apiRequest>}
, queryClient?: QueryClient
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
const queryOptions = getGetConsentTextQueryOptions(purpose,options)
const query = useQuery(queryOptions, queryClient) as UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
return withQueryKey(query, queryOptions.queryKey);
}
export const getRegisterAccountUrl = () => {
return `/api/v1/identity/registrations`
}
/**
* Public operation without a session. The client reads the current C1 text with GetConsentText and sends the email, the password, the chosen scenario, and consent C1 with the version of the text the user accepted.
*
* The answer is the same 202 whether the email is new, registered but not verified, or verified, so registration does not enumerate accounts:
*
* - New email: the server creates an unverified account with the scenario and the first onboarding step, records C1 with its text version and text hash, stores only the hash of a one-time verification token, and queues the verification message, all in one transaction.
* - Registered but not verified: the server treats the request as a new registration of that address. In one transaction it replaces the password hash, the scenario, the onboarding step, and the C1 record, advances the registration version, invalidates every earlier verification token, and queues a message with a new token. A pre-registration with someone else's password therefore never survives the address owner's own registration.
* - Verified: nothing changes. The server may queue a rate-limited "you already have an account" notice to the address.
*
* Every verification token is bound to the registration version it was issued for, so a token issued before a re-registration can never confirm the newer credentials. An account that stays unverified is deleted with its consent record and tokens 7 days after its last registration (planned value from configuration). Verification tokens live 24 hours (planned value from configuration).
*
* The response does not depend on the branch in content or timing. Before it looks up the email, the server validates the whole body, including the password bounds after normalization, the password blocklist, and the C1 version, and it computes the Argon2id hash on every branch; a 400 therefore never depends on whether the email exists. Mail is delivered asynchronously from the outbox.
*
* The operation requires Idempotency-Key. For this anonymous operation the key is scoped by the operation, the key, and an HMAC of the normalized email, and the request fingerprint is an HMAC-SHA-256 with a server secret over the canonical JSON body. The server never stores the body, the password, or a plain hash of either; the secret keeps the fingerprint from serving as an offline password check. A retry with the same key, email, and body replays the stored 202 without a second message; the same key and email with a different body answers 422 idempotency_key_reused.
*
* It is rate-limited per client and per email and answers 429 with Retry-After when the limit is reached. Like every unsafe request, it requires an allowed Origin and answers 403 csrf_check_failed otherwise.
* @summary Register an account by email with a scenario and consent C1.
*/
export const registerAccount = async (registrationRequest: RegistrationRequest,
headers: RegisterAccountHeaders, options?: Parameters<typeof apiRequest>[1]): Promise<IdentityRequestAccepted> => {
const getHeaders = (h?: NonNullable<RequestInit['headers']>): Record<string, string | readonly string[]> => {
if (!h) return {};
if (h instanceof Headers) return Object.fromEntries(h.entries());
if (Symbol.iterator in h) {
return Object.fromEntries(
Array.from(h as Iterable<Iterable<string>>, (entry) => Array.from(entry) as [string, string]),
);
}
const headers: Record<string, string | readonly string[]> = {};
for (const [name, value] of Object.entries<string | readonly string[] | undefined>(h)) {
if (value !== undefined) headers[name] = value;
}
return headers;
};
return apiRequest<IdentityRequestAccepted>(getRegisterAccountUrl(),
{
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json',...headers, ...getHeaders(options?.headers) },
body: JSON.stringify(registrationRequest)
}
);}
export const getRegisterAccountMutationKey = () => ['registerAccount'] as const;
export const getRegisterAccountMutationOptions = <TError = ErrorType<Problem>,
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof registerAccount>>, TError,RegisterAccountMutationVariables, TContext>, request?: SecondParameter<typeof apiRequest>}
): UseMutationOptions<Awaited<ReturnType<typeof registerAccount>>, TError,RegisterAccountMutationVariables, TContext> => {
const mutationKey = getRegisterAccountMutationKey();
const {mutation: mutationOptions, request: requestOptions} = options ?
options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
options
: {...options, mutation: {...options.mutation, mutationKey}}
: {mutation: { mutationKey, }, request: undefined};
const mutationFn: MutationFunction<Awaited<ReturnType<typeof registerAccount>>, RegisterAccountMutationVariables> = (props) => {
const {data,headers} = props ?? {};
return registerAccount(data,headers,requestOptions)
}
return { mutationFn, ...mutationOptions }}
export type RegisterAccountMutationResult = NonNullable<Awaited<ReturnType<typeof registerAccount>>>
export type RegisterAccountMutationBody = RegistrationRequest
export type RegisterAccountMutationError = ErrorType<Problem>
export type RegisterAccountMutationVariables = {data: RegistrationRequest;headers: RegisterAccountHeaders}
/**
* @summary Register an account by email with a scenario and consent C1.
*/
export const useRegisterAccount = <TError = ErrorType<Problem>,
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof registerAccount>>, TError,RegisterAccountMutationVariables, TContext>, request?: SecondParameter<typeof apiRequest>}
, queryClient?: QueryClient): UseMutationResult<
Awaited<ReturnType<typeof registerAccount>>,
TError,
RegisterAccountMutationVariables,
TContext
> => {
return useMutation(getRegisterAccountMutationOptions(options), queryClient);
}
export const getResendEmailVerificationUrl = () => {
return `/api/v1/identity/email-verification-requests`
}
/**
* Public operation without a session. The answer is the same 202 for an unknown email, a verified email, and an unverified one, so it does not enumerate accounts. Only for an unverified account does the server issue a new one-time token bound to the current registration version, invalidate every earlier token of that account, and queue the message. Resend never changes the password, the scenario, or the consent record; a user who did not start the pending registration registers again instead, which replaces it.
*
* It is rate-limited per client and per email and answers 429 with Retry-After when the limit is reached. A retry is safe without Idempotency-Key: at worst it replaces the token again within the rate limit. Like every unsafe request, it requires an allowed Origin and answers 403 csrf_check_failed otherwise.
* @summary Request a new email verification link.
*/
export const resendEmailVerification = async (emailVerificationResendRequest: EmailVerificationResendRequest, options?: Parameters<typeof apiRequest>[1]): Promise<IdentityRequestAccepted> => {
const getHeaders = (h?: NonNullable<RequestInit['headers']>): Record<string, string | readonly string[]> => {
if (!h) return {};
if (h instanceof Headers) return Object.fromEntries(h.entries());
if (Symbol.iterator in h) {
return Object.fromEntries(
Array.from(h as Iterable<Iterable<string>>, (entry) => Array.from(entry) as [string, string]),
);
}
const headers: Record<string, string | readonly string[]> = {};
for (const [name, value] of Object.entries<string | readonly string[] | undefined>(h)) {
if (value !== undefined) headers[name] = value;
}
return headers;
};
return apiRequest<IdentityRequestAccepted>(getResendEmailVerificationUrl(),
{
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...getHeaders(options?.headers) },
body: JSON.stringify(emailVerificationResendRequest)
}
);}
export const getResendEmailVerificationMutationKey = () => ['resendEmailVerification'] as const;
export const getResendEmailVerificationMutationOptions = <TError = ErrorType<Problem>,
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof resendEmailVerification>>, TError,ResendEmailVerificationMutationVariables, TContext>, request?: SecondParameter<typeof apiRequest>}
): UseMutationOptions<Awaited<ReturnType<typeof resendEmailVerification>>, TError,ResendEmailVerificationMutationVariables, TContext> => {
const mutationKey = getResendEmailVerificationMutationKey();
const {mutation: mutationOptions, request: requestOptions} = options ?
options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
options
: {...options, mutation: {...options.mutation, mutationKey}}
: {mutation: { mutationKey, }, request: undefined};
const mutationFn: MutationFunction<Awaited<ReturnType<typeof resendEmailVerification>>, ResendEmailVerificationMutationVariables> = (props) => {
const {data} = props ?? {};
return resendEmailVerification(data,requestOptions)
}
return { mutationFn, ...mutationOptions }}
export type ResendEmailVerificationMutationResult = NonNullable<Awaited<ReturnType<typeof resendEmailVerification>>>
export type ResendEmailVerificationMutationBody = EmailVerificationResendRequest
export type ResendEmailVerificationMutationError = ErrorType<Problem>
export type ResendEmailVerificationMutationVariables = {data: EmailVerificationResendRequest}
/**
* @summary Request a new email verification link.
*/
export const useResendEmailVerification = <TError = ErrorType<Problem>,
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof resendEmailVerification>>, TError,ResendEmailVerificationMutationVariables, TContext>, request?: SecondParameter<typeof apiRequest>}
, queryClient?: QueryClient): UseMutationResult<
Awaited<ReturnType<typeof resendEmailVerification>>,
TError,
ResendEmailVerificationMutationVariables,
TContext
> => {
return useMutation(getResendEmailVerificationMutationOptions(options), queryClient);
}
export const getConfirmEmailUrl = () => {
return `/api/v1/identity/email-verifications`
}
/**
* Public operation without a session. The verification link has the form `<frontend origin>/verify-email#token=<token>`: the token travels in the URL fragment, so it never reaches a server log or a Referer header. The page first removes the fragment with `history.replaceState`, then waits for an explicit user action, such as a Confirm button, before it posts the token here. A link scanner that only fetches the page therefore does not consume the token.
*
* The server looks up the token by its hash and, in one transaction, checks that it is unused, not expired, and bound to the current registration version, marks it used, and marks the email verified. Only one of several parallel requests with the same token succeeds. An expired token answers verification_token_expired; an unknown, used, replaced, or superseded token answers verification_token_invalid; neither changes anything. For both, the client offers a new link and sign-in, because the address may already be verified.
*
* A repeated confirmation with an already used token is not an idempotent 200: exactly one request may succeed for a token, so the outcome of parallel requests stays unambiguous, and the next step after either outcome is sign-in anyway.
*
* Success does not start a session: the link may be opened on another device or by a mail scanner, and a session must come only from the password. The response returns the scenario and the saved onboarding step so the client can continue after sign-in. The operation is rate-limited and requires an allowed Origin.
* @summary Verify an email with the one-time token from the link.
*/
export const confirmEmail = async (emailVerificationRequest: EmailVerificationRequest, options?: Parameters<typeof apiRequest>[1]): Promise<EmailVerificationResult> => {
const getHeaders = (h?: NonNullable<RequestInit['headers']>): Record<string, string | readonly string[]> => {
if (!h) return {};
if (h instanceof Headers) return Object.fromEntries(h.entries());
if (Symbol.iterator in h) {
return Object.fromEntries(
Array.from(h as Iterable<Iterable<string>>, (entry) => Array.from(entry) as [string, string]),
);
}
const headers: Record<string, string | readonly string[]> = {};
for (const [name, value] of Object.entries<string | readonly string[] | undefined>(h)) {
if (value !== undefined) headers[name] = value;
}
return headers;
};
return apiRequest<EmailVerificationResult>(getConfirmEmailUrl(),
{
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...getHeaders(options?.headers) },
body: JSON.stringify(emailVerificationRequest)
}
);}
export const getConfirmEmailMutationKey = () => ['confirmEmail'] as const;
export const getConfirmEmailMutationOptions = <TError = ErrorType<Problem>,
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof confirmEmail>>, TError,ConfirmEmailMutationVariables, TContext>, request?: SecondParameter<typeof apiRequest>}
): UseMutationOptions<Awaited<ReturnType<typeof confirmEmail>>, TError,ConfirmEmailMutationVariables, TContext> => {
const mutationKey = getConfirmEmailMutationKey();
const {mutation: mutationOptions, request: requestOptions} = options ?
options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
options
: {...options, mutation: {...options.mutation, mutationKey}}
: {mutation: { mutationKey, }, request: undefined};
const mutationFn: MutationFunction<Awaited<ReturnType<typeof confirmEmail>>, ConfirmEmailMutationVariables> = (props) => {
const {data} = props ?? {};
return confirmEmail(data,requestOptions)
}
return { mutationFn, ...mutationOptions }}
export type ConfirmEmailMutationResult = NonNullable<Awaited<ReturnType<typeof confirmEmail>>>
export type ConfirmEmailMutationBody = EmailVerificationRequest
export type ConfirmEmailMutationError = ErrorType<Problem>
export type ConfirmEmailMutationVariables = {data: EmailVerificationRequest}
/**
* @summary Verify an email with the one-time token from the link.
*/
export const useConfirmEmail = <TError = ErrorType<Problem>,
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof confirmEmail>>, TError,ConfirmEmailMutationVariables, TContext>, request?: SecondParameter<typeof apiRequest>}
, queryClient?: QueryClient): UseMutationResult<
Awaited<ReturnType<typeof confirmEmail>>,
TError,
ConfirmEmailMutationVariables,
TContext
> => {
return useMutation(getConfirmEmailMutationOptions(options), queryClient);
}
export const getLoginUrl = () => {
return `/api/v1/identity/sessions`
}
/**
* Public operation that starts a server session. The server verifies the password with Argon2id; for an unknown email it verifies against a fixed dummy hash, so the response time does not reveal whether the account exists. An unknown email and a wrong password both answer 401 invalid_credentials.
*
* Correct credentials for an unverified email answer 403 email_not_verified and create no session. This reveals the verification state only to someone who already knows the password, which proves more than the state itself; the client offers to resend the link.
*
* On success the server revokes the session that the request carried, if any, creates a new random session in PostgreSQL with a new identifier and a new CSRF token, sets the HttpOnly session cookie, and returns the account and the CSRF token. The new session follows the idle and absolute timeouts of the sessionCookie scheme. The client keeps the token in memory and sends it in X-CSRF-Token with every mutating request that requires a session.
*
* Login is rate-limited per client and per email and answers 429 with Retry-After. Like every unsafe request, it requires an allowed Origin, which protects against login CSRF, and answers 403 csrf_check_failed otherwise.
* @summary Sign in with email and password and start a session.
*/
export const login = async (loginRequest: LoginRequest, options?: Parameters<typeof apiRequest>[1]): Promise<Session> => {
const getHeaders = (h?: NonNullable<RequestInit['headers']>): Record<string, string | readonly string[]> => {
if (!h) return {};
if (h instanceof Headers) return Object.fromEntries(h.entries());
if (Symbol.iterator in h) {
return Object.fromEntries(
Array.from(h as Iterable<Iterable<string>>, (entry) => Array.from(entry) as [string, string]),
);
}
const headers: Record<string, string | readonly string[]> = {};
for (const [name, value] of Object.entries<string | readonly string[] | undefined>(h)) {
if (value !== undefined) headers[name] = value;
}
return headers;
};
return apiRequest<Session>(getLoginUrl(),
{
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...getHeaders(options?.headers) },
body: JSON.stringify(loginRequest)
}
);}
export const getLoginMutationKey = () => ['login'] as const;
export const getLoginMutationOptions = <TError = ErrorType<Problem>,
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof login>>, TError,LoginMutationVariables, TContext>, request?: SecondParameter<typeof apiRequest>}
): UseMutationOptions<Awaited<ReturnType<typeof login>>, TError,LoginMutationVariables, TContext> => {
const mutationKey = getLoginMutationKey();
const {mutation: mutationOptions, request: requestOptions} = options ?
options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
options
: {...options, mutation: {...options.mutation, mutationKey}}
: {mutation: { mutationKey, }, request: undefined};
const mutationFn: MutationFunction<Awaited<ReturnType<typeof login>>, LoginMutationVariables> = (props) => {
const {data} = props ?? {};
return login(data,requestOptions)
}
return { mutationFn, ...mutationOptions }}
export type LoginMutationResult = NonNullable<Awaited<ReturnType<typeof login>>>
export type LoginMutationBody = LoginRequest
export type LoginMutationError = ErrorType<Problem>
export type LoginMutationVariables = {data: LoginRequest}
/**
* @summary Sign in with email and password and start a session.
*/
export const useLogin = <TError = ErrorType<Problem>,
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof login>>, TError,LoginMutationVariables, TContext>, request?: SecondParameter<typeof apiRequest>}
, queryClient?: QueryClient): UseMutationResult<
Awaited<ReturnType<typeof login>>,
TError,
LoginMutationVariables,
TContext
> => {
return useMutation(getLoginMutationOptions(options), queryClient);
}
export const getGetCurrentSessionUrl = () => {
return `/api/v1/identity/sessions/current`
}
/**
* Requires the session cookie. Returns the account and the CSRF token of the current session, so the client can restore the token after a page reload or after 403 csrf_check_failed. A missing, unknown, expired, or revoked session answers 401 unauthenticated. Cross-origin pages cannot read the token, because the API sends no Access-Control-Allow-Origin header.
* @summary Read the current session and its CSRF token.
*/
export const getCurrentSession = async ( options?: Parameters<typeof apiRequest>[1]): Promise<Session> => {
return apiRequest<Session>(getGetCurrentSessionUrl(),
{
...options,
method: 'GET'
}
);}
export const getGetCurrentSessionQueryKey = () => {
return [
`/api/v1/identity/sessions/current`
] as const;
}
export const getGetCurrentSessionQueryOptions = <TData = Awaited<ReturnType<typeof getCurrentSession>>, TError = ErrorType<Problem>>( options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getCurrentSession>>, TError, TData>>, request?: SecondParameter<typeof apiRequest>}
) => {
const {query: queryOptions, request: requestOptions} = options ?? {};
const queryKey = queryOptions?.queryKey ?? getGetCurrentSessionQueryKey();
const queryFn: QueryFunction<Awaited<ReturnType<typeof getCurrentSession>>> = ({ signal }) => getCurrentSession({ signal, ...requestOptions });
return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getCurrentSession>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }
}
export type GetCurrentSessionQueryResult = NonNullable<Awaited<ReturnType<typeof getCurrentSession>>>
export type GetCurrentSessionQueryError = ErrorType<Problem>
export function useGetCurrentSession<TData = Awaited<ReturnType<typeof getCurrentSession>>, TError = ErrorType<Problem>>(
options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof getCurrentSession>>, TError, TData>> & Pick<
DefinedInitialDataOptions<
Awaited<ReturnType<typeof getCurrentSession>>,
TError,
Awaited<ReturnType<typeof getCurrentSession>>
> , 'initialData'
>, request?: SecondParameter<typeof apiRequest>}
, queryClient?: QueryClient
): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetCurrentSession<TData = Awaited<ReturnType<typeof getCurrentSession>>, TError = ErrorType<Problem>>(
options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getCurrentSession>>, TError, TData>> & Pick<
UndefinedInitialDataOptions<
Awaited<ReturnType<typeof getCurrentSession>>,
TError,
Awaited<ReturnType<typeof getCurrentSession>>
> , 'initialData'
>, request?: SecondParameter<typeof apiRequest>}
, queryClient?: QueryClient
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetCurrentSession<TData = Awaited<ReturnType<typeof getCurrentSession>>, TError = ErrorType<Problem>>(
options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getCurrentSession>>, TError, TData>>, request?: SecondParameter<typeof apiRequest>}
, queryClient?: QueryClient
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
/**
* @summary Read the current session and its CSRF token.
*/
export function useGetCurrentSession<TData = Awaited<ReturnType<typeof getCurrentSession>>, TError = ErrorType<Problem>>(
options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getCurrentSession>>, TError, TData>>, request?: SecondParameter<typeof apiRequest>}
, queryClient?: QueryClient
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
const queryOptions = getGetCurrentSessionQueryOptions(options)
const query = useQuery(queryOptions, queryClient) as UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
return withQueryKey(query, queryOptions.queryKey);
}
export const getLogoutUrl = () => {
return `/api/v1/identity/sessions/current`
}
/**
* Requires the session cookie and the CSRF token of that session in X-CSRF-Token, and an allowed Origin. The server revokes the session in PostgreSQL, so the cookie value stops working even if a copy remains, and clears the cookie. A missing, expired, or revoked session answers 401 unauthenticated and also clears the cookie, so a stale cookie does not stay in the browser; a missing or wrong CSRF token or a disallowed Origin answers 403 csrf_check_failed and keeps the session and the cookie. The client clears its private query cache after the response.
* @summary Sign out and revoke the current session.
*/
export const logout = async ( options?: Parameters<typeof apiRequest>[1]): Promise<void> => {
return apiRequest<void>(getLogoutUrl(),
{
...options,
method: 'DELETE'
}
);}
export const getLogoutMutationKey = () => ['logout'] as const;
export const getLogoutMutationOptions = <TError = ErrorType<Problem>,
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof logout>>, TError,void, TContext>, request?: SecondParameter<typeof apiRequest>}
): UseMutationOptions<Awaited<ReturnType<typeof logout>>, TError,void, TContext> => {
const mutationKey = getLogoutMutationKey();
const {mutation: mutationOptions, request: requestOptions} = options ?
options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
options
: {...options, mutation: {...options.mutation, mutationKey}}
: {mutation: { mutationKey, }, request: undefined};
const mutationFn: MutationFunction<Awaited<ReturnType<typeof logout>>, void> = () => {
return logout(requestOptions)
}
return { mutationFn, ...mutationOptions }}
export type LogoutMutationResult = NonNullable<Awaited<ReturnType<typeof logout>>>
export type LogoutMutationError = ErrorType<Problem>
/**
* @summary Sign out and revoke the current session.
*/
export const useLogout = <TError = ErrorType<Problem>,
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof logout>>, TError,void, TContext>, request?: SecondParameter<typeof apiRequest>}
, queryClient?: QueryClient): UseMutationResult<
Awaited<ReturnType<typeof logout>>,
TError,
void,
TContext
> => {
return useMutation(getLogoutMutationOptions(options), queryClient);
}
export const getGetCurrentAccountUrl = () => {
return `/api/v1/identity/me`
}
/**
* Requires the session cookie. The account comes from the session, never from a request parameter. The client uses `scenario` and `onboarding_step` to return the user to the unfinished onboarding step. A missing, unknown, expired, or revoked session answers 401 unauthenticated. An unverified account never has a session, because login answers 403 email_not_verified for it, so this operation also answers 401 for such an account.
* @summary Read the account of the current session.
*/
export const getCurrentAccount = async ( options?: Parameters<typeof apiRequest>[1]): Promise<Account> => {
return apiRequest<Account>(getGetCurrentAccountUrl(),
{
...options,
method: 'GET'
}
);}
export const getGetCurrentAccountQueryKey = () => {
return [
`/api/v1/identity/me`
] as const;
}
export const getGetCurrentAccountQueryOptions = <TData = Awaited<ReturnType<typeof getCurrentAccount>>, TError = ErrorType<Problem>>( options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getCurrentAccount>>, TError, TData>>, request?: SecondParameter<typeof apiRequest>}
) => {
const {query: queryOptions, request: requestOptions} = options ?? {};
const queryKey = queryOptions?.queryKey ?? getGetCurrentAccountQueryKey();
const queryFn: QueryFunction<Awaited<ReturnType<typeof getCurrentAccount>>> = ({ signal }) => getCurrentAccount({ signal, ...requestOptions });
return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getCurrentAccount>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }
}
export type GetCurrentAccountQueryResult = NonNullable<Awaited<ReturnType<typeof getCurrentAccount>>>
export type GetCurrentAccountQueryError = ErrorType<Problem>
export function useGetCurrentAccount<TData = Awaited<ReturnType<typeof getCurrentAccount>>, TError = ErrorType<Problem>>(
options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof getCurrentAccount>>, TError, TData>> & Pick<
DefinedInitialDataOptions<
Awaited<ReturnType<typeof getCurrentAccount>>,
TError,
Awaited<ReturnType<typeof getCurrentAccount>>
> , 'initialData'
>, request?: SecondParameter<typeof apiRequest>}
, queryClient?: QueryClient
): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetCurrentAccount<TData = Awaited<ReturnType<typeof getCurrentAccount>>, TError = ErrorType<Problem>>(
options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getCurrentAccount>>, TError, TData>> & Pick<
UndefinedInitialDataOptions<
Awaited<ReturnType<typeof getCurrentAccount>>,
TError,
Awaited<ReturnType<typeof getCurrentAccount>>
> , 'initialData'
>, request?: SecondParameter<typeof apiRequest>}
, queryClient?: QueryClient
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetCurrentAccount<TData = Awaited<ReturnType<typeof getCurrentAccount>>, TError = ErrorType<Problem>>(
options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getCurrentAccount>>, TError, TData>>, request?: SecondParameter<typeof apiRequest>}
, queryClient?: QueryClient
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
/**
* @summary Read the account of the current session.
*/
export function useGetCurrentAccount<TData = Awaited<ReturnType<typeof getCurrentAccount>>, TError = ErrorType<Problem>>(
options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getCurrentAccount>>, TError, TData>>, request?: SecondParameter<typeof apiRequest>}
, queryClient?: QueryClient
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
const queryOptions = getGetCurrentAccountQueryOptions(options)
const query = useQuery(queryOptions, queryClient) as UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
return withQueryKey(query, queryOptions.queryKey);
}
@@ -1 +1,2 @@
export { getHealthMock } from './health/health.msw'
export { getIdentityMock } from './identity/identity.msw'
@@ -1 +1,2 @@
export * from './health/health';
export * from './identity/identity';
@@ -6,7 +6,3 @@
*/
export * from './healthResponse.zod';
export * from './problem.zod';
export * from './problemCode.zod';
export * from './problemFieldError.zod';
export * from './problemFieldLocation.zod';
@@ -1,12 +0,0 @@
/**
* Generated by orval 🍺
* Do not edit manually.
* Lincodex API
* OpenAPI spec version: 0.1.0
*/
import * as zod from 'zod';
export const ProblemCode = zod.enum(['validation_failed', 'unauthenticated', 'forbidden', 'not_found', 'method_not_allowed', 'idempotency_in_progress', 'state_conflict', 'version_conflict', 'payload_too_large', 'unsupported_media_type', 'idempotency_key_reused', 'precondition_required', 'rate_limited', 'internal', 'not_implemented']).describe('Stable public error code. Adding a code is a contract change; renaming or removing one is a breaking change. Clients must handle an unknown code by its HTTP status.\n\n- validation_failed (400): parameters or body do not match the contract, or a body violates a domain rule such as salary_from <= salary_to; `errors` points at the fields.\n- unauthenticated (401): no valid session or credentials.\n- forbidden (403): the caller is authenticated but not allowed.\n- not_found (404): the route or object does not exist or is not visible.\n- method_not_allowed (405): the route does not support the method.\n- idempotency_in_progress (409): a request with the same Idempotency-Key is still being processed.\n- state_conflict (409): the operation conflicts with the current state of the resource, for example an invitation that was already accepted.\n- version_conflict (412): If-Match does not match the current version.\n- payload_too_large (413): the request body exceeds the limit.\n- unsupported_media_type (415): the request Content-Type is not accepted.\n- idempotency_key_reused (422): the Idempotency-Key was already used with a different request.\n- precondition_required (428): the operation requires If-Match.\n- rate_limited (429): too many requests; see Retry-After.\n- internal (500): unexpected server error.\n- not_implemented (501): the operation is in the contract but not implemented yet.')
export type ProblemCode = zod.input<typeof ProblemCode>;
export type ProblemCodeOutput = zod.output<typeof ProblemCode>;
@@ -0,0 +1,23 @@
/**
* Generated by orval 🍺
* Do not edit manually.
* Lincodex API
* OpenAPI spec version: 0.1.0
*/
import * as zod from 'zod';
export const accountEmailMin = 3;
export const accountEmailMax = 254;
export const Account = zod.object({
"id": zod.uuid().describe('Account identifier.'),
"email": zod.email().min(accountEmailMin).max(accountEmailMax).describe('Account email address. The server compares addresses without regard to letter case and never reveals in a response whether an address belongs to an account.'),
"email_verified": zod.boolean().describe('Whether the address is verified. A session exists only for a verified account, so this is true in every current response.'),
"scenario": zod.enum(['candidate', 'employer']).describe('Scenario chosen at registration: `candidate` looks for an offer and passes the assessment, `employer` represents a company that searches for candidates. The scenario selects the onboarding steps.'),
"onboarding_step": zod.enum(['candidate_consents', 'candidate_profile', 'candidate_questionnaire', 'candidate_assessment', 'employer_company', 'completed']).describe('Saved onboarding step that the account returns to after login. The server stores it and advances it as each step completes; clients route by it and never set it directly.\n\n- candidate_consents: candidate consents beyond C1, which was given at registration.\n- candidate_profile: candidate profile.\n- candidate_questionnaire: candidate questionnaire.\n- candidate_assessment: choice of the expected grade and the assessment.\n- employer_company: company profile of the employer.\n- completed: onboarding is finished; the client opens the scenario home.\n\nCandidate steps follow the order above and end with completed; the employer has employer_company and then completed. New steps may be added as onboarding grows; adding a value is a contract change.'),
"created_at": zod.iso.datetime({"offset":true}).describe('UTC instant in RFC 3339 format with the Z suffix, for example 2026-10-05T09:30:00Z. Servers always emit UTC. Every date-time field in this contract uses this schema.')
}).describe('Current account view. It never contains password hashes, token hashes, session identifiers, or other storage secrets.')
export type Account = zod.input<typeof Account>;
export type AccountOutput = zod.output<typeof Account>;
@@ -0,0 +1,12 @@
/**
* Generated by orval 🍺
* Do not edit manually.
* Lincodex API
* OpenAPI spec version: 0.1.0
*/
import * as zod from 'zod';
export const AccountScenario = zod.enum(['candidate', 'employer']).describe('Scenario chosen at registration: `candidate` looks for an offer and passes the assessment, `employer` represents a company that searches for candidates. The scenario selects the onboarding steps.')
export type AccountScenario = zod.input<typeof AccountScenario>;
export type AccountScenarioOutput = zod.output<typeof AccountScenario>;
@@ -0,0 +1,20 @@
/**
* Generated by orval 🍺
* Do not edit manually.
* Lincodex API
* OpenAPI spec version: 0.1.0
*/
import * as zod from 'zod';
export const confirmEmailBodyTokenMin = 32;
export const confirmEmailBodyTokenMax = 128;
export const confirmEmailBodyTokenRegExp = new RegExp('^[A-Za-z0-9_-]+$');
export const ConfirmEmailBody = zod.object({
"token": zod.string().min(confirmEmailBodyTokenMin).max(confirmEmailBodyTokenMax).regex(confirmEmailBodyTokenRegExp).describe('One-time raw token copied from the verification link. It is request input only: the server stores only its hash and never returns a token.')
}).describe('Token from the email verification link.')
export type ConfirmEmailBody = zod.input<typeof ConfirmEmailBody>;
export type ConfirmEmailBodyOutput = zod.output<typeof ConfirmEmailBody>;
@@ -0,0 +1,12 @@
/**
* Generated by orval 🍺
* Do not edit manually.
* Lincodex API
* OpenAPI spec version: 0.1.0
*/
import * as zod from 'zod';
export const ConsentPurpose = zod.enum(['c1']).describe('Consent whose text the client may read before an account exists. Only the consents given at registration are listed: `c1` is the consent to the processing of personal data.')
export type ConsentPurpose = zod.input<typeof ConsentPurpose>;
export type ConsentPurposeOutput = zod.output<typeof ConsentPurpose>;
@@ -0,0 +1,24 @@
/**
* Generated by orval 🍺
* Do not edit manually.
* Lincodex API
* OpenAPI spec version: 0.1.0
*/
import * as zod from 'zod';
export const consentTextTextVersionMax = 64;
export const consentTextTextVersionRegExp = new RegExp('^[A-Za-z0-9._-]+$');
export const consentTextTextMax = 100000;
export const ConsentText = zod.object({
"purpose": zod.enum(['c1']).describe('Consent whose text the client may read before an account exists. Only the consents given at registration are listed: `c1` is the consent to the processing of personal data.'),
"text_version": zod.string().min(1).max(consentTextTextVersionMax).regex(consentTextTextVersionRegExp).describe('Identifier of the published consent text that the user saw and accepted. The server stores the acceptance with this version and the hash of its text; the client never sends or receives the hash.'),
"text": zod.string().min(1).max(consentTextTextMax).describe('Full consent text in plain UTF-8; paragraphs are separated by an empty line. The client shows it as text, never as HTML.'),
"published_at": zod.iso.datetime({"offset":true}).describe('UTC instant in RFC 3339 format with the Z suffix, for example 2026-10-05T09:30:00Z. Servers always emit UTC. Every date-time field in this contract uses this schema.')
}).describe('Currently published consent text. The server stores an acceptance with `text_version` and the hash of exactly this text.')
export type ConsentText = zod.input<typeof ConsentText>;
export type ConsentTextOutput = zod.output<typeof ConsentText>;
@@ -0,0 +1,17 @@
/**
* Generated by orval 🍺
* Do not edit manually.
* Lincodex API
* OpenAPI spec version: 0.1.0
*/
import * as zod from 'zod';
export const ConsentTextVersionMax = 64;
export const ConsentTextVersionRegExp = new RegExp('^[A-Za-z0-9._-]+$');
export const ConsentTextVersion = zod.string().min(1).max(ConsentTextVersionMax).regex(ConsentTextVersionRegExp).describe('Identifier of the published consent text that the user saw and accepted. The server stores the acceptance with this version and the hash of its text; the client never sends or receives the hash.')
export type ConsentTextVersion = zod.input<typeof ConsentTextVersion>;
export type ConsentTextVersionOutput = zod.output<typeof ConsentTextVersion>;
@@ -0,0 +1,18 @@
/**
* Generated by orval 🍺
* Do not edit manually.
* Lincodex API
* OpenAPI spec version: 0.1.0
*/
import * as zod from 'zod';
export const CsrfTokenMin = 32;
export const CsrfTokenMax = 128;
export const CsrfTokenRegExp = new RegExp('^[A-Za-z0-9_-]+$');
export const CsrfToken = zod.string().min(CsrfTokenMin).max(CsrfTokenMax).regex(CsrfTokenRegExp).describe('CSRF token bound to the current session. The client keeps it in memory only and sends it in the X-CSRF-Token header of every mutating request that requires a session. It changes when a new session starts.')
export type CsrfToken = zod.input<typeof CsrfToken>;
export type CsrfTokenOutput = zod.output<typeof CsrfToken>;
@@ -0,0 +1,16 @@
/**
* Generated by orval 🍺
* Do not edit manually.
* Lincodex API
* OpenAPI spec version: 0.1.0
*/
import * as zod from 'zod';
export const EmailAddressMin = 3;
export const EmailAddressMax = 254;
export const EmailAddress = zod.email().min(EmailAddressMin).max(EmailAddressMax).describe('Account email address. The server compares addresses without regard to letter case and never reveals in a response whether an address belongs to an account.')
export type EmailAddress = zod.input<typeof EmailAddress>;
export type EmailAddressOutput = zod.output<typeof EmailAddress>;
@@ -0,0 +1,20 @@
/**
* Generated by orval 🍺
* Do not edit manually.
* Lincodex API
* OpenAPI spec version: 0.1.0
*/
import * as zod from 'zod';
export const emailVerificationRequestTokenMin = 32;
export const emailVerificationRequestTokenMax = 128;
export const emailVerificationRequestTokenRegExp = new RegExp('^[A-Za-z0-9_-]+$');
export const EmailVerificationRequest = zod.object({
"token": zod.string().min(emailVerificationRequestTokenMin).max(emailVerificationRequestTokenMax).regex(emailVerificationRequestTokenRegExp).describe('One-time raw token copied from the verification link. It is request input only: the server stores only its hash and never returns a token.')
}).describe('Token from the email verification link.')
export type EmailVerificationRequest = zod.input<typeof EmailVerificationRequest>;
export type EmailVerificationRequestOutput = zod.output<typeof EmailVerificationRequest>;
@@ -0,0 +1,18 @@
/**
* Generated by orval 🍺
* Do not edit manually.
* Lincodex API
* OpenAPI spec version: 0.1.0
*/
import * as zod from 'zod';
export const emailVerificationResendRequestEmailMin = 3;
export const emailVerificationResendRequestEmailMax = 254;
export const EmailVerificationResendRequest = zod.object({
"email": zod.email().min(emailVerificationResendRequestEmailMin).max(emailVerificationResendRequestEmailMax).describe('Account email address. The server compares addresses without regard to letter case and never reveals in a response whether an address belongs to an account.')
}).describe('Address that should receive a new verification link.')
export type EmailVerificationResendRequest = zod.input<typeof EmailVerificationResendRequest>;
export type EmailVerificationResendRequestOutput = zod.output<typeof EmailVerificationResendRequest>;
@@ -0,0 +1,16 @@
/**
* Generated by orval 🍺
* Do not edit manually.
* Lincodex API
* OpenAPI spec version: 0.1.0
*/
import * as zod from 'zod';
export const EmailVerificationResult = zod.object({
"email_verified": zod.literal(true).describe('Always true in a successful response.'),
"scenario": zod.enum(['candidate', 'employer']).describe('Scenario chosen at registration: `candidate` looks for an offer and passes the assessment, `employer` represents a company that searches for candidates. The scenario selects the onboarding steps.'),
"onboarding_step": zod.enum(['candidate_consents', 'candidate_profile', 'candidate_questionnaire', 'candidate_assessment', 'employer_company', 'completed']).describe('Saved onboarding step that the account returns to after login. The server stores it and advances it as each step completes; clients route by it and never set it directly.\n\n- candidate_consents: candidate consents beyond C1, which was given at registration.\n- candidate_profile: candidate profile.\n- candidate_questionnaire: candidate questionnaire.\n- candidate_assessment: choice of the expected grade and the assessment.\n- employer_company: company profile of the employer.\n- completed: onboarding is finished; the client opens the scenario home.\n\nCandidate steps follow the order above and end with completed; the employer has employer_company and then completed. New steps may be added as onboarding grows; adding a value is a contract change.')
}).describe('Result of a successful email verification. It does not start a session; the user signs in next and continues from `onboarding_step`.')
export type EmailVerificationResult = zod.input<typeof EmailVerificationResult>;
export type EmailVerificationResultOutput = zod.output<typeof EmailVerificationResult>;
@@ -0,0 +1,14 @@
/**
* Generated by orval 🍺
* Do not edit manually.
* Lincodex API
* OpenAPI spec version: 0.1.0
*/
import * as zod from 'zod';
export const IdentityRequestAccepted = zod.object({
"status": zod.enum(['accepted'])
}).describe('Neutral acknowledgement. Its content is identical whether or not the address belongs to an account or is already verified, so the response does not enumerate accounts. The client tells the user to check the mailbox.')
export type IdentityRequestAccepted = zod.input<typeof IdentityRequestAccepted>;
export type IdentityRequestAcceptedOutput = zod.output<typeof IdentityRequestAccepted>;
@@ -0,0 +1,32 @@
/**
* Generated by orval 🍺
* Do not edit manually.
* Lincodex API
* OpenAPI spec version: 0.1.0
*/
export * from './account.zod';
export * from './accountScenario.zod';
export * from './confirmEmailBody.zod';
export * from './consentPurpose.zod';
export * from './consentText.zod';
export * from './consentTextVersion.zod';
export * from './csrfToken.zod';
export * from './emailAddress.zod';
export * from './emailVerificationRequest.zod';
export * from './emailVerificationResendRequest.zod';
export * from './emailVerificationResult.zod';
export * from './identityRequestAccepted.zod';
export * from './loginBody.zod';
export * from './loginPassword.zod';
export * from './loginRequest.zod';
export * from './newPassword.zod';
export * from './onboardingStep.zod';
export * from './personalDataConsentAcceptance.zod';
export * from './registerAccountBody.zod';
export * from './registerAccountHeaders.zod';
export * from './registrationRequest.zod';
export * from './resendEmailVerificationBody.zod';
export * from './session.zod';
export * from './timestamp.zod';
export * from './verificationToken.zod';
@@ -0,0 +1,21 @@
/**
* Generated by orval 🍺
* Do not edit manually.
* Lincodex API
* OpenAPI spec version: 0.1.0
*/
import * as zod from 'zod';
export const loginBodyEmailMin = 3;
export const loginBodyEmailMax = 254;
export const loginBodyPasswordMax = 128;
export const LoginBody = zod.object({
"email": zod.email().min(loginBodyEmailMin).max(loginBodyEmailMax).describe('Account email address. The server compares addresses without regard to letter case and never reveals in a response whether an address belongs to an account.'),
"password": zod.string().min(1).max(loginBodyPasswordMax).describe('Password entered at login. The server applies the same NFKC normalization as at registration before it verifies the hash. Only the hashing bound applies, so a later change of the registration policy does not lock out existing accounts and a login error does not reveal the policy. The value is never returned, logged, or echoed in a problem.')
}).describe('Email and password of the account.')
export type LoginBody = zod.input<typeof LoginBody>;
export type LoginBodyOutput = zod.output<typeof LoginBody>;
@@ -0,0 +1,15 @@
/**
* Generated by orval 🍺
* Do not edit manually.
* Lincodex API
* OpenAPI spec version: 0.1.0
*/
import * as zod from 'zod';
export const LoginPasswordMax = 128;
export const LoginPassword = zod.string().min(1).max(LoginPasswordMax).describe('Password entered at login. The server applies the same NFKC normalization as at registration before it verifies the hash. Only the hashing bound applies, so a later change of the registration policy does not lock out existing accounts and a login error does not reveal the policy. The value is never returned, logged, or echoed in a problem.')
export type LoginPassword = zod.input<typeof LoginPassword>;
export type LoginPasswordOutput = zod.output<typeof LoginPassword>;
@@ -0,0 +1,21 @@
/**
* Generated by orval 🍺
* Do not edit manually.
* Lincodex API
* OpenAPI spec version: 0.1.0
*/
import * as zod from 'zod';
export const loginRequestEmailMin = 3;
export const loginRequestEmailMax = 254;
export const loginRequestPasswordMax = 128;
export const LoginRequest = zod.object({
"email": zod.email().min(loginRequestEmailMin).max(loginRequestEmailMax).describe('Account email address. The server compares addresses without regard to letter case and never reveals in a response whether an address belongs to an account.'),
"password": zod.string().min(1).max(loginRequestPasswordMax).describe('Password entered at login. The server applies the same NFKC normalization as at registration before it verifies the hash. Only the hashing bound applies, so a later change of the registration policy does not lock out existing accounts and a login error does not reveal the policy. The value is never returned, logged, or echoed in a problem.')
}).describe('Email and password of the account.')
export type LoginRequest = zod.input<typeof LoginRequest>;
export type LoginRequestOutput = zod.output<typeof LoginRequest>;
@@ -0,0 +1,16 @@
/**
* Generated by orval 🍺
* Do not edit manually.
* Lincodex API
* OpenAPI spec version: 0.1.0
*/
import * as zod from 'zod';
export const NewPasswordMin = 15;
export const NewPasswordMax = 128;
export const NewPassword = zod.string().min(NewPasswordMin).max(NewPasswordMax).describe('Password chosen at registration. The server normalizes it to Unicode NFKC, as NIST SP 800-63B-4 recommends, and then requires 15 to 128 Unicode code points; a value that the schema accepts can still fail this check after normalization. The 15-character minimum follows NIST SP 800-63B-4 for a password used as the only authentication factor; there are no composition rules. The upper bound limits the cost of password hashing. Generated client validators count UTF-16 code units, so a password with characters outside the Basic Multilingual Plane can pass the client check and fail on the server; a later client check should count code points. A password on the server blocklist of common or breached passwords answers 400 validation_failed with the pointer `/password`. The value is never returned, logged, or echoed in a problem.')
export type NewPassword = zod.input<typeof NewPassword>;
export type NewPasswordOutput = zod.output<typeof NewPassword>;
@@ -0,0 +1,12 @@
/**
* Generated by orval 🍺
* Do not edit manually.
* Lincodex API
* OpenAPI spec version: 0.1.0
*/
import * as zod from 'zod';
export const OnboardingStep = zod.enum(['candidate_consents', 'candidate_profile', 'candidate_questionnaire', 'candidate_assessment', 'employer_company', 'completed']).describe('Saved onboarding step that the account returns to after login. The server stores it and advances it as each step completes; clients route by it and never set it directly.\n\n- candidate_consents: candidate consents beyond C1, which was given at registration.\n- candidate_profile: candidate profile.\n- candidate_questionnaire: candidate questionnaire.\n- candidate_assessment: choice of the expected grade and the assessment.\n- employer_company: company profile of the employer.\n- completed: onboarding is finished; the client opens the scenario home.\n\nCandidate steps follow the order above and end with completed; the employer has employer_company and then completed. New steps may be added as onboarding grows; adding a value is a contract change.')
export type OnboardingStep = zod.input<typeof OnboardingStep>;
export type OnboardingStepOutput = zod.output<typeof OnboardingStep>;
@@ -0,0 +1,20 @@
/**
* Generated by orval 🍺
* Do not edit manually.
* Lincodex API
* OpenAPI spec version: 0.1.0
*/
import * as zod from 'zod';
export const personalDataConsentAcceptanceTextVersionMax = 64;
export const personalDataConsentAcceptanceTextVersionRegExp = new RegExp('^[A-Za-z0-9._-]+$');
export const PersonalDataConsentAcceptance = zod.object({
"text_version": zod.string().min(1).max(personalDataConsentAcceptanceTextVersionMax).regex(personalDataConsentAcceptanceTextVersionRegExp).describe('Identifier of the published consent text that the user saw and accepted. The server stores the acceptance with this version and the hash of its text; the client never sends or receives the hash.'),
"accepted": zod.literal(true).describe('Explicit acceptance. Only true is valid.')
}).describe('Consent C1 to the processing of personal data, given at registration. The client reads the current text and its version with GetConsentText(c1) and sends that version here. A version that is not the currently published one answers 400 validation_failed with the pointer `/consent_c1/text_version`; the client then reads the text again and asks the user to accept the new version. Unknown fields are rejected, so registration cannot carry any other consent; in particular, C4 is never part of registration.')
export type PersonalDataConsentAcceptance = zod.input<typeof PersonalDataConsentAcceptance>;
export type PersonalDataConsentAcceptanceOutput = zod.output<typeof PersonalDataConsentAcceptance>;
@@ -0,0 +1,31 @@
/**
* Generated by orval 🍺
* Do not edit manually.
* Lincodex API
* OpenAPI spec version: 0.1.0
*/
import * as zod from 'zod';
export const registerAccountBodyEmailMin = 3;
export const registerAccountBodyEmailMax = 254;
export const registerAccountBodyPasswordMin = 15;
export const registerAccountBodyPasswordMax = 128;
export const registerAccountBodyConsentC1TextVersionMax = 64;
export const registerAccountBodyConsentC1TextVersionRegExp = new RegExp('^[A-Za-z0-9._-]+$');
export const RegisterAccountBody = zod.object({
"email": zod.email().min(registerAccountBodyEmailMin).max(registerAccountBodyEmailMax).describe('Account email address. The server compares addresses without regard to letter case and never reveals in a response whether an address belongs to an account.'),
"password": zod.string().min(registerAccountBodyPasswordMin).max(registerAccountBodyPasswordMax).describe('Password chosen at registration. The server normalizes it to Unicode NFKC, as NIST SP 800-63B-4 recommends, and then requires 15 to 128 Unicode code points; a value that the schema accepts can still fail this check after normalization. The 15-character minimum follows NIST SP 800-63B-4 for a password used as the only authentication factor; there are no composition rules. The upper bound limits the cost of password hashing. Generated client validators count UTF-16 code units, so a password with characters outside the Basic Multilingual Plane can pass the client check and fail on the server; a later client check should count code points. A password on the server blocklist of common or breached passwords answers 400 validation_failed with the pointer `/password`. The value is never returned, logged, or echoed in a problem.'),
"scenario": zod.enum(['candidate', 'employer']).describe('Scenario chosen at registration: `candidate` looks for an offer and passes the assessment, `employer` represents a company that searches for candidates. The scenario selects the onboarding steps.'),
"consent_c1": zod.object({
"text_version": zod.string().min(1).max(registerAccountBodyConsentC1TextVersionMax).regex(registerAccountBodyConsentC1TextVersionRegExp).describe('Identifier of the published consent text that the user saw and accepted. The server stores the acceptance with this version and the hash of its text; the client never sends or receives the hash.'),
"accepted": zod.literal(true).describe('Explicit acceptance. Only true is valid.')
}).describe('Consent C1 to the processing of personal data, given at registration. The client reads the current text and its version with GetConsentText(c1) and sends that version here. A version that is not the currently published one answers 400 validation_failed with the pointer `/consent_c1/text_version`; the client then reads the text again and asks the user to accept the new version. Unknown fields are rejected, so registration cannot carry any other consent; in particular, C4 is never part of registration.')
}).describe('New account with its scenario and consent C1.')
export type RegisterAccountBody = zod.input<typeof RegisterAccountBody>;
export type RegisterAccountBodyOutput = zod.output<typeof RegisterAccountBody>;
@@ -0,0 +1,19 @@
/**
* Generated by orval 🍺
* Do not edit manually.
* Lincodex API
* OpenAPI spec version: 0.1.0
*/
import * as zod from 'zod';
export const registerAccountHeadersIdempotencyKeyMax = 255;
export const registerAccountHeadersIdempotencyKeyRegExp = new RegExp('^[A-Za-z0-9._:-]+$');
export const RegisterAccountHeaders = zod.object({
"Idempotency-Key": zod.string().min(1).max(registerAccountHeadersIdempotencyKeyMax).regex(registerAccountHeadersIdempotencyKeyRegExp)
})
export type RegisterAccountHeaders = zod.input<typeof RegisterAccountHeaders>;
export type RegisterAccountHeadersOutput = zod.output<typeof RegisterAccountHeaders>;
@@ -0,0 +1,31 @@
/**
* Generated by orval 🍺
* Do not edit manually.
* Lincodex API
* OpenAPI spec version: 0.1.0
*/
import * as zod from 'zod';
export const registrationRequestEmailMin = 3;
export const registrationRequestEmailMax = 254;
export const registrationRequestPasswordMin = 15;
export const registrationRequestPasswordMax = 128;
export const registrationRequestConsentC1TextVersionMax = 64;
export const registrationRequestConsentC1TextVersionRegExp = new RegExp('^[A-Za-z0-9._-]+$');
export const RegistrationRequest = zod.object({
"email": zod.email().min(registrationRequestEmailMin).max(registrationRequestEmailMax).describe('Account email address. The server compares addresses without regard to letter case and never reveals in a response whether an address belongs to an account.'),
"password": zod.string().min(registrationRequestPasswordMin).max(registrationRequestPasswordMax).describe('Password chosen at registration. The server normalizes it to Unicode NFKC, as NIST SP 800-63B-4 recommends, and then requires 15 to 128 Unicode code points; a value that the schema accepts can still fail this check after normalization. The 15-character minimum follows NIST SP 800-63B-4 for a password used as the only authentication factor; there are no composition rules. The upper bound limits the cost of password hashing. Generated client validators count UTF-16 code units, so a password with characters outside the Basic Multilingual Plane can pass the client check and fail on the server; a later client check should count code points. A password on the server blocklist of common or breached passwords answers 400 validation_failed with the pointer `/password`. The value is never returned, logged, or echoed in a problem.'),
"scenario": zod.enum(['candidate', 'employer']).describe('Scenario chosen at registration: `candidate` looks for an offer and passes the assessment, `employer` represents a company that searches for candidates. The scenario selects the onboarding steps.'),
"consent_c1": zod.object({
"text_version": zod.string().min(1).max(registrationRequestConsentC1TextVersionMax).regex(registrationRequestConsentC1TextVersionRegExp).describe('Identifier of the published consent text that the user saw and accepted. The server stores the acceptance with this version and the hash of its text; the client never sends or receives the hash.'),
"accepted": zod.literal(true).describe('Explicit acceptance. Only true is valid.')
}).describe('Consent C1 to the processing of personal data, given at registration. The client reads the current text and its version with GetConsentText(c1) and sends that version here. A version that is not the currently published one answers 400 validation_failed with the pointer `/consent_c1/text_version`; the client then reads the text again and asks the user to accept the new version. Unknown fields are rejected, so registration cannot carry any other consent; in particular, C4 is never part of registration.')
}).describe('New account with its scenario and consent C1.')
export type RegistrationRequest = zod.input<typeof RegistrationRequest>;
export type RegistrationRequestOutput = zod.output<typeof RegistrationRequest>;
@@ -0,0 +1,18 @@
/**
* Generated by orval 🍺
* Do not edit manually.
* Lincodex API
* OpenAPI spec version: 0.1.0
*/
import * as zod from 'zod';
export const resendEmailVerificationBodyEmailMin = 3;
export const resendEmailVerificationBodyEmailMax = 254;
export const ResendEmailVerificationBody = zod.object({
"email": zod.email().min(resendEmailVerificationBodyEmailMin).max(resendEmailVerificationBodyEmailMax).describe('Account email address. The server compares addresses without regard to letter case and never reveals in a response whether an address belongs to an account.')
}).describe('Address that should receive a new verification link.')
export type ResendEmailVerificationBody = zod.input<typeof ResendEmailVerificationBody>;
export type ResendEmailVerificationBodyOutput = zod.output<typeof ResendEmailVerificationBody>;
@@ -0,0 +1,31 @@
/**
* Generated by orval 🍺
* Do not edit manually.
* Lincodex API
* OpenAPI spec version: 0.1.0
*/
import * as zod from 'zod';
export const sessionAccountEmailMin = 3;
export const sessionAccountEmailMax = 254;
export const sessionCsrfTokenMin = 32;
export const sessionCsrfTokenMax = 128;
export const sessionCsrfTokenRegExp = new RegExp('^[A-Za-z0-9_-]+$');
export const Session = zod.object({
"account": zod.object({
"id": zod.uuid().describe('Account identifier.'),
"email": zod.email().min(sessionAccountEmailMin).max(sessionAccountEmailMax).describe('Account email address. The server compares addresses without regard to letter case and never reveals in a response whether an address belongs to an account.'),
"email_verified": zod.boolean().describe('Whether the address is verified. A session exists only for a verified account, so this is true in every current response.'),
"scenario": zod.enum(['candidate', 'employer']).describe('Scenario chosen at registration: `candidate` looks for an offer and passes the assessment, `employer` represents a company that searches for candidates. The scenario selects the onboarding steps.'),
"onboarding_step": zod.enum(['candidate_consents', 'candidate_profile', 'candidate_questionnaire', 'candidate_assessment', 'employer_company', 'completed']).describe('Saved onboarding step that the account returns to after login. The server stores it and advances it as each step completes; clients route by it and never set it directly.\n\n- candidate_consents: candidate consents beyond C1, which was given at registration.\n- candidate_profile: candidate profile.\n- candidate_questionnaire: candidate questionnaire.\n- candidate_assessment: choice of the expected grade and the assessment.\n- employer_company: company profile of the employer.\n- completed: onboarding is finished; the client opens the scenario home.\n\nCandidate steps follow the order above and end with completed; the employer has employer_company and then completed. New steps may be added as onboarding grows; adding a value is a contract change.'),
"created_at": zod.iso.datetime({"offset":true}).describe('UTC instant in RFC 3339 format with the Z suffix, for example 2026-10-05T09:30:00Z. Servers always emit UTC. Every date-time field in this contract uses this schema.')
}).describe('Current account view. It never contains password hashes, token hashes, session identifiers, or other storage secrets.'),
"csrf_token": zod.string().min(sessionCsrfTokenMin).max(sessionCsrfTokenMax).regex(sessionCsrfTokenRegExp).describe('CSRF token bound to the current session. The client keeps it in memory only and sends it in the X-CSRF-Token header of every mutating request that requires a session. It changes when a new session starts.')
}).describe('Current session as the client may see it: the account and the CSRF token. The session identifier itself travels only in the HttpOnly session cookie and never appears in a body.')
export type Session = zod.input<typeof Session>;
export type SessionOutput = zod.output<typeof Session>;
@@ -0,0 +1,18 @@
/**
* Generated by orval 🍺
* Do not edit manually.
* Lincodex API
* OpenAPI spec version: 0.1.0
*/
import * as zod from 'zod';
export const VerificationTokenMin = 32;
export const VerificationTokenMax = 128;
export const VerificationTokenRegExp = new RegExp('^[A-Za-z0-9_-]+$');
export const VerificationToken = zod.string().min(VerificationTokenMin).max(VerificationTokenMax).regex(VerificationTokenRegExp).describe('One-time raw token copied from the verification link. It is request input only: the server stores only its hash and never returns a token.')
export type VerificationToken = zod.input<typeof VerificationToken>;
export type VerificationTokenOutput = zod.output<typeof VerificationToken>;
+5 -1
View File
@@ -6,5 +6,9 @@
*/
export * from './pageInfo.zod';
export * from './timestamp.zod';
export * from './problem.zod';
export * from './problemCode.zod';
export * from './problemFieldError.zod';
export * from './problemFieldLocation.zod';
export * from './health';
export * from './identity';
@@ -38,7 +38,7 @@ export const Problem = zod.object({
"type": zod.string().max(problemTypeMax).describe('URI that identifies the problem type. It has the form `urn:lincodex:problem:<code>` and is an identifier, not a link to dereference.'),
"title": zod.string().min(1).max(problemTitleMax).describe('Short, fixed English summary of the problem type. It does not change between occurrences.'),
"status": zod.int().min(problemStatusMin).max(problemStatusMax).describe('HTTP status code generated by the origin server.'),
"code": zod.enum(['validation_failed', 'unauthenticated', 'forbidden', 'not_found', 'method_not_allowed', 'idempotency_in_progress', 'state_conflict', 'version_conflict', 'payload_too_large', 'unsupported_media_type', 'idempotency_key_reused', 'precondition_required', 'rate_limited', 'internal', 'not_implemented']).describe('Stable public error code. Adding a code is a contract change; renaming or removing one is a breaking change. Clients must handle an unknown code by its HTTP status.\n\n- validation_failed (400): parameters or body do not match the contract, or a body violates a domain rule such as salary_from <= salary_to; `errors` points at the fields.\n- unauthenticated (401): no valid session or credentials.\n- forbidden (403): the caller is authenticated but not allowed.\n- not_found (404): the route or object does not exist or is not visible.\n- method_not_allowed (405): the route does not support the method.\n- idempotency_in_progress (409): a request with the same Idempotency-Key is still being processed.\n- state_conflict (409): the operation conflicts with the current state of the resource, for example an invitation that was already accepted.\n- version_conflict (412): If-Match does not match the current version.\n- payload_too_large (413): the request body exceeds the limit.\n- unsupported_media_type (415): the request Content-Type is not accepted.\n- idempotency_key_reused (422): the Idempotency-Key was already used with a different request.\n- precondition_required (428): the operation requires If-Match.\n- rate_limited (429): too many requests; see Retry-After.\n- internal (500): unexpected server error.\n- not_implemented (501): the operation is in the contract but not implemented yet.'),
"code": zod.enum(['validation_failed', 'verification_token_invalid', 'verification_token_expired', 'unauthenticated', 'invalid_credentials', 'forbidden', 'email_not_verified', 'csrf_check_failed', 'not_found', 'method_not_allowed', 'idempotency_in_progress', 'state_conflict', 'version_conflict', 'payload_too_large', 'unsupported_media_type', 'idempotency_key_reused', 'precondition_required', 'rate_limited', 'internal', 'not_implemented']).describe('Stable public error code. Adding a code is a contract change; renaming or removing one is a breaking change. Clients must handle an unknown code by its HTTP status.\n\n- validation_failed (400): parameters or body do not match the contract, or a body violates a domain rule such as salary_from <= salary_to; `errors` points at the fields.\n- verification_token_invalid (400): the email verification token is unknown, already used, or replaced by a newer one; request a new link or sign in.\n- verification_token_expired (400): the email verification token is past its lifetime; request a new link.\n- unauthenticated (401): no valid session or credentials.\n- invalid_credentials (401): the email and password do not match an account; an unknown email and a wrong password are not distinguished.\n- forbidden (403): the caller is authenticated but not allowed.\n- email_not_verified (403): the credentials are correct but the email is not verified yet.\n- csrf_check_failed (403): the request failed cross-site request protection: a missing or wrong X-CSRF-Token or a disallowed Origin.\n- not_found (404): the route or object does not exist or is not visible.\n- method_not_allowed (405): the route does not support the method.\n- idempotency_in_progress (409): a request with the same Idempotency-Key is still being processed.\n- state_conflict (409): the operation conflicts with the current state of the resource, for example an invitation that was already accepted.\n- version_conflict (412): If-Match does not match the current version.\n- payload_too_large (413): the request body exceeds the limit.\n- unsupported_media_type (415): the request Content-Type is not accepted.\n- idempotency_key_reused (422): the Idempotency-Key was already used with a different request.\n- precondition_required (428): the operation requires If-Match.\n- rate_limited (429): too many requests; see Retry-After.\n- internal (500): unexpected server error.\n- not_implemented (501): the operation is in the contract but not implemented yet.'),
"detail": zod.string().max(problemDetailMax).exactOptional().describe('Safe English explanation of this occurrence. It never contains internal error text or request values.'),
"instance": zod.string().max(problemInstanceMax).exactOptional().describe('URI reference that identifies this occurrence, when one exists.'),
"trace_id": zod.string().min(1).max(problemTraceIdMax).regex(problemTraceIdRegExp).exactOptional().describe('Request identifier, equal to the X-Request-ID response header. Quote it when reporting the problem; it is not a secret.'),
@@ -0,0 +1,12 @@
/**
* Generated by orval 🍺
* Do not edit manually.
* Lincodex API
* OpenAPI spec version: 0.1.0
*/
import * as zod from 'zod';
export const ProblemCode = zod.enum(['validation_failed', 'verification_token_invalid', 'verification_token_expired', 'unauthenticated', 'invalid_credentials', 'forbidden', 'email_not_verified', 'csrf_check_failed', 'not_found', 'method_not_allowed', 'idempotency_in_progress', 'state_conflict', 'version_conflict', 'payload_too_large', 'unsupported_media_type', 'idempotency_key_reused', 'precondition_required', 'rate_limited', 'internal', 'not_implemented']).describe('Stable public error code. Adding a code is a contract change; renaming or removing one is a breaking change. Clients must handle an unknown code by its HTTP status.\n\n- validation_failed (400): parameters or body do not match the contract, or a body violates a domain rule such as salary_from <= salary_to; `errors` points at the fields.\n- verification_token_invalid (400): the email verification token is unknown, already used, or replaced by a newer one; request a new link or sign in.\n- verification_token_expired (400): the email verification token is past its lifetime; request a new link.\n- unauthenticated (401): no valid session or credentials.\n- invalid_credentials (401): the email and password do not match an account; an unknown email and a wrong password are not distinguished.\n- forbidden (403): the caller is authenticated but not allowed.\n- email_not_verified (403): the credentials are correct but the email is not verified yet.\n- csrf_check_failed (403): the request failed cross-site request protection: a missing or wrong X-CSRF-Token or a disallowed Origin.\n- not_found (404): the route or object does not exist or is not visible.\n- method_not_allowed (405): the route does not support the method.\n- idempotency_in_progress (409): a request with the same Idempotency-Key is still being processed.\n- state_conflict (409): the operation conflicts with the current state of the resource, for example an invitation that was already accepted.\n- version_conflict (412): If-Match does not match the current version.\n- payload_too_large (413): the request body exceeds the limit.\n- unsupported_media_type (415): the request Content-Type is not accepted.\n- idempotency_key_reused (422): the Idempotency-Key was already used with a different request.\n- precondition_required (428): the operation requires If-Match.\n- rate_limited (429): too many requests; see Retry-After.\n- internal (500): unexpected server error.\n- not_implemented (501): the operation is in the contract but not implemented yet.')
export type ProblemCode = zod.input<typeof ProblemCode>;
export type ProblemCodeOutput = zod.output<typeof ProblemCode>;