@venizia/ignis-helpers/common
Generated from the built declarations by
vulcan x atlas api gen- do not edit.
57 exports, 57 with TSDoc. 7 more are re-exported from other entries (listed at the end).
ClassResolver
class
Resolves a class reference that may be given directly, lazily through a resolver function, or as a string binding key.
export declare class ClassResolver {
/** Resolves a class reference, passing through string binding keys as-is. */
static resolveClass<T>(opts: {
ref: TClass<T> | TResolver<TClass<T>> | string;
}): TClass<T> | string;
}Source: packages/helpers/src/common/resolvers.ts
ConstClass
class
Base of a const class: a class whose static readonly string members are its values. Extend it and the class reads its own values (values) and checks a candidate against them (isValid), so no class keeps a SCHEME_SET and an isValid of its own.
Example class ArtifactTypes extends ConstClass { static readonly SERVICE = 'service'; static readonly COMPONENT = 'component'; } ArtifactTypes.isValid(input); // narrows input to 'service' | 'component' z.enum(ArtifactTypes.values());
export declare class ConstClass {
#private;
/** The string values of this class and of the classes it extends, base class first. Throws when there are none. */
static values<T extends typeof ConstClass>(this: T): readonly [TConstValue<T>, ...TConstValue<T>[]];
/** `true` when `value` is one of this class's values; narrows it to their union. */
static isValid<T extends typeof ConstClass>(this: T, value: unknown): value is TConstValue<T>;
}Source: packages/helpers/src/common/const-class.ts
CONTENT_TYPE_BY_EXTENSION
const
Published before the table moved onto the class; kept as the one-line delegate it now is.
export declare const CONTENT_TYPE_BY_EXTENSION: Readonly<Partial<Record<string, TContentType>>>;Source: packages/helpers/src/common/constants/mime.ts
ContentDispositionTypes
class
How a client treats a download: ATTACHMENT saves it, INLINE shows it.
export declare class ContentDispositionTypes extends ConstClass {
static readonly ATTACHMENT = "attachment";
static readonly INLINE = "inline";
}Source: packages/helpers/src/common/constants/http.ts
ContentTypes
class
Full content types, as they go on the wire. MimeTypes holds only the top-level part.
export declare class ContentTypes extends ConstClass {
static readonly OCTET_STREAM = "application/octet-stream";
static readonly PNG = "image/png";
static readonly JPEG = "image/jpeg";
static readonly GIF = "image/gif";
static readonly WEBP = "image/webp";
static readonly SVG = "image/svg+xml";
static readonly PDF = "application/pdf";
static readonly JSON = "application/json";
static readonly PLAIN_TEXT = "text/plain";
static readonly HTML = "text/html";
static readonly CSS = "text/css";
static readonly JAVASCRIPT = "text/javascript";
static readonly MP4 = "video/mp4";
static readonly WEBM = "video/webm";
static readonly MPEG_AUDIO = "audio/mpeg";
static readonly WAV = "audio/wav";
static readonly ZIP = "application/zip";
static readonly CSV = "text/csv";
static readonly XML = "application/xml";
static readonly XLSX = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
static readonly XLS = "application/vnd.ms-excel";
static readonly DOCX = "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
static readonly DOC = "application/msword";
static readonly PPTX = "application/vnd.openxmlformats-officedocument.presentationml.presentation";
static readonly PPT = "application/vnd.ms-powerpoint";
static readonly ODT = "application/vnd.oasis.opendocument.text";
static readonly ODS = "application/vnd.oasis.opendocument.spreadsheet";
}Source: packages/helpers/src/common/constants/mime.ts
ContentTypeTable
class
The extension table and the lookup that reads it, together - the DurationMultipliers shape.
export declare class ContentTypeTable {
/** `satisfies` makes the table total; the declared `string` key keeps a lookup cast-free. */
static readonly BY_EXTENSION: Readonly<Partial<Record<string, TContentType>>>;
/**
* The content type an object name implies. `node:path` is deliberately not used: this file is
* reachable from the browser-pure `./common` subpath, and an extension is the tail after the last
* dot either way.
*/
static resolve(opts: {
filename: string;
}): TContentType;
}Source: packages/helpers/src/common/constants/mime.ts
DataTypes
class
The value kinds a stored field can hold.
export declare class DataTypes {
static readonly NUMBER = "NUMBER";
static readonly TEXT = "TEXT";
static readonly BYTE = "BYTE";
static readonly JSON = "JSON";
static readonly BOOLEAN = "BOOLEAN";
}Source: packages/helpers/src/common/constants/app.ts
Defaults
class
Application-wide defaults: the application name and the paging values of a list query.
export declare class Defaults {
/**
* The application name; reads `APP_ENV_APPLICATION_NAME`.
* @default 'APP'
*/
static readonly APPLICATION_NAME: string;
/**
* Rows a list query returns.
* @default 50
*/
static readonly QUERY_LIMIT = 50;
/**
* Rows a list query skips.
* @default 0
*/
static readonly QUERY_OFFSET = 0;
}Source: packages/helpers/src/common/constants/app.ts
DurationAliases
class
Written spellings that resolve to a unit. Member names are the spelling, upper-cased - so {@link resolve} upper-cases its input and reads one property, with no second table to keep in step.
M is MINUTE and MO is MONTH - the same choice every duration library makes, and the one ambiguity a reader will trip on. There is no single-letter month.
export declare class DurationAliases {
static readonly MS = "millisecond";
static readonly MSEC = "millisecond";
static readonly MILLISECOND = "millisecond";
static readonly MILLISECONDS = "millisecond";
static readonly S = "second";
static readonly SEC = "second";
static readonly SECOND = "second";
static readonly SECONDS = "second";
static readonly M = "minute";
static readonly MIN = "minute";
static readonly MINUTE = "minute";
static readonly MINUTES = "minute";
static readonly H = "hour";
static readonly HR = "hour";
static readonly HOUR = "hour";
static readonly HOURS = "hour";
static readonly D = "day";
static readonly DAY = "day";
static readonly DAYS = "day";
static readonly W = "week";
static readonly WK = "week";
static readonly WEEK = "week";
static readonly WEEKS = "week";
static readonly MO = "month";
static readonly MON = "month";
static readonly MONTH = "month";
static readonly MONTHS = "month";
static readonly Y = "year";
static readonly YR = "year";
static readonly YEAR = "year";
static readonly YEARS = "year";
/** Resolves a written unit - `'d'`, `'days'`, `'DAY'` - to its canonical name, or `null`. */
static resolve(input: string): TDurationUnit | null;
}Source: packages/helpers/src/common/constants/duration.ts
DurationMultipliers
class
A month is 30 days and a year 365, nominal. These size a WINDOW - a grace period, a cache TTL, a near-expiry horizon - and must never compute a calendar date: adding MONTH to 31 January lands on 2 March in a leap year and 3 March otherwise. Use a date library for calendar arithmetic.
export declare class DurationMultipliers {
static readonly MILLISECOND = 1;
static readonly SECOND: number;
static readonly MINUTE: number;
static readonly HOUR: number;
static readonly DAY: number;
static readonly WEEK: number;
static readonly MONTH: number;
static readonly YEAR: number;
static readonly BY_UNIT: Record<string, number>;
/** The multiplier of a known unit, `null` for anything else - inherited property names included. */
private static multiplierOf;
/**
* `null` rather than a throw, so a caller that wants an error raises its own with its own context.
* Every method here answers the same way.
*
* The unit is checked against {@link DurationUnits.isValid} first: a plain-object read alone
* would answer `'constructor'` or `'toString'` with a member of `Object.prototype`, not `undefined`.
*/
static toMilliseconds(opts: IDuration | null): number | null;
/** The inverse of {@link toMilliseconds}. Fractional on purpose - rounding here would silently lose a 36-hour window asked for in days. */
static fromMilliseconds(opts: {
milliseconds: number;
unit: TDurationUnit;
}): number | null;
/** Unit to unit, through milliseconds. Fractional, for the reason {@link fromMilliseconds} gives. */
static convert(opts: {
value: number;
from: TDurationUnit;
to: TDurationUnit;
}): number | null;
/** Reads a written duration - `'30d'`, `'1500 ms'`, `'2 hours'` - into {@link IDuration}. Aliases and the `M`/`MO` rule are on {@link DurationAliases}. */
static parse(input: string): IDuration | null;
/** `'30d'` straight to milliseconds - the shape a TTL or a grace period is usually configured in. */
static parseToMilliseconds(input: string): number | null;
}Source: packages/helpers/src/common/constants/duration.ts
DurationUnits
class
The time units a duration can be expressed in, smallest first.
export declare class DurationUnits extends ConstClass {
static readonly MILLISECOND = "millisecond";
static readonly SECOND = "second";
static readonly MINUTE = "minute";
static readonly HOUR = "hour";
static readonly DAY = "day";
static readonly WEEK = "week";
static readonly MONTH = "month";
static readonly YEAR = "year";
}Source: packages/helpers/src/common/constants/duration.ts
FieldMappingDataTypes
class
The value kinds a field mapping reads.
export declare class FieldMappingDataTypes {
static readonly STRING = "string";
static readonly NUMBER = "number";
static readonly STRINGS = "strings";
static readonly NUMBERS = "numbers";
static readonly BOOLEAN = "boolean";
}Source: packages/helpers/src/common/types/field-mapping.ts
FileExtensions
class
The leading dot is part of the value: path.extname returns one.
export declare class FileExtensions extends ConstClass {
static readonly PNG = ".png";
static readonly JPG = ".jpg";
static readonly JPEG = ".jpeg";
static readonly GIF = ".gif";
static readonly WEBP = ".webp";
static readonly SVG = ".svg";
static readonly PDF = ".pdf";
static readonly JSON = ".json";
static readonly TXT = ".txt";
static readonly HTML = ".html";
static readonly CSS = ".css";
static readonly JS = ".js";
static readonly MP4 = ".mp4";
static readonly WEBM = ".webm";
static readonly MP3 = ".mp3";
static readonly WAV = ".wav";
static readonly ZIP = ".zip";
static readonly CSV = ".csv";
static readonly XML = ".xml";
static readonly XLSX = ".xlsx";
static readonly XLS = ".xls";
static readonly DOCX = ".docx";
static readonly DOC = ".doc";
static readonly PPTX = ".pptx";
static readonly PPT = ".ppt";
static readonly ODT = ".odt";
static readonly ODS = ".ods";
}Source: packages/helpers/src/common/constants/mime.ts
GRPC
class
gRPC constants: call kinds, protocol headers and header values, and the numeric status codes by name.
export declare class GRPC {
/** Standard gRPC methods (lowercase). */
static readonly Methods: {
readonly UNARY: "unary";
readonly SERVER_STREAMING: "server_streaming";
readonly CLIENT_STREAMING: "client_streaming";
readonly BIDI_STREAMING: "bidi_streaming";
};
/** Standard gRPC protocol headers (PROTOCOL-HTTP2.md). */
static readonly Headers: {
readonly CONTENT_TYPE: "content-type";
readonly TE: "te";
readonly USER_AGENT: "user-agent";
readonly GRPC_TIMEOUT: "grpc-timeout";
readonly GRPC_ENCODING: "grpc-encoding";
readonly GRPC_ACCEPT_ENCODING: "grpc-accept-encoding";
readonly GRPC_MESSAGE_TYPE: "grpc-message-type";
readonly GRPC_STATUS: "grpc-status";
readonly GRPC_MESSAGE: "grpc-message";
readonly GRPC_STATUS_DETAILS_BIN: "grpc-status-details-bin";
readonly GRPC_PREVIOUS_RPC_ATTEMPTS: "grpc-previous-rpc-attempts";
readonly GRPC_RETRY_PUSHBACK_MS: "grpc-retry-pushback-ms";
readonly GRPC_TRACE_BIN: "grpc-trace-bin";
readonly GRPC_TAGS_BIN: "grpc-tags-bin";
};
/** gRPC MIME / Content-Type values. */
static readonly HeaderValues: {
readonly GRPC: "application/grpc";
readonly GRPC_PROTO: "application/grpc+proto";
readonly GRPC_JSON: "application/grpc+json";
readonly GRPC_WEB: "application/grpc-web";
readonly GRPC_WEB_PROTO: "application/grpc-web+proto";
readonly GRPC_WEB_JSON: "application/grpc-web+json";
readonly GRPC_WEB_TEXT: "application/grpc-web-text";
};
/** Standard gRPC status codes (google.rpc.Code). */
static readonly ResultCodes: {
readonly OK: 0;
readonly CANCELLED: 1;
readonly UNKNOWN: 2;
readonly INVALID_ARGUMENT: 3;
readonly DEADLINE_EXCEEDED: 4;
readonly NOT_FOUND: 5;
readonly ALREADY_EXISTS: 6;
readonly PERMISSION_DENIED: 7;
readonly RESOURCE_EXHAUSTED: 8;
readonly FAILED_PRECONDITION: 9;
readonly ABORTED: 10;
readonly OUT_OF_RANGE: 11;
readonly UNIMPLEMENTED: 12;
readonly INTERNAL: 13;
readonly UNAVAILABLE: 14;
readonly DATA_LOSS: 15;
readonly UNAUTHENTICATED: 16;
};
}Source: packages/helpers/src/common/constants/grpc.ts
HTTP
class
HTTP constants: header names, CORS headers, header values, methods, protocols and status codes. Header names, methods and protocols are lowercase.
export declare class HTTP {
/** Standard and common HTTP headers (lowercase per HTTP/2 convention). */
static readonly Headers: {
readonly CONTENT_DISPOSITION: "content-disposition";
readonly CONTENT_ENCODING: "content-encoding";
readonly CONTENT_LENGTH: "content-length";
readonly CONTENT_TYPE: "content-type";
readonly CONTENT_RANGE: "content-range";
readonly CONTENT_SECURITY_POLICY: "content-security-policy";
readonly ACCEPT_RANGES: "accept-ranges";
readonly RANGE: "range";
readonly ACCEPT: "accept";
readonly ACCEPT_ENCODING: "accept-encoding";
readonly ACCEPT_LANGUAGE: "accept-language";
readonly AUTHORIZATION: "authorization";
readonly COOKIE: "cookie";
readonly HOST: "host";
readonly IF_MATCH: "if-match";
readonly IF_MODIFIED_SINCE: "if-modified-since";
readonly IF_NONE_MATCH: "if-none-match";
readonly ORIGIN: "origin";
readonly REFERER: "referer";
readonly USER_AGENT: "user-agent";
readonly ALLOW: "allow";
readonly CACHE_CONTROL: "cache-control";
readonly ETAG: "etag";
readonly LAST_MODIFIED: "last-modified";
readonly LOCATION: "location";
readonly RETRY_AFTER: "retry-after";
readonly SET_COOKIE: "set-cookie";
readonly VARY: "vary";
readonly WWW_AUTHENTICATE: "www-authenticate";
readonly ACCESS_CONTROL_ALLOW_CREDENTIALS: "access-control-allow-credentials";
readonly ACCESS_CONTROL_ALLOW_HEADERS: "access-control-allow-headers";
readonly ACCESS_CONTROL_ALLOW_METHODS: "access-control-allow-methods";
readonly ACCESS_CONTROL_ALLOW_ORIGIN: "access-control-allow-origin";
readonly ACCESS_CONTROL_EXPOSE_HEADERS: "access-control-expose-headers";
readonly ACCESS_CONTROL_MAX_AGE: "access-control-max-age";
readonly ACCESS_CONTROL_REQUEST_HEADERS: "access-control-request-headers";
readonly ACCESS_CONTROL_REQUEST_METHOD: "access-control-request-method";
readonly CONNECTION: "connection";
readonly TRANSFER_ENCODING: "transfer-encoding";
readonly UPGRADE: "upgrade";
readonly STRICT_TRANSPORT_SECURITY: "strict-transport-security";
readonly X_CONTENT_TYPE_OPTIONS: "x-content-type-options";
readonly X_FRAME_OPTIONS: "x-frame-options";
readonly FORWARDED: "forwarded";
readonly X_FORWARDED_FOR: "x-forwarded-for";
readonly X_FORWARDED_HOST: "x-forwarded-host";
readonly X_FORWARDED_PROTO: "x-forwarded-proto";
readonly X_REAL_IP: "x-real-ip";
readonly X_RATELIMIT_LIMIT: "x-ratelimit-limit";
readonly X_RATELIMIT_REMAINING: "x-ratelimit-remaining";
readonly X_RATELIMIT_RESET: "x-ratelimit-reset";
readonly REQUEST_TRACING_ID: "x-request-id";
readonly REQUEST_DEVICE_INFO: "x-device-info";
readonly REQUEST_CHANNEL: "x-request-channel";
readonly REQUEST_COUNT_DATA: "x-request-count";
readonly REQUEST_EXTRA: "x-request-extra";
readonly RESPONSE_COUNT_DATA: "x-response-count";
readonly RESPONSE_FORMAT: "x-response-format";
readonly RESPONSE_EXTRA: "x-response-extra";
readonly AUTH_PROVIDER: "x-auth-provider";
readonly LOCALE: "x-locale";
readonly TIMEZONE: "timezone";
readonly TIMEZONE_OFFSET: "timezone-offset";
};
/**
* The headers IGNIS adds to a request and to a response, for a CORS configuration that lists them
* by hand: spread `ALLOW` into the allowed request headers and `EXPOSE` into the exposed ones, so
* a header IGNIS adds later needs no change there.
*/
static readonly CorsHeaders: {
readonly ALLOW: readonly ["x-request-id", "x-request-count", "x-request-extra", "x-request-channel", "x-device-info"];
readonly EXPOSE: readonly ["content-range", "x-request-id", "x-response-count", "x-response-format", "x-response-extra"];
};
/** Common MIME / Content-Type values. */
static readonly HeaderValues: {
readonly APPLICATION_FORM_URLENCODED: "application/x-www-form-urlencoded";
readonly APPLICATION_GRAPHQL_JSON: "application/graphql+json";
readonly APPLICATION_GZIP: "application/gzip";
readonly APPLICATION_JAVASCRIPT: "application/javascript";
readonly APPLICATION_JSON: "application/json";
/** A JSON body with its charset named, the value a client sends by default. */
readonly APPLICATION_JSON_UTF8: "application/json; charset=utf-8";
readonly APPLICATION_MSGPACK: "application/msgpack";
readonly APPLICATION_NDJSON: "application/x-ndjson";
readonly APPLICATION_OCTET_STREAM: "application/octet-stream";
readonly APPLICATION_PDF: "application/pdf";
readonly APPLICATION_PROTOBUF: "application/x-protobuf";
readonly APPLICATION_XML: "application/xml";
readonly APPLICATION_ZIP: "application/zip";
readonly MULTIPART_FORM_DATA: "multipart/form-data";
readonly TEXT_CSS: "text/css";
readonly TEXT_CSV: "text/csv";
readonly TEXT_EVENT_STREAM: "text/event-stream";
readonly TEXT_HTML: "text/html";
readonly TEXT_PLAIN: "text/plain";
readonly TEXT_XML: "text/xml";
readonly IMAGE_GIF: "image/gif";
readonly IMAGE_JPEG: "image/jpeg";
readonly IMAGE_PNG: "image/png";
readonly IMAGE_SVG: "image/svg+xml";
readonly IMAGE_WEBP: "image/webp";
readonly RANGE_UNIT_BYTES: "bytes";
};
/** Standard HTTP methods (lowercase). */
static readonly Methods: {
readonly GET: "get";
readonly POST: "post";
readonly PUT: "put";
readonly PATCH: "patch";
readonly DELETE: "delete";
readonly HEAD: "head";
readonly OPTIONS: "options";
readonly QUERY: "query";
};
/** Standard HTTP protocols (lowercase). */
static readonly Protocols: {
readonly HTTP: "http";
readonly HTTPS: "https";
};
/** HTTP status codes grouped by class (1xx - 5xx). */
static readonly ResultCodes: {
/** 1xx - Informational. */
readonly RS_1: {
readonly Continue: 100;
readonly SwitchingProtocols: 101;
readonly EarlyHints: 103;
};
/** 2xx - Success. */
readonly RS_2: {
readonly Ok: 200;
readonly Created: 201;
readonly Accepted: 202;
readonly NonAuthoritativeInformation: 203;
readonly NoContent: 204;
readonly ResetContent: 205;
readonly PartialContent: 206;
readonly MultiStatus: 207;
};
/** 3xx - Redirection. */
readonly RS_3: {
readonly MovedPermanently: 301;
readonly Found: 302;
readonly NotModified: 304;
readonly TemporaryRedirect: 307;
readonly PermanentRedirect: 308;
};
/** 4xx - Client error. */
readonly RS_4: {
readonly BadRequest: 400;
readonly Unauthorized: 401;
readonly PaymentRequired: 402;
readonly Forbidden: 403;
readonly NotFound: 404;
readonly MethodNotAllowed: 405;
readonly NotAcceptable: 406;
readonly RequestTimeout: 408;
readonly Conflict: 409;
readonly Gone: 410;
readonly LengthRequired: 411;
readonly PreconditionFailed: 412;
readonly ContentTooLarge: 413;
readonly URITooLong: 414;
readonly UnsupportedMediaType: 415;
readonly RangeNotSatisfiable: 416;
readonly ExpectationFailed: 417;
readonly UnprocessableEntity: 422;
readonly Locked: 423;
readonly FailedDependency: 424;
readonly TooEarly: 425;
readonly UpgradeRequired: 426;
readonly PreconditionRequired: 428;
readonly TooManyRequests: 429;
readonly RequestHeaderFieldsTooLarge: 431;
readonly UnavailableForLegalReasons: 451;
};
/** 5xx - Server error. */
readonly RS_5: {
readonly InternalServerError: 500;
readonly NotImplemented: 501;
readonly BadGateway: 502;
readonly ServiceUnavailable: 503;
readonly GatewayTimeout: 504;
readonly HTTPVersionNotSupported: 505;
readonly InsufficientStorage: 507;
readonly LoopDetected: 508;
readonly NetworkAuthenticationRequired: 511;
};
};
}Source: packages/helpers/src/common/constants/http.ts
IConfigurable
interface
Something set up by a configure call, which may be asynchronous.
export interface IConfigurable<Options extends object = object, Result = unknown> {
configure(opts?: Options): ValueOrPromise<Result>;
}Source: packages/helpers/src/common/types/injection.ts
IDuration
interface
A parsed duration: a value counted in unit. The value may be negative or fractional.
export interface IDuration {
unit: TDurationUnit;
value: number;
}Source: packages/helpers/src/common/constants/duration.ts
IFieldMapping
interface
Describes one field to read: its name, its value type, and an optional default.
export interface IFieldMapping {
name: string;
type: TFieldMappingDataType;
default?: string | number | Array<string> | Array<number> | boolean;
}Source: packages/helpers/src/common/types/field-mapping.ts
MimeTypes
class
The top-level part of a MIME type (image, video, text), plus unknown. For the full content type see ContentTypes.
export declare class MimeTypes {
static readonly UNKNOWN = "unknown";
static readonly IMAGE = "image";
static readonly VIDEO = "video";
static readonly TEXT = "text";
}Source: packages/helpers/src/common/constants/mime.ts
REDACTED
const
The placeholder that replaces a secret value in redacted output.
export declare const REDACTED = "[REDACTED]";Source: packages/helpers/src/common/redact.ts
RedactUtility
class
Makes a log argument safe to print: masks secret-looking keys, breaks cycles, caps long strings and strips URL credentials. APP_ENV_LOGGER_DO_REDACT=false turns off the key masking only.
export declare class RedactUtility {
/**
* Redacts every secret-looking KEY (not value shape - buffers/typed arrays are summarized, not
* serialized). `APP_ENV_LOGGER_DO_REDACT=false` makes this the identity function.
*
* `depth` bounds the walk, exactly as {@link RedactUtility.toJsonSafe} already does. It defaults to
* `Infinity` for callers that really do want the whole graph, but the logger passes its own bound:
* rendering only inspects a handful of levels, so walking to `Infinity` did work whose result was
* thrown away - 12x on a deep graph, and a `RangeError` on a very deep chain.
*
* `force: true` masks secret-looking KEYS even when `APP_ENV_LOGGER_DO_REDACT=false`. The result is still the
* log-shaped copy: long strings are capped, a second reference to one object reads `[Circular]`, binary is
* summarized, and a key is masked by name only (a card number under `number` is not). It is not a faithful
* redacted document. The logger never sets it.
*/
static redactSecrets(opts: {
value: unknown;
seen?: WeakSet<object>;
depth?: number;
force?: boolean;
}): unknown;
/** Masks the credentials a plain string carries (a url's password, a bearer token, credential query parameters). For a log line's string argument; objects go through {@link RedactUtility.redactSecrets}. `force: true` scrubs even when `APP_ENV_LOGGER_DO_REDACT=false`. */
static scrubText(opts: {
value: string;
force?: boolean;
}): string;
/** Projects a value into something `JSON.stringify` can render: it answers `[Circular]` for the WHOLE payload when one cycle sits anywhere inside it, so cycles must be broken per-branch first. `depth` bounds the walk the way `util.inspect` does - a log argument may hold a live connector or request context, whose graph is effectively unbounded. The projection itself is unconditional: `APP_ENV_LOGGER_DO_REDACT=false` turns off the key masking, never the structural pass. `force: true` keeps the key masking on whatever the switch says; the projection stays lossy, as in {@link RedactUtility.redactSecrets}. */
static toJsonSafe(opts: {
value: unknown;
depth?: number;
force?: boolean;
}): unknown;
/** Strips credentials from a connection URL's authority section (`user:hunter2@host` -> `user:[REDACTED]@host`) - {@link RedactUtility.redactSecrets} matches on KEY names and can't see them there. A value that fails to parse as a URL is returned unchanged. `force: true` strips even when `APP_ENV_LOGGER_DO_REDACT=false`. */
static redactUrlCredentials(opts: {
url: string;
force?: boolean;
}): string;
}Source: packages/helpers/src/common/redact.ts
RuntimeModules
class
IGNIS runs on Bun only: detect() answers 'bun' there and undefined anywhere else (a browser, another runtime).
export declare class RuntimeModules {
static readonly BUN = "bun";
static detect(): TRuntimeModule | undefined;
static isBun(): boolean;
}Source: packages/helpers/src/common/constants/app.ts
TAbstractClass
type
An abstract class producing T.
export type TAbstractClass<T> = TAbstractConstructor<T>;Source: packages/helpers/src/common/types/class.ts
TAbstractConstructor
type
An abstract class constructor producing T; it cannot be called with new directly.
export type TAbstractConstructor<T> = abstract new (...args: never[]) => T;Source: packages/helpers/src/common/types/class.ts
TAbstractMixinConstructor
type
The abstract form of {@link TMixinConstructor}.
export type TAbstractMixinConstructor<T> = abstract new (...args: any[]) => T;Source: packages/helpers/src/common/types/class.ts
TAbstractMixinTarget
type
TMixinTarget for an abstract base class.
export type TAbstractMixinTarget<T> = TAbstractMixinConstructor<{
[P in keyof T]: T[P];
}>;Source: packages/helpers/src/common/types/class.ts
TClass
type
A concrete class producing T. Read its static members through a type that declares them, such as typeof MyClass.
export type TClass<T> = TConstructor<T>;Source: packages/helpers/src/common/types/class.ts
TConstructor
type
A concrete class constructor producing T.
export type TConstructor<T> = new (...args: never[]) => T;Source: packages/helpers/src/common/types/class.ts
TConstValue
type
The string and number values held by the static readonly members of const class T, as a plain union.
export type TConstValue<T extends TClass<unknown>> = Extract<ValueOf<T>, string | number> & {};Source: packages/helpers/src/common/types/const-value.ts
TContentDispositionType
type
Valid Content-Disposition type values.
export type TContentDispositionType = TConstValue<typeof ContentDispositionTypes>;Source: packages/helpers/src/common/constants/http.ts
TContentType
type
One of the ContentTypes values.
export type TContentType = TConstValue<typeof ContentTypes>;Source: packages/helpers/src/common/constants/mime.ts
TDurationUnit
type
One of the DurationUnits values, e.g. 'second'.
export type TDurationUnit = TConstValue<typeof DurationUnits>;Source: packages/helpers/src/common/constants/duration.ts
TFieldMappingDataType
type
Valid field mapping data type values.
export type TFieldMappingDataType = TConstValue<typeof FieldMappingDataTypes>;Source: packages/helpers/src/common/types/field-mapping.ts
TFieldMappingNames
type
The union of name values in a list of field mappings.
export type TFieldMappingNames<T extends Array<IFieldMapping>> = Extract<T[number], {
type: Exclude<T[number]['type'], undefined>;
}>['name'];Source: packages/helpers/src/common/types/field-mapping.ts
TFileExtension
type
One of the FileExtensions values, with its leading dot.
export type TFileExtension = TConstValue<typeof FileExtensions>;Source: packages/helpers/src/common/constants/mime.ts
TGrpcMethod
type
A gRPC call kind from GRPC.Methods, lowercase.
export type TGrpcMethod = ValueOf<typeof GRPC.Methods>;
/** gRPC constants: call kinds, protocol headers and header values, and the numeric status codes by name. */
export declare class GRPC {
/** Standard gRPC methods (lowercase). */
static readonly Methods: {
readonly UNARY: "unary";
readonly SERVER_STREAMING: "server_streaming";
readonly CLIENT_STREAMING: "client_streaming";
readonly BIDI_STREAMING: "bidi_streaming";
};
/** Standard gRPC protocol headers (PROTOCOL-HTTP2.md). */
static readonly Headers: {
readonly CONTENT_TYPE: "content-type";
readonly TE: "te";
readonly USER_AGENT: "user-agent";
readonly GRPC_TIMEOUT: "grpc-timeout";
readonly GRPC_ENCODING: "grpc-encoding";
readonly GRPC_ACCEPT_ENCODING: "grpc-accept-encoding";
readonly GRPC_MESSAGE_TYPE: "grpc-message-type";
readonly GRPC_STATUS: "grpc-status";
readonly GRPC_MESSAGE: "grpc-message";
readonly GRPC_STATUS_DETAILS_BIN: "grpc-status-details-bin";
readonly GRPC_PREVIOUS_RPC_ATTEMPTS: "grpc-previous-rpc-attempts";
readonly GRPC_RETRY_PUSHBACK_MS: "grpc-retry-pushback-ms";
readonly GRPC_TRACE_BIN: "grpc-trace-bin";
readonly GRPC_TAGS_BIN: "grpc-tags-bin";
};
/** gRPC MIME / Content-Type values. */
static readonly HeaderValues: {
readonly GRPC: "application/grpc";
readonly GRPC_PROTO: "application/grpc+proto";
readonly GRPC_JSON: "application/grpc+json";
readonly GRPC_WEB: "application/grpc-web";
readonly GRPC_WEB_PROTO: "application/grpc-web+proto";
readonly GRPC_WEB_JSON: "application/grpc-web+json";
readonly GRPC_WEB_TEXT: "application/grpc-web-text";
};
/** Standard gRPC status codes (google.rpc.Code). */
static readonly ResultCodes: {
readonly OK: 0;
readonly CANCELLED: 1;
readonly UNKNOWN: 2;
readonly INVALID_ARGUMENT: 3;
readonly DEADLINE_EXCEEDED: 4;
readonly NOT_FOUND: 5;
readonly ALREADY_EXISTS: 6;
readonly PERMISSION_DENIED: 7;
readonly RESOURCE_EXHAUSTED: 8;
readonly FAILED_PRECONDITION: 9;
readonly ABORTED: 10;
readonly OUT_OF_RANGE: 11;
readonly UNIMPLEMENTED: 12;
readonly INTERNAL: 13;
readonly UNAVAILABLE: 14;
readonly DATA_LOSS: 15;
readonly UNAUTHENTICATED: 16;
};
}Source: packages/helpers/src/common/constants/grpc.ts
TGrpcResultCode
type
A numeric gRPC status code from GRPC.ResultCodes (0 is OK).
export type TGrpcResultCode = ValueOf<typeof GRPC.ResultCodes>;
/** gRPC constants: call kinds, protocol headers and header values, and the numeric status codes by name. */
export declare class GRPC {
/** Standard gRPC methods (lowercase). */
static readonly Methods: {
readonly UNARY: "unary";
readonly SERVER_STREAMING: "server_streaming";
readonly CLIENT_STREAMING: "client_streaming";
readonly BIDI_STREAMING: "bidi_streaming";
};
/** Standard gRPC protocol headers (PROTOCOL-HTTP2.md). */
static readonly Headers: {
readonly CONTENT_TYPE: "content-type";
readonly TE: "te";
readonly USER_AGENT: "user-agent";
readonly GRPC_TIMEOUT: "grpc-timeout";
readonly GRPC_ENCODING: "grpc-encoding";
readonly GRPC_ACCEPT_ENCODING: "grpc-accept-encoding";
readonly GRPC_MESSAGE_TYPE: "grpc-message-type";
readonly GRPC_STATUS: "grpc-status";
readonly GRPC_MESSAGE: "grpc-message";
readonly GRPC_STATUS_DETAILS_BIN: "grpc-status-details-bin";
readonly GRPC_PREVIOUS_RPC_ATTEMPTS: "grpc-previous-rpc-attempts";
readonly GRPC_RETRY_PUSHBACK_MS: "grpc-retry-pushback-ms";
readonly GRPC_TRACE_BIN: "grpc-trace-bin";
readonly GRPC_TAGS_BIN: "grpc-tags-bin";
};
/** gRPC MIME / Content-Type values. */
static readonly HeaderValues: {
readonly GRPC: "application/grpc";
readonly GRPC_PROTO: "application/grpc+proto";
readonly GRPC_JSON: "application/grpc+json";
readonly GRPC_WEB: "application/grpc-web";
readonly GRPC_WEB_PROTO: "application/grpc-web+proto";
readonly GRPC_WEB_JSON: "application/grpc-web+json";
readonly GRPC_WEB_TEXT: "application/grpc-web-text";
};
/** Standard gRPC status codes (google.rpc.Code). */
static readonly ResultCodes: {
readonly OK: 0;
readonly CANCELLED: 1;
readonly UNKNOWN: 2;
readonly INVALID_ARGUMENT: 3;
readonly DEADLINE_EXCEEDED: 4;
readonly NOT_FOUND: 5;
readonly ALREADY_EXISTS: 6;
readonly PERMISSION_DENIED: 7;
readonly RESOURCE_EXHAUSTED: 8;
readonly FAILED_PRECONDITION: 9;
readonly ABORTED: 10;
readonly OUT_OF_RANGE: 11;
readonly UNIMPLEMENTED: 12;
readonly INTERNAL: 13;
readonly UNAVAILABLE: 14;
readonly DATA_LOSS: 15;
readonly UNAUTHENTICATED: 16;
};
}Source: packages/helpers/src/common/constants/grpc.ts
THttpMethod
type
An HTTP method from HTTP.Methods, in lowercase or uppercase.
export type THttpMethod = ValueOf<typeof HTTP.Methods> | Uppercase<ValueOf<typeof HTTP.Methods>>;
/** HTTP constants: header names, CORS headers, header values, methods, protocols and status codes. Header names, methods and protocols are lowercase. */
export declare class HTTP {
/** Standard and common HTTP headers (lowercase per HTTP/2 convention). */
static readonly Headers: {
readonly CONTENT_DISPOSITION: "content-disposition";
readonly CONTENT_ENCODING: "content-encoding";
readonly CONTENT_LENGTH: "content-length";
readonly CONTENT_TYPE: "content-type";
readonly CONTENT_RANGE: "content-range";
readonly CONTENT_SECURITY_POLICY: "content-security-policy";
readonly ACCEPT_RANGES: "accept-ranges";
readonly RANGE: "range";
readonly ACCEPT: "accept";
readonly ACCEPT_ENCODING: "accept-encoding";
readonly ACCEPT_LANGUAGE: "accept-language";
readonly AUTHORIZATION: "authorization";
readonly COOKIE: "cookie";
readonly HOST: "host";
readonly IF_MATCH: "if-match";
readonly IF_MODIFIED_SINCE: "if-modified-since";
readonly IF_NONE_MATCH: "if-none-match";
readonly ORIGIN: "origin";
readonly REFERER: "referer";
readonly USER_AGENT: "user-agent";
readonly ALLOW: "allow";
readonly CACHE_CONTROL: "cache-control";
readonly ETAG: "etag";
readonly LAST_MODIFIED: "last-modified";
readonly LOCATION: "location";
readonly RETRY_AFTER: "retry-after";
readonly SET_COOKIE: "set-cookie";
readonly VARY: "vary";
readonly WWW_AUTHENTICATE: "www-authenticate";
readonly ACCESS_CONTROL_ALLOW_CREDENTIALS: "access-control-allow-credentials";
readonly ACCESS_CONTROL_ALLOW_HEADERS: "access-control-allow-headers";
readonly ACCESS_CONTROL_ALLOW_METHODS: "access-control-allow-methods";
readonly ACCESS_CONTROL_ALLOW_ORIGIN: "access-control-allow-origin";
readonly ACCESS_CONTROL_EXPOSE_HEADERS: "access-control-expose-headers";
readonly ACCESS_CONTROL_MAX_AGE: "access-control-max-age";
readonly ACCESS_CONTROL_REQUEST_HEADERS: "access-control-request-headers";
readonly ACCESS_CONTROL_REQUEST_METHOD: "access-control-request-method";
readonly CONNECTION: "connection";
readonly TRANSFER_ENCODING: "transfer-encoding";
readonly UPGRADE: "upgrade";
readonly STRICT_TRANSPORT_SECURITY: "strict-transport-security";
readonly X_CONTENT_TYPE_OPTIONS: "x-content-type-options";
readonly X_FRAME_OPTIONS: "x-frame-options";
readonly FORWARDED: "forwarded";
readonly X_FORWARDED_FOR: "x-forwarded-for";
readonly X_FORWARDED_HOST: "x-forwarded-host";
readonly X_FORWARDED_PROTO: "x-forwarded-proto";
readonly X_REAL_IP: "x-real-ip";
readonly X_RATELIMIT_LIMIT: "x-ratelimit-limit";
readonly X_RATELIMIT_REMAINING: "x-ratelimit-remaining";
readonly X_RATELIMIT_RESET: "x-ratelimit-reset";
readonly REQUEST_TRACING_ID: "x-request-id";
readonly REQUEST_DEVICE_INFO: "x-device-info";
readonly REQUEST_CHANNEL: "x-request-channel";
readonly REQUEST_COUNT_DATA: "x-request-count";
readonly REQUEST_EXTRA: "x-request-extra";
readonly RESPONSE_COUNT_DATA: "x-response-count";
readonly RESPONSE_FORMAT: "x-response-format";
readonly RESPONSE_EXTRA: "x-response-extra";
readonly AUTH_PROVIDER: "x-auth-provider";
readonly LOCALE: "x-locale";
readonly TIMEZONE: "timezone";
readonly TIMEZONE_OFFSET: "timezone-offset";
};
/**
* The headers IGNIS adds to a request and to a response, for a CORS configuration that lists them
* by hand: spread `ALLOW` into the allowed request headers and `EXPOSE` into the exposed ones, so
* a header IGNIS adds later needs no change there.
*/
static readonly CorsHeaders: {
readonly ALLOW: readonly ["x-request-id", "x-request-count", "x-request-extra", "x-request-channel", "x-device-info"];
readonly EXPOSE: readonly ["content-range", "x-request-id", "x-response-count", "x-response-format", "x-response-extra"];
};
/** Common MIME / Content-Type values. */
static readonly HeaderValues: {
readonly APPLICATION_FORM_URLENCODED: "application/x-www-form-urlencoded";
readonly APPLICATION_GRAPHQL_JSON: "application/graphql+json";
readonly APPLICATION_GZIP: "application/gzip";
readonly APPLICATION_JAVASCRIPT: "application/javascript";
readonly APPLICATION_JSON: "application/json";
/** A JSON body with its charset named, the value a client sends by default. */
readonly APPLICATION_JSON_UTF8: "application/json; charset=utf-8";
readonly APPLICATION_MSGPACK: "application/msgpack";
readonly APPLICATION_NDJSON: "application/x-ndjson";
readonly APPLICATION_OCTET_STREAM: "application/octet-stream";
readonly APPLICATION_PDF: "application/pdf";
readonly APPLICATION_PROTOBUF: "application/x-protobuf";
readonly APPLICATION_XML: "application/xml";
readonly APPLICATION_ZIP: "application/zip";
readonly MULTIPART_FORM_DATA: "multipart/form-data";
readonly TEXT_CSS: "text/css";
readonly TEXT_CSV: "text/csv";
readonly TEXT_EVENT_STREAM: "text/event-stream";
readonly TEXT_HTML: "text/html";
readonly TEXT_PLAIN: "text/plain";
readonly TEXT_XML: "text/xml";
readonly IMAGE_GIF: "image/gif";
readonly IMAGE_JPEG: "image/jpeg";
readonly IMAGE_PNG: "image/png";
readonly IMAGE_SVG: "image/svg+xml";
readonly IMAGE_WEBP: "image/webp";
readonly RANGE_UNIT_BYTES: "bytes";
};
/** Standard HTTP methods (lowercase). */
static readonly Methods: {
readonly GET: "get";
readonly POST: "post";
readonly PUT: "put";
readonly PATCH: "patch";
readonly DELETE: "delete";
readonly HEAD: "head";
readonly OPTIONS: "options";
readonly QUERY: "query";
};
/** Standard HTTP protocols (lowercase). */
static readonly Protocols: {
readonly HTTP: "http";
readonly HTTPS: "https";
};
/** HTTP status codes grouped by class (1xx - 5xx). */
static readonly ResultCodes: {
/** 1xx - Informational. */
readonly RS_1: {
readonly Continue: 100;
readonly SwitchingProtocols: 101;
readonly EarlyHints: 103;
};
/** 2xx - Success. */
readonly RS_2: {
readonly Ok: 200;
readonly Created: 201;
readonly Accepted: 202;
readonly NonAuthoritativeInformation: 203;
readonly NoContent: 204;
readonly ResetContent: 205;
readonly PartialContent: 206;
readonly MultiStatus: 207;
};
/** 3xx - Redirection. */
readonly RS_3: {
readonly MovedPermanently: 301;
readonly Found: 302;
readonly NotModified: 304;
readonly TemporaryRedirect: 307;
readonly PermanentRedirect: 308;
};
/** 4xx - Client error. */
readonly RS_4: {
readonly BadRequest: 400;
readonly Unauthorized: 401;
readonly PaymentRequired: 402;
readonly Forbidden: 403;
readonly NotFound: 404;
readonly MethodNotAllowed: 405;
readonly NotAcceptable: 406;
readonly RequestTimeout: 408;
readonly Conflict: 409;
readonly Gone: 410;
readonly LengthRequired: 411;
readonly PreconditionFailed: 412;
readonly ContentTooLarge: 413;
readonly URITooLong: 414;
readonly UnsupportedMediaType: 415;
readonly RangeNotSatisfiable: 416;
readonly ExpectationFailed: 417;
readonly UnprocessableEntity: 422;
readonly Locked: 423;
readonly FailedDependency: 424;
readonly TooEarly: 425;
readonly UpgradeRequired: 426;
readonly PreconditionRequired: 428;
readonly TooManyRequests: 429;
readonly RequestHeaderFieldsTooLarge: 431;
readonly UnavailableForLegalReasons: 451;
};
/** 5xx - Server error. */
readonly RS_5: {
readonly InternalServerError: 500;
readonly NotImplemented: 501;
readonly BadGateway: 502;
readonly ServiceUnavailable: 503;
readonly GatewayTimeout: 504;
readonly HTTPVersionNotSupported: 505;
readonly InsufficientStorage: 507;
readonly LoopDetected: 508;
readonly NetworkAuthenticationRequired: 511;
};
};
}Source: packages/helpers/src/common/constants/http.ts
THttpProtocol
type
An HTTP protocol from HTTP.Protocols, in lowercase or uppercase.
export type THttpProtocol = ValueOf<typeof HTTP.Protocols> | Uppercase<ValueOf<typeof HTTP.Protocols>>;
/** HTTP constants: header names, CORS headers, header values, methods, protocols and status codes. Header names, methods and protocols are lowercase. */
export declare class HTTP {
/** Standard and common HTTP headers (lowercase per HTTP/2 convention). */
static readonly Headers: {
readonly CONTENT_DISPOSITION: "content-disposition";
readonly CONTENT_ENCODING: "content-encoding";
readonly CONTENT_LENGTH: "content-length";
readonly CONTENT_TYPE: "content-type";
readonly CONTENT_RANGE: "content-range";
readonly CONTENT_SECURITY_POLICY: "content-security-policy";
readonly ACCEPT_RANGES: "accept-ranges";
readonly RANGE: "range";
readonly ACCEPT: "accept";
readonly ACCEPT_ENCODING: "accept-encoding";
readonly ACCEPT_LANGUAGE: "accept-language";
readonly AUTHORIZATION: "authorization";
readonly COOKIE: "cookie";
readonly HOST: "host";
readonly IF_MATCH: "if-match";
readonly IF_MODIFIED_SINCE: "if-modified-since";
readonly IF_NONE_MATCH: "if-none-match";
readonly ORIGIN: "origin";
readonly REFERER: "referer";
readonly USER_AGENT: "user-agent";
readonly ALLOW: "allow";
readonly CACHE_CONTROL: "cache-control";
readonly ETAG: "etag";
readonly LAST_MODIFIED: "last-modified";
readonly LOCATION: "location";
readonly RETRY_AFTER: "retry-after";
readonly SET_COOKIE: "set-cookie";
readonly VARY: "vary";
readonly WWW_AUTHENTICATE: "www-authenticate";
readonly ACCESS_CONTROL_ALLOW_CREDENTIALS: "access-control-allow-credentials";
readonly ACCESS_CONTROL_ALLOW_HEADERS: "access-control-allow-headers";
readonly ACCESS_CONTROL_ALLOW_METHODS: "access-control-allow-methods";
readonly ACCESS_CONTROL_ALLOW_ORIGIN: "access-control-allow-origin";
readonly ACCESS_CONTROL_EXPOSE_HEADERS: "access-control-expose-headers";
readonly ACCESS_CONTROL_MAX_AGE: "access-control-max-age";
readonly ACCESS_CONTROL_REQUEST_HEADERS: "access-control-request-headers";
readonly ACCESS_CONTROL_REQUEST_METHOD: "access-control-request-method";
readonly CONNECTION: "connection";
readonly TRANSFER_ENCODING: "transfer-encoding";
readonly UPGRADE: "upgrade";
readonly STRICT_TRANSPORT_SECURITY: "strict-transport-security";
readonly X_CONTENT_TYPE_OPTIONS: "x-content-type-options";
readonly X_FRAME_OPTIONS: "x-frame-options";
readonly FORWARDED: "forwarded";
readonly X_FORWARDED_FOR: "x-forwarded-for";
readonly X_FORWARDED_HOST: "x-forwarded-host";
readonly X_FORWARDED_PROTO: "x-forwarded-proto";
readonly X_REAL_IP: "x-real-ip";
readonly X_RATELIMIT_LIMIT: "x-ratelimit-limit";
readonly X_RATELIMIT_REMAINING: "x-ratelimit-remaining";
readonly X_RATELIMIT_RESET: "x-ratelimit-reset";
readonly REQUEST_TRACING_ID: "x-request-id";
readonly REQUEST_DEVICE_INFO: "x-device-info";
readonly REQUEST_CHANNEL: "x-request-channel";
readonly REQUEST_COUNT_DATA: "x-request-count";
readonly REQUEST_EXTRA: "x-request-extra";
readonly RESPONSE_COUNT_DATA: "x-response-count";
readonly RESPONSE_FORMAT: "x-response-format";
readonly RESPONSE_EXTRA: "x-response-extra";
readonly AUTH_PROVIDER: "x-auth-provider";
readonly LOCALE: "x-locale";
readonly TIMEZONE: "timezone";
readonly TIMEZONE_OFFSET: "timezone-offset";
};
/**
* The headers IGNIS adds to a request and to a response, for a CORS configuration that lists them
* by hand: spread `ALLOW` into the allowed request headers and `EXPOSE` into the exposed ones, so
* a header IGNIS adds later needs no change there.
*/
static readonly CorsHeaders: {
readonly ALLOW: readonly ["x-request-id", "x-request-count", "x-request-extra", "x-request-channel", "x-device-info"];
readonly EXPOSE: readonly ["content-range", "x-request-id", "x-response-count", "x-response-format", "x-response-extra"];
};
/** Common MIME / Content-Type values. */
static readonly HeaderValues: {
readonly APPLICATION_FORM_URLENCODED: "application/x-www-form-urlencoded";
readonly APPLICATION_GRAPHQL_JSON: "application/graphql+json";
readonly APPLICATION_GZIP: "application/gzip";
readonly APPLICATION_JAVASCRIPT: "application/javascript";
readonly APPLICATION_JSON: "application/json";
/** A JSON body with its charset named, the value a client sends by default. */
readonly APPLICATION_JSON_UTF8: "application/json; charset=utf-8";
readonly APPLICATION_MSGPACK: "application/msgpack";
readonly APPLICATION_NDJSON: "application/x-ndjson";
readonly APPLICATION_OCTET_STREAM: "application/octet-stream";
readonly APPLICATION_PDF: "application/pdf";
readonly APPLICATION_PROTOBUF: "application/x-protobuf";
readonly APPLICATION_XML: "application/xml";
readonly APPLICATION_ZIP: "application/zip";
readonly MULTIPART_FORM_DATA: "multipart/form-data";
readonly TEXT_CSS: "text/css";
readonly TEXT_CSV: "text/csv";
readonly TEXT_EVENT_STREAM: "text/event-stream";
readonly TEXT_HTML: "text/html";
readonly TEXT_PLAIN: "text/plain";
readonly TEXT_XML: "text/xml";
readonly IMAGE_GIF: "image/gif";
readonly IMAGE_JPEG: "image/jpeg";
readonly IMAGE_PNG: "image/png";
readonly IMAGE_SVG: "image/svg+xml";
readonly IMAGE_WEBP: "image/webp";
readonly RANGE_UNIT_BYTES: "bytes";
};
/** Standard HTTP methods (lowercase). */
static readonly Methods: {
readonly GET: "get";
readonly POST: "post";
readonly PUT: "put";
readonly PATCH: "patch";
readonly DELETE: "delete";
readonly HEAD: "head";
readonly OPTIONS: "options";
readonly QUERY: "query";
};
/** Standard HTTP protocols (lowercase). */
static readonly Protocols: {
readonly HTTP: "http";
readonly HTTPS: "https";
};
/** HTTP status codes grouped by class (1xx - 5xx). */
static readonly ResultCodes: {
/** 1xx - Informational. */
readonly RS_1: {
readonly Continue: 100;
readonly SwitchingProtocols: 101;
readonly EarlyHints: 103;
};
/** 2xx - Success. */
readonly RS_2: {
readonly Ok: 200;
readonly Created: 201;
readonly Accepted: 202;
readonly NonAuthoritativeInformation: 203;
readonly NoContent: 204;
readonly ResetContent: 205;
readonly PartialContent: 206;
readonly MultiStatus: 207;
};
/** 3xx - Redirection. */
readonly RS_3: {
readonly MovedPermanently: 301;
readonly Found: 302;
readonly NotModified: 304;
readonly TemporaryRedirect: 307;
readonly PermanentRedirect: 308;
};
/** 4xx - Client error. */
readonly RS_4: {
readonly BadRequest: 400;
readonly Unauthorized: 401;
readonly PaymentRequired: 402;
readonly Forbidden: 403;
readonly NotFound: 404;
readonly MethodNotAllowed: 405;
readonly NotAcceptable: 406;
readonly RequestTimeout: 408;
readonly Conflict: 409;
readonly Gone: 410;
readonly LengthRequired: 411;
readonly PreconditionFailed: 412;
readonly ContentTooLarge: 413;
readonly URITooLong: 414;
readonly UnsupportedMediaType: 415;
readonly RangeNotSatisfiable: 416;
readonly ExpectationFailed: 417;
readonly UnprocessableEntity: 422;
readonly Locked: 423;
readonly FailedDependency: 424;
readonly TooEarly: 425;
readonly UpgradeRequired: 426;
readonly PreconditionRequired: 428;
readonly TooManyRequests: 429;
readonly RequestHeaderFieldsTooLarge: 431;
readonly UnavailableForLegalReasons: 451;
};
/** 5xx - Server error. */
readonly RS_5: {
readonly InternalServerError: 500;
readonly NotImplemented: 501;
readonly BadGateway: 502;
readonly ServiceUnavailable: 503;
readonly GatewayTimeout: 504;
readonly HTTPVersionNotSupported: 505;
readonly InsufficientStorage: 507;
readonly LoopDetected: 508;
readonly NetworkAuthenticationRequired: 511;
};
};
}Source: packages/helpers/src/common/constants/http.ts
THttpResultCode
type
A numeric HTTP status code from any class in HTTP.ResultCodes.
export type THttpResultCode = ValueOf<typeof HTTP.ResultCodes>;
/** HTTP constants: header names, CORS headers, header values, methods, protocols and status codes. Header names, methods and protocols are lowercase. */
export declare class HTTP {
/** Standard and common HTTP headers (lowercase per HTTP/2 convention). */
static readonly Headers: {
readonly CONTENT_DISPOSITION: "content-disposition";
readonly CONTENT_ENCODING: "content-encoding";
readonly CONTENT_LENGTH: "content-length";
readonly CONTENT_TYPE: "content-type";
readonly CONTENT_RANGE: "content-range";
readonly CONTENT_SECURITY_POLICY: "content-security-policy";
readonly ACCEPT_RANGES: "accept-ranges";
readonly RANGE: "range";
readonly ACCEPT: "accept";
readonly ACCEPT_ENCODING: "accept-encoding";
readonly ACCEPT_LANGUAGE: "accept-language";
readonly AUTHORIZATION: "authorization";
readonly COOKIE: "cookie";
readonly HOST: "host";
readonly IF_MATCH: "if-match";
readonly IF_MODIFIED_SINCE: "if-modified-since";
readonly IF_NONE_MATCH: "if-none-match";
readonly ORIGIN: "origin";
readonly REFERER: "referer";
readonly USER_AGENT: "user-agent";
readonly ALLOW: "allow";
readonly CACHE_CONTROL: "cache-control";
readonly ETAG: "etag";
readonly LAST_MODIFIED: "last-modified";
readonly LOCATION: "location";
readonly RETRY_AFTER: "retry-after";
readonly SET_COOKIE: "set-cookie";
readonly VARY: "vary";
readonly WWW_AUTHENTICATE: "www-authenticate";
readonly ACCESS_CONTROL_ALLOW_CREDENTIALS: "access-control-allow-credentials";
readonly ACCESS_CONTROL_ALLOW_HEADERS: "access-control-allow-headers";
readonly ACCESS_CONTROL_ALLOW_METHODS: "access-control-allow-methods";
readonly ACCESS_CONTROL_ALLOW_ORIGIN: "access-control-allow-origin";
readonly ACCESS_CONTROL_EXPOSE_HEADERS: "access-control-expose-headers";
readonly ACCESS_CONTROL_MAX_AGE: "access-control-max-age";
readonly ACCESS_CONTROL_REQUEST_HEADERS: "access-control-request-headers";
readonly ACCESS_CONTROL_REQUEST_METHOD: "access-control-request-method";
readonly CONNECTION: "connection";
readonly TRANSFER_ENCODING: "transfer-encoding";
readonly UPGRADE: "upgrade";
readonly STRICT_TRANSPORT_SECURITY: "strict-transport-security";
readonly X_CONTENT_TYPE_OPTIONS: "x-content-type-options";
readonly X_FRAME_OPTIONS: "x-frame-options";
readonly FORWARDED: "forwarded";
readonly X_FORWARDED_FOR: "x-forwarded-for";
readonly X_FORWARDED_HOST: "x-forwarded-host";
readonly X_FORWARDED_PROTO: "x-forwarded-proto";
readonly X_REAL_IP: "x-real-ip";
readonly X_RATELIMIT_LIMIT: "x-ratelimit-limit";
readonly X_RATELIMIT_REMAINING: "x-ratelimit-remaining";
readonly X_RATELIMIT_RESET: "x-ratelimit-reset";
readonly REQUEST_TRACING_ID: "x-request-id";
readonly REQUEST_DEVICE_INFO: "x-device-info";
readonly REQUEST_CHANNEL: "x-request-channel";
readonly REQUEST_COUNT_DATA: "x-request-count";
readonly REQUEST_EXTRA: "x-request-extra";
readonly RESPONSE_COUNT_DATA: "x-response-count";
readonly RESPONSE_FORMAT: "x-response-format";
readonly RESPONSE_EXTRA: "x-response-extra";
readonly AUTH_PROVIDER: "x-auth-provider";
readonly LOCALE: "x-locale";
readonly TIMEZONE: "timezone";
readonly TIMEZONE_OFFSET: "timezone-offset";
};
/**
* The headers IGNIS adds to a request and to a response, for a CORS configuration that lists them
* by hand: spread `ALLOW` into the allowed request headers and `EXPOSE` into the exposed ones, so
* a header IGNIS adds later needs no change there.
*/
static readonly CorsHeaders: {
readonly ALLOW: readonly ["x-request-id", "x-request-count", "x-request-extra", "x-request-channel", "x-device-info"];
readonly EXPOSE: readonly ["content-range", "x-request-id", "x-response-count", "x-response-format", "x-response-extra"];
};
/** Common MIME / Content-Type values. */
static readonly HeaderValues: {
readonly APPLICATION_FORM_URLENCODED: "application/x-www-form-urlencoded";
readonly APPLICATION_GRAPHQL_JSON: "application/graphql+json";
readonly APPLICATION_GZIP: "application/gzip";
readonly APPLICATION_JAVASCRIPT: "application/javascript";
readonly APPLICATION_JSON: "application/json";
/** A JSON body with its charset named, the value a client sends by default. */
readonly APPLICATION_JSON_UTF8: "application/json; charset=utf-8";
readonly APPLICATION_MSGPACK: "application/msgpack";
readonly APPLICATION_NDJSON: "application/x-ndjson";
readonly APPLICATION_OCTET_STREAM: "application/octet-stream";
readonly APPLICATION_PDF: "application/pdf";
readonly APPLICATION_PROTOBUF: "application/x-protobuf";
readonly APPLICATION_XML: "application/xml";
readonly APPLICATION_ZIP: "application/zip";
readonly MULTIPART_FORM_DATA: "multipart/form-data";
readonly TEXT_CSS: "text/css";
readonly TEXT_CSV: "text/csv";
readonly TEXT_EVENT_STREAM: "text/event-stream";
readonly TEXT_HTML: "text/html";
readonly TEXT_PLAIN: "text/plain";
readonly TEXT_XML: "text/xml";
readonly IMAGE_GIF: "image/gif";
readonly IMAGE_JPEG: "image/jpeg";
readonly IMAGE_PNG: "image/png";
readonly IMAGE_SVG: "image/svg+xml";
readonly IMAGE_WEBP: "image/webp";
readonly RANGE_UNIT_BYTES: "bytes";
};
/** Standard HTTP methods (lowercase). */
static readonly Methods: {
readonly GET: "get";
readonly POST: "post";
readonly PUT: "put";
readonly PATCH: "patch";
readonly DELETE: "delete";
readonly HEAD: "head";
readonly OPTIONS: "options";
readonly QUERY: "query";
};
/** Standard HTTP protocols (lowercase). */
static readonly Protocols: {
readonly HTTP: "http";
readonly HTTPS: "https";
};
/** HTTP status codes grouped by class (1xx - 5xx). */
static readonly ResultCodes: {
/** 1xx - Informational. */
readonly RS_1: {
readonly Continue: 100;
readonly SwitchingProtocols: 101;
readonly EarlyHints: 103;
};
/** 2xx - Success. */
readonly RS_2: {
readonly Ok: 200;
readonly Created: 201;
readonly Accepted: 202;
readonly NonAuthoritativeInformation: 203;
readonly NoContent: 204;
readonly ResetContent: 205;
readonly PartialContent: 206;
readonly MultiStatus: 207;
};
/** 3xx - Redirection. */
readonly RS_3: {
readonly MovedPermanently: 301;
readonly Found: 302;
readonly NotModified: 304;
readonly TemporaryRedirect: 307;
readonly PermanentRedirect: 308;
};
/** 4xx - Client error. */
readonly RS_4: {
readonly BadRequest: 400;
readonly Unauthorized: 401;
readonly PaymentRequired: 402;
readonly Forbidden: 403;
readonly NotFound: 404;
readonly MethodNotAllowed: 405;
readonly NotAcceptable: 406;
readonly RequestTimeout: 408;
readonly Conflict: 409;
readonly Gone: 410;
readonly LengthRequired: 411;
readonly PreconditionFailed: 412;
readonly ContentTooLarge: 413;
readonly URITooLong: 414;
readonly UnsupportedMediaType: 415;
readonly RangeNotSatisfiable: 416;
readonly ExpectationFailed: 417;
readonly UnprocessableEntity: 422;
readonly Locked: 423;
readonly FailedDependency: 424;
readonly TooEarly: 425;
readonly UpgradeRequired: 426;
readonly PreconditionRequired: 428;
readonly TooManyRequests: 429;
readonly RequestHeaderFieldsTooLarge: 431;
readonly UnavailableForLegalReasons: 451;
};
/** 5xx - Server error. */
readonly RS_5: {
readonly InternalServerError: 500;
readonly NotImplemented: 501;
readonly BadGateway: 502;
readonly ServiceUnavailable: 503;
readonly GatewayTimeout: 504;
readonly HTTPVersionNotSupported: 505;
readonly InsufficientStorage: 507;
readonly LoopDetected: 508;
readonly NetworkAuthenticationRequired: 511;
};
};
}Source: packages/helpers/src/common/constants/http.ts
TInjectionGetter
type
Reads one value by binding key from the container; T comes from the key.
export type TInjectionGetter = <T>(opts: {
key: TBindingKey<T>;
}) => T;Source: packages/helpers/src/common/types/injection.ts
TJsonPrimitive
type
A JSON scalar.
export type TJsonPrimitive = string | number | boolean | null;Source: packages/helpers/src/common/types/json.ts
TJsonValue
type
Any value JSON can hold: a scalar, an array of JSON values, or an object whose values are JSON values. The type of a jsonb or JSON column that stores whatever the app puts in it (jValue of the data-type enrichers).
A value typed as an interface is not assignable, because an interface has no index signature: spread it ({ ...meta }) or declare its shape as a type. A readonly array is refused too, at any depth, so an as const object that holds one is refused: copy each array ([...list]). An as const object of scalars is accepted.
export type TJsonValue = TJsonPrimitive | TJsonValue[] | {
[key: string]: TJsonValue;
};Source: packages/helpers/src/common/types/json.ts
TMimeTypes
type
One of the MimeTypes values.
export type TMimeTypes = TConstValue<typeof MimeTypes>;Source: packages/helpers/src/common/constants/mime.ts
TMixinConstructor
type
The constructor shape a mixin base takes. TypeScript requires new (...args: any[]) => T here (error TS2545: a mixin class must have a constructor with a single rest parameter of type any[]), so this is the one any the language mandates.
export type TMixinConstructor<T> = new (...args: any[]) => T;Source: packages/helpers/src/common/types/class.ts
TMixinTarget
type
The constructor type a mixin accepts as its base: it must produce at least the members of T.
export type TMixinTarget<T> = TMixinConstructor<{
[P in keyof T]: T[P];
}>;Source: packages/helpers/src/common/types/class.ts
TNullable
type
T, undefined or null.
export type TNullable<T> = T | undefined | null;Source: packages/helpers/src/common/types/utility.ts
TNumberConstValue
type
The number values held by the static readonly members of const class T, as a plain union.
export type TNumberConstValue<T extends TClass<unknown>> = Extract<ValueOf<T>, number> & {};Source: packages/helpers/src/common/types/const-value.ts
TObjectFromFieldMappings
type
The object a list of field mappings yields: one key per name, typed from its type (string, number, boolean, strings or numbers). Needs the list typed as a literal (as const) to narrow.
export type TObjectFromFieldMappings<T extends readonly {
name: string;
type: string;
[extra: string | symbol]: unknown;
}[]> = {
[K in T[number]['name']]: T extends {
name: K;
type: 'string';
[extra: string | symbol]: unknown;
} ? string : T extends {
name: K;
type: 'number';
[extra: string | symbol]: unknown;
} ? number : T extends {
name: K;
type: 'boolean';
[extra: string | symbol]: unknown;
} ? boolean : T extends {
name: K;
type: 'strings';
[extra: string | symbol]: unknown;
} ? string[] : T extends {
name: K;
type: 'numbers';
[extra: string | symbol]: unknown;
} ? number[] : never;
};Source: packages/helpers/src/common/types/field-mapping.ts
TOptions
type
An options object of shape T; empty by default.
export type TOptions<T extends object = {}> = T;Source: packages/helpers/src/common/types/utility.ts
TPrettify
type
Flattens an intersection of types into one object type, for readable hovers.
export type TPrettify<T> = {
[K in keyof T]: T[K];
} & {};Source: packages/helpers/src/common/types/utility.ts
TRuntimeModule
type
The runtime names RuntimeModules holds; only bun today.
export type TRuntimeModule = TConstValue<typeof RuntimeModules>;Source: packages/helpers/src/common/constants/app.ts
TStringConstValue
type
The string values held by the static readonly members of const class T, as a plain union.
export type TStringConstValue<T extends TClass<unknown>> = Extract<ValueOf<T>, string> & {};Source: packages/helpers/src/common/types/const-value.ts
ValueOf
type
The union of the property value types of T.
export type ValueOf<T> = T[keyof T];Source: packages/helpers/src/common/types/utility.ts
ValueOptional
type
T with the keys K made optional.
export type ValueOptional<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;Source: packages/helpers/src/common/types/utility.ts
ValueOptionalExcept
type
T with every key optional except K.
export type ValueOptionalExcept<T, K extends keyof T> = Pick<T, K> & Partial<Omit<T, K>>;Source: packages/helpers/src/common/types/utility.ts
ValueOrPromise
type
T or a promise of T; await it to get T either way.
export type ValueOrPromise<T> = T | Promise<T>;Source: packages/helpers/src/common/types/utility.ts
Re-exported
isClassfrom@venizia/ignis-inversionObjectUtilityfrom@venizia/ignis-inversionResolverUtilityfrom@venizia/ignis-inversionTAsyncResolverfrom@venizia/ignis-inversionTResolverfrom@venizia/ignis-inversionTValueOrAsyncResolverfrom@venizia/ignis-inversionTValueOrResolverfrom@venizia/ignis-inversion