Login works

This commit is contained in:
Ebenezer
2026-03-27 15:44:21 +08:00
parent d5c75c9f5c
commit e7816f78f3
1185 changed files with 198529 additions and 34 deletions

View File

@@ -0,0 +1,36 @@
export declare class InvariantError extends Error {
constructor(message: string);
}
/**
* Provide a condition and if that condition is falsey, this throws an error
* with the given message.
*
* inspired by invariant from 'tiny-invariant' except will still include the
* message in production.
*
* @example
* invariant(typeof value === 'string', `value must be a string`)
*
* @param condition The condition to check
* @param message The message to throw (or a callback to generate the message)
* @param responseInit Additional response init options if a response is thrown
*
* @throws {InvariantError} if condition is falsey
*/
export declare function invariant(condition: any, message: string | (() => string)): asserts condition;
/**
* Provide a condition and if that condition is falsey, this throws a 400
* Response with the given message.
*
* inspired by invariant from 'tiny-invariant'
*
* @example
* invariantResponse(typeof value === 'string', `value must be a string`)
*
* @param condition The condition to check
* @param message The message to throw (or a callback to generate the message)
* @param responseInit Additional response init options if a response is thrown
*
* @throws {Response} if condition is falsey
*/
export declare function invariantResponse(condition: any, message: string | (() => string), responseInit?: ResponseInit): asserts condition;

50
backend/node_modules/@epic-web/invariant/dist/index.js generated vendored Normal file
View File

@@ -0,0 +1,50 @@
export class InvariantError extends Error {
constructor(message) {
super(message);
Object.setPrototypeOf(this, InvariantError.prototype);
}
}
/**
* Provide a condition and if that condition is falsey, this throws an error
* with the given message.
*
* inspired by invariant from 'tiny-invariant' except will still include the
* message in production.
*
* @example
* invariant(typeof value === 'string', `value must be a string`)
*
* @param condition The condition to check
* @param message The message to throw (or a callback to generate the message)
* @param responseInit Additional response init options if a response is thrown
*
* @throws {InvariantError} if condition is falsey
*/
export function invariant(condition, message) {
if (!condition) {
throw new InvariantError(typeof message === 'function' ? message() : message);
}
}
/**
* Provide a condition and if that condition is falsey, this throws a 400
* Response with the given message.
*
* inspired by invariant from 'tiny-invariant'
*
* @example
* invariantResponse(typeof value === 'string', `value must be a string`)
*
* @param condition The condition to check
* @param message The message to throw (or a callback to generate the message)
* @param responseInit Additional response init options if a response is thrown
*
* @throws {Response} if condition is falsey
*/
export function invariantResponse(condition, message, responseInit) {
if (!condition) {
throw new Response(typeof message === 'function' ? message() : message, {
status: 400,
...responseInit,
});
}
}