@venizia/ignis-kernel 0.4.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/base/applications/abstract.js +2 -2
- package/dist/cjs/base/applications/abstract.js.map +1 -1
- package/dist/cjs/base/applications/artifact-group.js +1 -1
- package/dist/cjs/base/applications/artifact-group.js.map +1 -1
- package/dist/cjs/base/applications/artifact-index.js +11 -11
- package/dist/cjs/base/applications/artifact-index.js.map +1 -1
- package/dist/cjs/base/applications/boot-sequence.js +1 -1
- package/dist/cjs/base/applications/boot-sequence.js.map +1 -1
- package/dist/cjs/base/applications/rest.js +5 -5
- package/dist/cjs/base/applications/rest.js.map +1 -1
- package/dist/cjs/base/auth/authenticate/common/codecs.js +2 -2
- package/dist/cjs/base/auth/authenticate/common/codecs.js.map +1 -1
- package/dist/cjs/base/auth/authenticate/providers/authentication.provider.js +1 -1
- package/dist/cjs/base/auth/authenticate/providers/authentication.provider.js.map +1 -1
- package/dist/cjs/base/auth/authenticate/strategies/strategy-registry.js +1 -1
- package/dist/cjs/base/auth/authenticate/strategies/strategy-registry.js.map +1 -1
- package/dist/cjs/base/auth/authorize/builders/grant.builder.js +12 -12
- package/dist/cjs/base/auth/authorize/builders/grant.builder.js.map +1 -1
- package/dist/cjs/base/auth/authorize/builders/permission.builder.js +1 -1
- package/dist/cjs/base/auth/authorize/builders/permission.builder.js.map +1 -1
- package/dist/cjs/base/auth/authorize/builders/policy.builder.js +1 -1
- package/dist/cjs/base/auth/authorize/builders/policy.builder.js.map +1 -1
- package/dist/cjs/base/auth/authorize/common/constants/authorization.d.ts.map +1 -1
- package/dist/cjs/base/auth/authorize/common/constants/authorization.js +2 -2
- package/dist/cjs/base/auth/authorize/common/constants/authorization.js.map +1 -1
- package/dist/cjs/base/auth/authorize/enforcers/enforcer-registry.js +1 -1
- package/dist/cjs/base/auth/authorize/enforcers/enforcer-registry.js.map +1 -1
- package/dist/cjs/base/auth/authorize/providers/authorization.provider.js +3 -3
- package/dist/cjs/base/auth/authorize/providers/authorization.provider.js.map +1 -1
- package/dist/cjs/base/controllers/factory/controller.d.ts +2 -2
- package/dist/cjs/base/controllers/factory/controller.d.ts.map +1 -1
- package/dist/cjs/base/controllers/factory/controller.js +1 -0
- package/dist/cjs/base/controllers/factory/controller.js.map +1 -1
- package/dist/cjs/base/controllers/factory/crud/abstract.d.ts +1 -1
- package/dist/cjs/base/controllers/factory/crud/abstract.d.ts.map +1 -1
- package/dist/cjs/base/controllers/factory/crud/abstract.js.map +1 -1
- package/dist/cjs/base/controllers/factory/definition.js +1 -1
- package/dist/cjs/base/controllers/factory/definition.js.map +1 -1
- package/dist/cjs/base/controllers/rest/extras.js +5 -5
- package/dist/cjs/base/controllers/rest/extras.js.map +1 -1
- package/dist/cjs/base/metadata/injectable.js +1 -1
- package/dist/cjs/base/metadata/injectable.js.map +1 -1
- package/dist/cjs/base/metadata/persistents.js +4 -4
- package/dist/cjs/base/metadata/persistents.js.map +1 -1
- package/dist/cjs/base/metadata/routes/controller.js +1 -1
- package/dist/cjs/base/metadata/routes/controller.js.map +1 -1
- package/dist/cjs/base/middlewares/app-error/app-error.middleware.js +3 -3
- package/dist/cjs/base/middlewares/app-error/app-error.middleware.js.map +1 -1
- package/dist/cjs/base/middlewares/app-error/zod.handler.js +2 -2
- package/dist/cjs/base/middlewares/app-error/zod.handler.js.map +1 -1
- package/dist/cjs/base/middlewares/form-body/form-body.middleware.js +2 -2
- package/dist/cjs/base/middlewares/form-body/form-body.middleware.js.map +1 -1
- package/dist/cjs/base/middlewares/not-found/not-found.middleware.js.map +1 -1
- package/dist/cjs/base/models/common/utilities.js +1 -1
- package/dist/cjs/base/models/common/utilities.js.map +1 -1
- package/dist/cjs/base/repositories/common/types/contracts.d.ts +17 -17
- package/dist/cjs/base/repositories/common/types/contracts.d.ts.map +1 -1
- package/dist/cjs/base/repositories/common/types/contracts.js.map +1 -1
- package/dist/cjs/base/repositories/core/abstract.d.ts +17 -17
- package/dist/cjs/base/repositories/core/abstract.d.ts.map +1 -1
- package/dist/cjs/base/repositories/core/abstract.js +4 -3
- package/dist/cjs/base/repositories/core/abstract.js.map +1 -1
- package/dist/cjs/helpers/inversion/mixins/model.mixin.js +1 -1
- package/dist/cjs/helpers/inversion/mixins/model.mixin.js.map +1 -1
- package/dist/cjs/helpers/inversion/mixins/repository.mixin.js +1 -1
- package/dist/cjs/helpers/inversion/mixins/repository.mixin.js.map +1 -1
- package/dist/cjs/repository.d.ts +1 -1
- package/dist/cjs/repository.d.ts.map +1 -1
- package/dist/cjs/repository.js.map +1 -1
- package/dist/esm/base/applications/abstract.js +2 -2
- package/dist/esm/base/applications/abstract.js.map +1 -1
- package/dist/esm/base/applications/artifact-group.js +1 -1
- package/dist/esm/base/applications/artifact-group.js.map +1 -1
- package/dist/esm/base/applications/artifact-index.js +11 -11
- package/dist/esm/base/applications/artifact-index.js.map +1 -1
- package/dist/esm/base/applications/boot-sequence.js +1 -1
- package/dist/esm/base/applications/boot-sequence.js.map +1 -1
- package/dist/esm/base/applications/rest.js +5 -5
- package/dist/esm/base/applications/rest.js.map +1 -1
- package/dist/esm/base/auth/authenticate/common/codecs.js +2 -2
- package/dist/esm/base/auth/authenticate/common/codecs.js.map +1 -1
- package/dist/esm/base/auth/authenticate/providers/authentication.provider.js +1 -1
- package/dist/esm/base/auth/authenticate/providers/authentication.provider.js.map +1 -1
- package/dist/esm/base/auth/authenticate/strategies/strategy-registry.js +1 -1
- package/dist/esm/base/auth/authenticate/strategies/strategy-registry.js.map +1 -1
- package/dist/esm/base/auth/authorize/builders/grant.builder.js +12 -12
- package/dist/esm/base/auth/authorize/builders/grant.builder.js.map +1 -1
- package/dist/esm/base/auth/authorize/builders/permission.builder.js +1 -1
- package/dist/esm/base/auth/authorize/builders/permission.builder.js.map +1 -1
- package/dist/esm/base/auth/authorize/builders/policy.builder.js +1 -1
- package/dist/esm/base/auth/authorize/builders/policy.builder.js.map +1 -1
- package/dist/esm/base/auth/authorize/common/constants/authorization.d.ts.map +1 -1
- package/dist/esm/base/auth/authorize/common/constants/authorization.js +2 -2
- package/dist/esm/base/auth/authorize/common/constants/authorization.js.map +1 -1
- package/dist/esm/base/auth/authorize/enforcers/enforcer-registry.js +1 -1
- package/dist/esm/base/auth/authorize/enforcers/enforcer-registry.js.map +1 -1
- package/dist/esm/base/auth/authorize/providers/authorization.provider.js +3 -3
- package/dist/esm/base/auth/authorize/providers/authorization.provider.js.map +1 -1
- package/dist/esm/base/controllers/factory/controller.d.ts +2 -2
- package/dist/esm/base/controllers/factory/controller.d.ts.map +1 -1
- package/dist/esm/base/controllers/factory/controller.js +1 -0
- package/dist/esm/base/controllers/factory/controller.js.map +1 -1
- package/dist/esm/base/controllers/factory/crud/abstract.d.ts +1 -1
- package/dist/esm/base/controllers/factory/crud/abstract.d.ts.map +1 -1
- package/dist/esm/base/controllers/factory/crud/abstract.js.map +1 -1
- package/dist/esm/base/controllers/factory/definition.js +1 -1
- package/dist/esm/base/controllers/factory/definition.js.map +1 -1
- package/dist/esm/base/controllers/rest/extras.js +5 -5
- package/dist/esm/base/controllers/rest/extras.js.map +1 -1
- package/dist/esm/base/metadata/injectable.js +1 -1
- package/dist/esm/base/metadata/injectable.js.map +1 -1
- package/dist/esm/base/metadata/persistents.js +4 -4
- package/dist/esm/base/metadata/persistents.js.map +1 -1
- package/dist/esm/base/metadata/routes/controller.js +1 -1
- package/dist/esm/base/metadata/routes/controller.js.map +1 -1
- package/dist/esm/base/middlewares/app-error/app-error.middleware.js +3 -3
- package/dist/esm/base/middlewares/app-error/app-error.middleware.js.map +1 -1
- package/dist/esm/base/middlewares/app-error/zod.handler.js +2 -2
- package/dist/esm/base/middlewares/app-error/zod.handler.js.map +1 -1
- package/dist/esm/base/middlewares/form-body/form-body.middleware.js +2 -2
- package/dist/esm/base/middlewares/form-body/form-body.middleware.js.map +1 -1
- package/dist/esm/base/middlewares/not-found/not-found.middleware.js.map +1 -1
- package/dist/esm/base/models/common/utilities.js +1 -1
- package/dist/esm/base/models/common/utilities.js.map +1 -1
- package/dist/esm/base/repositories/common/types/contracts.d.ts +17 -17
- package/dist/esm/base/repositories/common/types/contracts.d.ts.map +1 -1
- package/dist/esm/base/repositories/common/types/contracts.js.map +1 -1
- package/dist/esm/base/repositories/core/abstract.d.ts +17 -17
- package/dist/esm/base/repositories/core/abstract.d.ts.map +1 -1
- package/dist/esm/base/repositories/core/abstract.js +4 -3
- package/dist/esm/base/repositories/core/abstract.js.map +1 -1
- package/dist/esm/helpers/inversion/mixins/model.mixin.js +1 -1
- package/dist/esm/helpers/inversion/mixins/model.mixin.js.map +1 -1
- package/dist/esm/helpers/inversion/mixins/repository.mixin.js +1 -1
- package/dist/esm/helpers/inversion/mixins/repository.mixin.js.map +1 -1
- package/dist/esm/repository.d.ts +1 -1
- package/dist/esm/repository.d.ts.map +1 -1
- package/dist/esm/repository.js.map +1 -1
- package/package.json +6 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-error.middleware.js","sourceRoot":"","sources":["../../../../../src/base/middlewares/app-error/app-error.middleware.ts"],"names":[],"mappings":";;;AAEA,sDAMqC;AACrC,0DAAiE;AAIjE,sCAA2C;AAC3C,yDAAqF;AACrF,6CAIsB;AAEtB,+CAA+C;AAE/C,MAAM,8BAA8B,GAAG,uBAAuB,CAAC;AAE/D,2JAA2J;AAC3J,MAAM,gCAAgC,GAAG,CAAC,CAAC;AAC3C,MAAM,+BAA+B,GAAG,EAAE,CAAC;AAc3C;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,GAAG,CAAC,IAAwB,EAAU,EAAE;IACvD,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC;IAEvB,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM,IAAI,GAAG,IAAA,mBAAU,EAAC,EAAE,KAAK,EAAE,CAAC,CAAC;IAEnC,IAAI,CAAC;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\nimport type { TNullable } from '@venizia/ignis-helpers/common';\nimport {\n BaseHelper,\n EnvironmentNames,\n LogLevels,\n MessageCode,\n MessageTemplate,\n} from '@venizia/ignis-helpers/core';\nimport { HTTP, toJsonSafe } from '@venizia/ignis-helpers/common';\nimport type { IProvider } from '@venizia/ignis-inversion';\nimport type { Context } from 'hono';\nimport type { ErrorHandler, HTTPResponseError } from 'hono/types';\nimport { REQUEST_ID_KEY } from '../common';\nimport { isDatabaseClientError, isRetryableDatabaseError } from './database.handler';\nimport {\n ApplicationErrorTypes,\n DATABASE_RETRYABLE_ERROR_CODE,\n DATABASE_RETRYABLE_ERROR_MESSAGE,\n} from './definition';\nimport type { IResolvedApplicationError, TApplicationErrorType } from './common';\nimport { formatZodError } from './zod.handler';\n\nconst DEFAULT_INTERNAL_ERROR_MESSAGE = 'Internal Server Error';\n\n/** An intentional error's throw site is still worth naming; its caller chain is framework plumbing, so it gets a smaller budget than an unexpected one. */\nconst DEFAULT_INTENTIONAL_STACK_FRAMES = 5;\nconst DEFAULT_UNEXPECTED_STACK_FRAMES = 10;\n\n/** How a thrown error is rendered into the log line. Must never throw - a throw inside the error handler turns a handled failure into an unhandled one. */\nexport type TErrorLogFormatter = (opts: {\n error: unknown;\n messageCode?: string;\n extra?: Record<string, unknown>;\n includeStack?: boolean;\n maxStackFrames?: number;\n}) => string;\n\ntype TThrown = Error | HTTPResponseError;\ntype TDatabaseClientError = ReturnType<typeof isDatabaseClientError>;\n\n/**\n * Renders a value into one log-safe fragment.\n *\n * Redaction is not optional here. This runs on `extra`, which is whatever a throw site chose to\n * attach - `getError({ extra: { apiKey } })` is a shape applications write - and in a Worker this\n * fragment lands in the browser console. `toJsonSafe` masks secret-shaped keys; a hand-rolled\n * `JSON.stringify` does not, and the server path has always redacted.\n *\n * The BigInt replacer stays: `toJsonSafe` leaves BigInt intact and `JSON.stringify` refuses it, so\n * without this a single BigInt would collapse the whole fragment to the marker below. Anything else\n * it refuses yields that marker rather than a throw - this is the last-resort error handler, where a\n * throw turns a handled failure into an unhandled one.\n */\nconst renderValue = (opts: { value: unknown }): string => {\n const { value } = opts;\n\n if (typeof value === 'string') {\n return value;\n }\n\n const safe = toJsonSafe({ value });\n\n try {\n return JSON.stringify(safe) ?? String(value);\n } catch {\n // A replacer is 6x the cost of plain stringify and deopts every key, so it is installed only\n // once BigInt has actually thrown - the case it exists for, and the rare one.\n try {\n const rendered = JSON.stringify(safe, (_key, entry: unknown) =>\n typeof entry === 'bigint' ? entry.toString() : entry,\n );\n\n return rendered ?? String(value);\n } catch {\n // Not a swallowed failure: this marker IS the report, and it lands in the log line the caller\n // is building.\n return '[unrenderable]';\n }\n }\n};\n\n/**\n * Hono `onError`: ZodError -> 422, DB client error -> 400, retryable conflict -> 409, `getError` ->\n * its own status, else 500. Browser-pure: the two reads that need a host - the ambient environment\n * name and the error formatter - are constructor OPTIONS, not methods to subclass.\n *\n * They were hooks once, and three subclasses existed to answer them and nothing else. A class seam\n * is also unreachable from application code, so the browser example had to fake the environment with\n * a Hono middleware assigning `context.env`. `@venizia/ignis`'s `AppErrorMiddleware` now just\n * supplies `process.env.NODE_ENV` and `ErrorPrettier` as options.\n */\nexport class BaseAppErrorMiddleware extends BaseHelper implements IProvider<ErrorHandler> {\n private rootKey: TNullable<string>;\n private intentionalStackFrames: number;\n private unexpectedStackFrames: number;\n\n /**\n * How this host reads its ambient environment name, and the ONE option that says whether it has\n * one at all: absent means it does not (a browser), so an unresolved name is by design; present\n * but returning `undefined` means a host that should have one is misconfigured. Either way\n * {@link isProduction} fails closed.\n *\n * A function, not a string: `process.env.NODE_ENV` has to be read per request, since a test - and\n * a `--env-file` reload - can change it after the middleware is built.\n */\n private readonly environment?: () => string | undefined;\n\n /** Replaces {@link renderErrorForLog} - `@venizia/ignis` passes `ErrorPrettier`, which reaches `node:util` and so cannot live here. */\n private readonly formatErrorOverride?: TErrorLogFormatter;\n\n constructor(opts?: {\n logger?: ILogger;\n rootKey?: string;\n intentionalStackFrames?: number;\n unexpectedStackFrames?: number;\n environment?: () => string | undefined;\n formatError?: TErrorLogFormatter;\n }) {\n // `new.target`, not a literal: a subclass logs under its own name, so `@venizia/ignis`'s\n // `AppErrorMiddleware` keeps the scope it has always logged under.\n super({ scope: new.target.name });\n\n this.rootKey = opts?.rootKey;\n this.intentionalStackFrames = opts?.intentionalStackFrames ?? DEFAULT_INTENTIONAL_STACK_FRAMES;\n this.unexpectedStackFrames = opts?.unexpectedStackFrames ?? DEFAULT_UNEXPECTED_STACK_FRAMES;\n this.environment = opts?.environment;\n this.formatErrorOverride = opts?.formatError;\n\n if (opts?.logger) {\n this.logger = opts.logger;\n }\n }\n\n /** Renders a thrown error for the log, through the `formatError` option when one was given. */\n protected formatError(opts: {\n error: unknown;\n messageCode?: string;\n extra?: Record<string, unknown>;\n includeStack?: boolean;\n maxStackFrames?: number;\n }): string {\n return (this.formatErrorOverride ?? (o => this.renderErrorForLog(o)))(opts);\n }\n\n /**\n * The default log rendering: pure and deliberately small, so the whole middleware stays\n * browser-pure.\n *\n * Must never throw, cycles included: a throw inside the error handler turns a handled failure\n * into an unhandled one.\n */\n private renderErrorForLog(opts: {\n error: unknown;\n messageCode?: string;\n extra?: Record<string, unknown>;\n includeStack?: boolean;\n maxStackFrames?: number;\n }): string {\n const { error, messageCode, extra, includeStack = true, maxStackFrames } = opts;\n const thrown = error as Partial<Error> | null | undefined;\n const lines: Array<string> = [];\n\n if (typeof thrown?.name === 'string') {\n lines.push(`name: ${thrown.name}`);\n }\n\n lines.push(\n `message: ${typeof thrown?.message === 'string' ? thrown.message : renderValue({ value: error })}`,\n );\n\n if (messageCode) {\n lines.push(`code: ${messageCode}`);\n }\n\n if (extra && Object.keys(extra).length > 0) {\n lines.push(`extra: ${renderValue({ value: extra })}`);\n }\n\n if (includeStack && typeof thrown?.stack === 'string') {\n const frames = thrown.stack.split('\\n').filter(line => line.trimStart().startsWith('at '));\n const capped = maxStackFrames === undefined ? frames : frames.slice(0, maxStackFrames);\n\n if (capped.length > 0) {\n lines.push(`stack:\\n${capped.join('\\n')}`);\n }\n }\n\n return lines.map(line => `- ${line}`).join('\\n');\n }\n\n private withRootKey(payload: object) {\n return this.rootKey ? { [this.rootKey]: payload } : payload;\n }\n\n /** Fail-closed: an unset or unrecognized env is production. */\n private isProduction(opts: { context: Context; error: TThrown; requestId: string }): boolean {\n const { context, error, requestId } = opts;\n const env = [context.env?.NODE_ENV, this.environment?.()].find(Boolean);\n\n if (!env) {\n // Only a host that HAS an ambient environment can be misconfigured about it. In a browser the\n // absence is by design, and shouting it at error level on every request buries the error the\n // reader is actually looking at. Both paths still sanitize.\n if (this.environment) {\n this.logger.error(\n '[%s] INVALID ENV IDENTIFIER | env: %s | path: %s | method: %s | url: %s\\n%s',\n requestId,\n env,\n context.req.path,\n context.req.method,\n context.req.url,\n this.formatError({ error }),\n );\n } else {\n this.logger.debug(\n '[%s] No ambient environment - sanitizing as production | path: %s | set NODE_ENV on the Hono env binding to opt out',\n requestId,\n context.req.path,\n );\n }\n\n return true;\n }\n\n return !EnvironmentNames.DEVELOPMENT_ENVS.has(env.toLowerCase());\n }\n\n private classify(opts: { error: TThrown; dbError: TDatabaseClientError }): TApplicationErrorType {\n const { error, dbError } = opts;\n\n if (dbError.isClientError) {\n return ApplicationErrorTypes.DATABASE_CLIENT;\n }\n\n if (isRetryableDatabaseError({ error })) {\n return ApplicationErrorTypes.DATABASE_RETRYABLE;\n }\n\n if ('statusCode' in error || this.readClientErrorStatus({ error }) !== undefined) {\n return ApplicationErrorTypes.INTENTIONAL;\n }\n\n return ApplicationErrorTypes.UNEXPECTED;\n }\n\n /** Hono's `HTTPException` carries `status`, not `statusCode`. Only a 4xx is the caller's fault; a 5xx stays unexpected, so its message is sanitized. */\n private readClientErrorStatus(opts: { error: TThrown }): number | undefined {\n const { error } = opts;\n\n if (!('getResponse' in error) || !('status' in error) || typeof error.status !== 'number') {\n return undefined;\n }\n\n const isClientError =\n error.status >= HTTP.ResultCodes.RS_4.BadRequest &&\n error.status < HTTP.ResultCodes.RS_5.InternalServerError;\n\n return isClientError ? error.status : undefined;\n }\n\n /** `getError` sets `statusCode`, and it wins when a foreign error carries both. Neither usable is a 500. */\n private readIntentionalStatus(opts: { error: TThrown }): number {\n const { error } = opts;\n\n if ('statusCode' in error && typeof error.statusCode === 'number') {\n return error.statusCode;\n }\n\n return this.readClientErrorStatus({ error }) ?? HTTP.ResultCodes.RS_5.InternalServerError;\n }\n\n /** An ApplicationError's `normalized` is authoritative - a `transform` may have reworded `text`. */\n private build(opts: {\n error: TThrown;\n statusCode: number;\n message: string;\n type: TApplicationErrorType;\n messageCode?: string;\n }): IResolvedApplicationError {\n const { error, statusCode, message, type, messageCode } = opts;\n\n // Fallback for a FOREIGN error that sets its own code; an ApplicationError reports via `normalized`.\n const code =\n messageCode ??\n MessageCode.resolve('messageCode' in error ? (error.messageCode as string) : undefined);\n\n const normalized =\n 'normalized' in error\n ? (error.normalized as IResolvedApplicationError['normalized'])\n : { text: message, code, args: {} };\n\n return { statusCode, message, normalized, type };\n }\n\n private resolve(opts: { error: TThrown; isProduction: boolean }): IResolvedApplicationError {\n const { error, isProduction } = opts;\n const dbError = isDatabaseClientError({ error, isProduction });\n const type = this.classify({ error, dbError });\n\n switch (type) {\n case ApplicationErrorTypes.DATABASE_CLIENT: {\n return this.build({\n error,\n type,\n statusCode: HTTP.ResultCodes.RS_4.BadRequest,\n // The fallback is unreachable today; it keeps the driver's raw text from ever surfacing.\n message: dbError.message ?? DEFAULT_INTERNAL_ERROR_MESSAGE,\n });\n }\n\n case ApplicationErrorTypes.DATABASE_RETRYABLE: {\n return this.build({\n error,\n type,\n statusCode: HTTP.ResultCodes.RS_4.Conflict,\n message: DATABASE_RETRYABLE_ERROR_MESSAGE,\n messageCode: DATABASE_RETRYABLE_ERROR_CODE,\n });\n }\n\n case ApplicationErrorTypes.INTENTIONAL: {\n return this.build({\n error,\n type,\n statusCode: this.readIntentionalStatus({ error }),\n message: error.message,\n });\n }\n\n default: {\n return this.build({\n error,\n type: ApplicationErrorTypes.UNEXPECTED,\n statusCode: HTTP.ResultCodes.RS_5.InternalServerError,\n // Never leak a raw message - it may carry SQL, schema names or connection details.\n message: isProduction ? DEFAULT_INTERNAL_ERROR_MESSAGE : error.message,\n });\n }\n }\n }\n\n /** A throw site may set `logLevel` via `getError`; anything unset or malformed logs at `error`. */\n private resolveLogLevel(opts: { error: TThrown }): TLogLevel {\n const candidate = (opts.error as { logLevel?: unknown }).logLevel;\n\n if (typeof candidate === 'string' && LogLevels.isValid(candidate)) {\n return candidate as TLogLevel;\n }\n\n return LogLevels.ERROR;\n }\n\n /** The one place a thrown error reaches the log - called once the status is known, so it carries it. */\n private logError(opts: {\n error: TThrown;\n context: Context;\n requestId: string;\n statusCode: number;\n messageCode: string;\n type?: TApplicationErrorType;\n }) {\n const { error, context, requestId, statusCode, messageCode, type } = opts;\n\n this.logger.log(\n this.resolveLogLevel({ error }),\n '[%s] REQUEST ERROR | %s | %s %s\\n%s',\n requestId,\n statusCode,\n context.req.method,\n context.req.url,\n this.formatError({\n error,\n // The default code means \"no code\" - logging it on every error would be a noise line.\n messageCode: messageCode === MessageCode.DEFAULT ? undefined : messageCode,\n extra: 'extra' in error ? (error.extra as Record<string, unknown>) : undefined,\n includeStack: true,\n // An intentional error still needs its throw site; it just does not need the caller chain behind it.\n maxStackFrames:\n type === ApplicationErrorTypes.UNEXPECTED\n ? this.unexpectedStackFrames\n : this.intentionalStackFrames,\n }),\n );\n }\n\n /** Only an intentional error's message is a catalog template; every other branch writes its own text, so it passes through as is. */\n private renderMessage(opts: {\n resolved: IResolvedApplicationError;\n isProduction: boolean;\n requestId: string;\n }): string {\n const { resolved, isProduction, requestId } = opts;\n\n if (resolved.type !== ApplicationErrorTypes.INTENTIONAL) {\n return resolved.message;\n }\n\n const { text, missing } = MessageTemplate.render({\n text: resolved.message,\n args: resolved.normalized.args,\n });\n\n // Production stays silent and renders what it can; anywhere else a missing arg is a throw site to fix.\n if (missing.length > 0 && !isProduction) {\n this.logger.warn(\n '[%s] MESSAGE PLACEHOLDER WITHOUT ARG | code: %s | keys: %s',\n requestId,\n resolved.normalized.code,\n missing.join(', '),\n );\n }\n\n return text;\n }\n\n value(): ErrorHandler {\n return async (error, context) => {\n const requestId = context.get(REQUEST_ID_KEY);\n const isProduction = this.isProduction({ context, error, requestId });\n\n if (error.name === 'ZodError') {\n const rs = formatZodError({\n isProduction,\n requestId,\n url: context.req.url,\n path: context.req.path,\n error,\n });\n\n this.logError({\n error,\n context,\n requestId,\n statusCode: rs.statusCode,\n messageCode: rs.response.normalized.code,\n });\n\n return context.json(\n this.withRootKey(rs.response),\n rs.statusCode as Parameters<typeof context.json>[1],\n );\n }\n\n const resolved = this.resolve({ error, isProduction });\n const { statusCode, normalized, type } = resolved;\n\n this.logError({ error, context, requestId, statusCode, messageCode: normalized.code, type });\n\n const rs = {\n message: this.renderMessage({ resolved, isProduction, requestId }),\n statusCode,\n normalized,\n requestId,\n extra: 'extra' in error ? error?.extra : undefined,\n details: {\n url: context.req.url,\n path: context.req.path,\n stack: !isProduction ? error.stack : undefined,\n cause: !isProduction ? error.cause : undefined,\n },\n };\n\n return context.json(this.withRootKey(rs), statusCode as Parameters<typeof context.json>[1]);\n };\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"app-error.middleware.js","sourceRoot":"","sources":["../../../../../src/base/middlewares/app-error/app-error.middleware.ts"],"names":[],"mappings":";;;AAEA,sDAMqC;AACrC,0DAAiE;AAIjE,sCAA2C;AAC3C,yDAAqF;AACrF,6CAIsB;AAEtB,+CAA+C;AAE/C,MAAM,8BAA8B,GAAG,uBAAuB,CAAC;AAE/D,2JAA2J;AAC3J,MAAM,gCAAgC,GAAG,CAAC,CAAC;AAC3C,MAAM,+BAA+B,GAAG,EAAE,CAAC;AAc3C;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,GAAG,CAAC,IAAwB,EAAU,EAAE;IACvD,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC;IAEvB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AO,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC,EAAE,UAAgD,CAAC,CAAC;QAC9F,CAAC,CAAC;IACJ,CAAC;CACF;AAtXD,wDAsXC","sourcesContent":["import type { ILogger, TLogLevel } from '@venizia/ignis-helpers/core';\nimport type { TNullable } from '@venizia/ignis-helpers/common';\nimport {\n BaseHelper,\n EnvironmentNames,\n LogLevels,\n MessageCode,\n MessageTemplate,\n} from '@venizia/ignis-helpers/core';\nimport { HTTP, toJsonSafe } from '@venizia/ignis-helpers/common';\nimport type { IProvider } from '@venizia/ignis-inversion';\nimport type { Context } from 'hono';\nimport type { ErrorHandler, HTTPResponseError } from 'hono/types';\nimport { REQUEST_ID_KEY } from '../common';\nimport { isDatabaseClientError, isRetryableDatabaseError } from './database.handler';\nimport {\n ApplicationErrorTypes,\n DATABASE_RETRYABLE_ERROR_CODE,\n DATABASE_RETRYABLE_ERROR_MESSAGE,\n} from './definition';\nimport type { IResolvedApplicationError, TApplicationErrorType } from './common';\nimport { formatZodError } from './zod.handler';\n\nconst DEFAULT_INTERNAL_ERROR_MESSAGE = 'Internal Server Error';\n\n/** An intentional error's throw site is still worth naming; its caller chain is framework plumbing, so it gets a smaller budget than an unexpected one. */\nconst DEFAULT_INTENTIONAL_STACK_FRAMES = 5;\nconst DEFAULT_UNEXPECTED_STACK_FRAMES = 10;\n\n/** How a thrown error is rendered into the log line. Must never throw - a throw inside the error handler turns a handled failure into an unhandled one. */\nexport type TErrorLogFormatter = (opts: {\n error: unknown;\n messageCode?: string;\n extra?: Record<string, unknown>;\n includeStack?: boolean;\n maxStackFrames?: number;\n}) => string;\n\ntype TThrown = Error | HTTPResponseError;\ntype TDatabaseClientError = ReturnType<typeof isDatabaseClientError>;\n\n/**\n * Renders a value into one log-safe fragment.\n *\n * Redaction is not optional here. This runs on `extra`, which is whatever a throw site chose to\n * attach - `getError({ extra: { apiKey } })` is a shape applications write - and in a Worker this\n * fragment lands in the browser console. `toJsonSafe` masks secret-shaped keys; a hand-rolled\n * `JSON.stringify` does not, and the server path has always redacted.\n *\n * The BigInt replacer stays: `toJsonSafe` leaves BigInt intact and `JSON.stringify` refuses it, so\n * without this a single BigInt would collapse the whole fragment to the marker below. Anything else\n * it refuses yields that marker rather than a throw - this is the last-resort error handler, where a\n * throw turns a handled failure into an unhandled one.\n */\nconst renderValue = (opts: { value: unknown }): string => {\n const { value } = opts;\n\n if (typeof value === 'string') {\n return value;\n }\n\n const safe = toJsonSafe({ value });\n\n try {\n return JSON.stringify(safe) ?? String(value);\n } catch {\n // A replacer is 6x the cost of plain stringify and deopts every key, so it is installed only\n // once BigInt has actually thrown - the case it exists for, and the rare one.\n try {\n const rendered = JSON.stringify(safe, (_key, entry: unknown) =>\n typeof entry === 'bigint' ? entry.toString() : entry,\n );\n\n return rendered ?? String(value);\n } catch {\n // Not a swallowed failure: this marker IS the report, and it lands in the log line the caller\n // is building.\n return '[unrenderable]';\n }\n }\n};\n\n/**\n * Hono `onError`: ZodError -> 422, DB client error -> 400, retryable conflict -> 409, `getError` ->\n * its own status, else 500. Browser-pure: the two reads that need a host - the ambient environment\n * name and the error formatter - are constructor OPTIONS, not methods to subclass.\n *\n * They were hooks once, and three subclasses existed to answer them and nothing else. A class seam\n * is also unreachable from application code, so the browser example had to fake the environment with\n * a Hono middleware assigning `context.env`. `@venizia/ignis`'s `AppErrorMiddleware` now just\n * supplies `process.env.NODE_ENV` and `ErrorPrettier` as options.\n */\nexport class BaseAppErrorMiddleware extends BaseHelper implements IProvider<ErrorHandler> {\n private rootKey: TNullable<string>;\n private intentionalStackFrames: number;\n private unexpectedStackFrames: number;\n\n /**\n * How this host reads its ambient environment name, and the ONE option that says whether it has\n * one at all: absent means it does not (a browser), so an unresolved name is by design; present\n * but returning `undefined` means a host that should have one is misconfigured. Either way\n * {@link isProduction} fails closed.\n *\n * A function, not a string: `process.env.NODE_ENV` has to be read per request, since a test - and\n * a `--env-file` reload - can change it after the middleware is built.\n */\n private readonly environment?: () => string | undefined;\n\n /** Replaces {@link renderErrorForLog} - `@venizia/ignis` passes `ErrorPrettier`, which reaches `node:util` and so cannot live here. */\n private readonly formatErrorOverride?: TErrorLogFormatter;\n\n constructor(opts?: {\n logger?: ILogger;\n rootKey?: string;\n intentionalStackFrames?: number;\n unexpectedStackFrames?: number;\n environment?: () => string | undefined;\n formatError?: TErrorLogFormatter;\n }) {\n // `new.target`, not a literal: a subclass logs under its own name, so `@venizia/ignis`'s\n // `AppErrorMiddleware` keeps the scope it has always logged under.\n super({ scope: new.target.name });\n\n this.rootKey = opts?.rootKey;\n this.intentionalStackFrames = opts?.intentionalStackFrames ?? DEFAULT_INTENTIONAL_STACK_FRAMES;\n this.unexpectedStackFrames = opts?.unexpectedStackFrames ?? DEFAULT_UNEXPECTED_STACK_FRAMES;\n this.environment = opts?.environment;\n this.formatErrorOverride = opts?.formatError;\n\n if (opts?.logger) {\n this.logger = opts.logger;\n }\n }\n\n /** Renders a thrown error for the log, through the `formatError` option when one was given. */\n protected formatError(opts: {\n error: unknown;\n messageCode?: string;\n extra?: Record<string, unknown>;\n includeStack?: boolean;\n maxStackFrames?: number;\n }): string {\n return (this.formatErrorOverride ?? ((o) => this.renderErrorForLog(o)))(opts);\n }\n\n /**\n * The default log rendering: pure and deliberately small, so the whole middleware stays\n * browser-pure.\n *\n * Must never throw, cycles included: a throw inside the error handler turns a handled failure\n * into an unhandled one.\n */\n private renderErrorForLog(opts: {\n error: unknown;\n messageCode?: string;\n extra?: Record<string, unknown>;\n includeStack?: boolean;\n maxStackFrames?: number;\n }): string {\n const { error, messageCode, extra, includeStack = true, maxStackFrames } = opts;\n const thrown = error as Partial<Error> | null | undefined;\n const lines: Array<string> = [];\n\n if (typeof thrown?.name === 'string') {\n lines.push(`name: ${thrown.name}`);\n }\n\n lines.push(\n `message: ${typeof thrown?.message === 'string' ? thrown.message : renderValue({ value: error })}`,\n );\n\n if (messageCode) {\n lines.push(`code: ${messageCode}`);\n }\n\n if (extra && Object.keys(extra).length > 0) {\n lines.push(`extra: ${renderValue({ value: extra })}`);\n }\n\n if (includeStack && typeof thrown?.stack === 'string') {\n const frames = thrown.stack.split('\\n').filter((line) => line.trimStart().startsWith('at '));\n const capped = maxStackFrames === undefined ? frames : frames.slice(0, maxStackFrames);\n\n if (capped.length > 0) {\n lines.push(`stack:\\n${capped.join('\\n')}`);\n }\n }\n\n return lines.map((line) => `- ${line}`).join('\\n');\n }\n\n private withRootKey(payload: object) {\n return this.rootKey ? { [this.rootKey]: payload } : payload;\n }\n\n /** Fail-closed: an unset or unrecognized env is production. */\n private isProduction(opts: { context: Context; error: TThrown; requestId: string }): boolean {\n const { context, error, requestId } = opts;\n const env = [context.env?.NODE_ENV, this.environment?.()].find(Boolean);\n\n if (!env) {\n // Only a host that HAS an ambient environment can be misconfigured about it. In a browser the\n // absence is by design, and shouting it at error level on every request buries the error the\n // reader is actually looking at. Both paths still sanitize.\n if (this.environment) {\n this.logger.error(\n '[%s] INVALID ENV IDENTIFIER | env: %s | path: %s | method: %s | url: %s\\n%s',\n requestId,\n env,\n context.req.path,\n context.req.method,\n context.req.url,\n this.formatError({ error }),\n );\n } else {\n this.logger.debug(\n '[%s] No ambient environment - sanitizing as production | path: %s | set NODE_ENV on the Hono env binding to opt out',\n requestId,\n context.req.path,\n );\n }\n\n return true;\n }\n\n return !EnvironmentNames.DEVELOPMENT_ENVS.has(env.toLowerCase());\n }\n\n private classify(opts: { error: TThrown; dbError: TDatabaseClientError }): TApplicationErrorType {\n const { error, dbError } = opts;\n\n if (dbError.isClientError) {\n return ApplicationErrorTypes.DATABASE_CLIENT;\n }\n\n if (isRetryableDatabaseError({ error })) {\n return ApplicationErrorTypes.DATABASE_RETRYABLE;\n }\n\n if ('statusCode' in error || this.readClientErrorStatus({ error }) !== undefined) {\n return ApplicationErrorTypes.INTENTIONAL;\n }\n\n return ApplicationErrorTypes.UNEXPECTED;\n }\n\n /** Hono's `HTTPException` carries `status`, not `statusCode`. Only a 4xx is the caller's fault; a 5xx stays unexpected, so its message is sanitized. */\n private readClientErrorStatus(opts: { error: TThrown }): number | undefined {\n const { error } = opts;\n\n if (!('getResponse' in error) || !('status' in error) || typeof error.status !== 'number') {\n return undefined;\n }\n\n const isClientError =\n error.status >= HTTP.ResultCodes.RS_4.BadRequest &&\n error.status < HTTP.ResultCodes.RS_5.InternalServerError;\n\n return isClientError ? error.status : undefined;\n }\n\n /** `getError` sets `statusCode`, and it wins when a foreign error carries both. Neither usable is a 500. */\n private readIntentionalStatus(opts: { error: TThrown }): number {\n const { error } = opts;\n\n if ('statusCode' in error && typeof error.statusCode === 'number') {\n return error.statusCode;\n }\n\n return this.readClientErrorStatus({ error }) ?? HTTP.ResultCodes.RS_5.InternalServerError;\n }\n\n /** An ApplicationError's `normalized` is authoritative - a `transform` may have reworded `text`. */\n private build(opts: {\n error: TThrown;\n statusCode: number;\n message: string;\n type: TApplicationErrorType;\n messageCode?: string;\n }): IResolvedApplicationError {\n const { error, statusCode, message, type, messageCode } = opts;\n\n // Fallback for a FOREIGN error that sets its own code; an ApplicationError reports via `normalized`.\n const code =\n messageCode ??\n MessageCode.resolve('messageCode' in error ? (error.messageCode as string) : undefined);\n\n const normalized =\n 'normalized' in error\n ? (error.normalized as IResolvedApplicationError['normalized'])\n : { text: message, code, args: {} };\n\n return { statusCode, message, normalized, type };\n }\n\n private resolve(opts: { error: TThrown; isProduction: boolean }): IResolvedApplicationError {\n const { error, isProduction } = opts;\n const dbError = isDatabaseClientError({ error, isProduction });\n const type = this.classify({ error, dbError });\n\n switch (type) {\n case ApplicationErrorTypes.DATABASE_CLIENT: {\n return this.build({\n error,\n type,\n statusCode: HTTP.ResultCodes.RS_4.BadRequest,\n // The fallback is unreachable today; it keeps the driver's raw text from ever surfacing.\n message: dbError.message ?? DEFAULT_INTERNAL_ERROR_MESSAGE,\n });\n }\n\n case ApplicationErrorTypes.DATABASE_RETRYABLE: {\n return this.build({\n error,\n type,\n statusCode: HTTP.ResultCodes.RS_4.Conflict,\n message: DATABASE_RETRYABLE_ERROR_MESSAGE,\n messageCode: DATABASE_RETRYABLE_ERROR_CODE,\n });\n }\n\n case ApplicationErrorTypes.INTENTIONAL: {\n return this.build({\n error,\n type,\n statusCode: this.readIntentionalStatus({ error }),\n message: error.message,\n });\n }\n\n default: {\n return this.build({\n error,\n type: ApplicationErrorTypes.UNEXPECTED,\n statusCode: HTTP.ResultCodes.RS_5.InternalServerError,\n // Never leak a raw message - it may carry SQL, schema names or connection details.\n message: isProduction ? DEFAULT_INTERNAL_ERROR_MESSAGE : error.message,\n });\n }\n }\n }\n\n /** A throw site may set `logLevel` via `getError`; anything unset or malformed logs at `error`. */\n private resolveLogLevel(opts: { error: TThrown }): TLogLevel {\n const candidate = (opts.error as { logLevel?: unknown }).logLevel;\n\n if (typeof candidate === 'string' && LogLevels.isValid(candidate)) {\n return candidate as TLogLevel;\n }\n\n return LogLevels.ERROR;\n }\n\n /** The one place a thrown error reaches the log - called once the status is known, so it carries it. */\n private logError(opts: {\n error: TThrown;\n context: Context;\n requestId: string;\n statusCode: number;\n messageCode: string;\n type?: TApplicationErrorType;\n }) {\n const { error, context, requestId, statusCode, messageCode, type } = opts;\n\n this.logger.log(\n this.resolveLogLevel({ error }),\n '[%s] REQUEST ERROR | %s | %s %s\\n%s',\n requestId,\n statusCode,\n context.req.method,\n context.req.url,\n this.formatError({\n error,\n // The default code means \"no code\" - logging it on every error would be a noise line.\n messageCode: messageCode === MessageCode.DEFAULT ? undefined : messageCode,\n extra: 'extra' in error ? (error.extra as Record<string, unknown>) : undefined,\n includeStack: true,\n // An intentional error still needs its throw site; it just does not need the caller chain behind it.\n maxStackFrames:\n type === ApplicationErrorTypes.UNEXPECTED\n ? this.unexpectedStackFrames\n : this.intentionalStackFrames,\n }),\n );\n }\n\n /** Only an intentional error's message is a catalog template; every other branch writes its own text, so it passes through as is. */\n private renderMessage(opts: {\n resolved: IResolvedApplicationError;\n isProduction: boolean;\n requestId: string;\n }): string {\n const { resolved, isProduction, requestId } = opts;\n\n if (resolved.type !== ApplicationErrorTypes.INTENTIONAL) {\n return resolved.message;\n }\n\n const { text, missing } = MessageTemplate.render({\n text: resolved.message,\n args: resolved.normalized.args,\n });\n\n // Production stays silent and renders what it can; anywhere else a missing arg is a throw site to fix.\n if (missing.length > 0 && !isProduction) {\n this.logger.warn(\n '[%s] MESSAGE PLACEHOLDER WITHOUT ARG | code: %s | keys: %s',\n requestId,\n resolved.normalized.code,\n missing.join(', '),\n );\n }\n\n return text;\n }\n\n value(): ErrorHandler {\n return async (error, context) => {\n const requestId = context.get(REQUEST_ID_KEY);\n const isProduction = this.isProduction({ context, error, requestId });\n\n if (error.name === 'ZodError') {\n const rs = formatZodError({\n isProduction,\n requestId,\n url: context.req.url,\n path: context.req.path,\n error,\n });\n\n this.logError({\n error,\n context,\n requestId,\n statusCode: rs.statusCode,\n messageCode: rs.response.normalized.code,\n });\n\n return context.json(\n this.withRootKey(rs.response),\n rs.statusCode as Parameters<typeof context.json>[1],\n );\n }\n\n const resolved = this.resolve({ error, isProduction });\n const { statusCode, normalized, type } = resolved;\n\n this.logError({ error, context, requestId, statusCode, messageCode: normalized.code, type });\n\n const rs = {\n message: this.renderMessage({ resolved, isProduction, requestId }),\n statusCode,\n normalized,\n requestId,\n extra: 'extra' in error ? error?.extra : undefined,\n details: {\n url: context.req.url,\n path: context.req.path,\n stack: !isProduction ? error.stack : undefined,\n cause: !isProduction ? error.cause : undefined,\n },\n };\n\n return context.json(this.withRootKey(rs), statusCode as Parameters<typeof context.json>[1]);\n };\n }\n}\n"]}
|
|
@@ -28,7 +28,7 @@ const formatZodError = (opts) => {
|
|
|
28
28
|
let messageCode;
|
|
29
29
|
let message = DEFAULT_VALIDATION_MESSAGE;
|
|
30
30
|
if (issues && issues.length > 0) {
|
|
31
|
-
const primaryIssue = issues.find(issue => extractIssueCode({ issue }) !== undefined) ?? issues[0];
|
|
31
|
+
const primaryIssue = issues.find((issue) => extractIssueCode({ issue }) !== undefined) ?? issues[0];
|
|
32
32
|
messageCode = extractIssueCode({ issue: primaryIssue }) ?? primaryIssue.code;
|
|
33
33
|
message = primaryIssue.message;
|
|
34
34
|
}
|
|
@@ -47,7 +47,7 @@ const formatZodError = (opts) => {
|
|
|
47
47
|
path,
|
|
48
48
|
stack: !isProduction ? error.stack : undefined,
|
|
49
49
|
cause: issues
|
|
50
|
-
? issues.map(el => ({
|
|
50
|
+
? issues.map((el) => ({
|
|
51
51
|
path: el.path.join('.') || 'root',
|
|
52
52
|
message: el.message,
|
|
53
53
|
code: el.code,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zod.handler.js","sourceRoot":"","sources":["../../../../../src/base/middlewares/app-error/zod.handler.ts"],"names":[],"mappings":";;;AAAA,sDAA0D;AAC1D,0DAAqD;AAIrD,MAAM,0BAA0B,GAAG,iBAAiB,CAAC;AAErD,iGAAiG;AACjG,MAAM,gBAAgB,GAAG,CAAC,IAA8B,EAAE,EAAE;IAC1D,MAAM,UAAU,GAAG,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC;IAE5C,IAAI,OAAO,UAAU,KAAK,QAAQ,IAAI,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC5D,OAAO,UAAU,CAAC;IACpB,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC;AAEF,2DAA2D;AACpD,MAAM,cAAc,GAAG,CAAC,IAM9B,EAAE,EAAE;IACH,MAAM,EAAE,YAAY,EAAE,SAAS,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC;IAC3D,MAAM,UAAU,GAAG,aAAI,CAAC,WAAW,CAAC,IAAI,CAAC,mBAAmB,CAAC;IAE7D,IAAI,gBAAyB,CAAC;IAC9B,IAAI,CAAC;QACH,gBAAgB,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAC/C,CAAC;IAAC,MAAM,CAAC;QACP,gBAAg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,CAAC,OAAO;wBACnB,IAAI,EAAE,EAAE,CAAC,IAAI;wBACb,QAAQ,EAAE,EAAE,CAAC,QAAQ;wBACrB,QAAQ,EAAE,EAAE,CAAC,QAAQ;qBACtB,CAAC,CAAC;oBACL,CAAC,CAAC,gBAAgB;aACrB;SACF;KACF,CAAC;AACJ,CAAC,CAAC;AAzDW,QAAA,cAAc,kBAyDzB","sourcesContent":["import { MessageCode } from '@venizia/ignis-helpers/core';\nimport { HTTP } from '@venizia/ignis-helpers/common';\nimport type { HTTPResponseError } from 'hono/types';\nimport type { IZodIssueLike } from './common';\n\nconst DEFAULT_VALIDATION_MESSAGE = 'ValidationError';\n\n/** Returns a schema-author-supplied code (`issue.params.code`) when it is a non-empty string. */\nconst extractIssueCode = (opts: { issue: IZodIssueLike }) => {\n const paramsCode = opts.issue?.params?.code;\n\n if (typeof paramsCode === 'string' && paramsCode.length > 0) {\n return paramsCode;\n }\n\n return undefined;\n};\n\n/** Formats a ZodError into the 422 validation response. */\nexport const formatZodError = (opts: {\n isProduction: boolean;\n requestId: string;\n url: string;\n path: string;\n error: Error | HTTPResponseError;\n}) => {\n const { isProduction, requestId, url, path, error } = opts;\n const statusCode = HTTP.ResultCodes.RS_4.UnprocessableEntity;\n\n let validationErrors: unknown;\n try {\n validationErrors = JSON.parse(error.message);\n } catch {\n validationErrors = error;\n }\n\n const issues = Array.isArray(validationErrors) ? (validationErrors as IZodIssueLike[]) : null;\n\n // Prefer the first issue with a custom `params.code`, else its raw Zod code.\n let messageCode: string | undefined;\n let message = DEFAULT_VALIDATION_MESSAGE;\n\n if (issues && issues.length > 0) {\n const primaryIssue =\n issues.find((issue) => extractIssueCode({ issue }) !== undefined) ?? issues[0];\n messageCode = extractIssueCode({ issue: primaryIssue }) ?? primaryIssue.code;\n message = primaryIssue.message;\n }\n\n // A ZodError we could not parse into issues yields no code of its own; the response still carries one, so no error response is ever missing the field a client branches on.\n const resolvedMessageCode = MessageCode.resolve(messageCode);\n\n return {\n statusCode,\n response: {\n message,\n statusCode,\n // `args` is empty: a Zod issue carries no interpolation values - per-field detail is in `details.cause`.\n normalized: { text: message, code: resolvedMessageCode, args: {} },\n requestId,\n details: {\n url,\n path,\n stack: !isProduction ? error.stack : undefined,\n cause: issues\n ? issues.map((el) => ({\n path: el.path.join('.') || 'root',\n message: el.message,\n code: el.code,\n expected: el.expected,\n received: el.received,\n }))\n : validationErrors,\n },\n },\n };\n};\n"]}
|
|
@@ -10,7 +10,7 @@ const FORM_CONTENT_TYPES = [
|
|
|
10
10
|
/** Whether a route declares a form body, so its validator will parse one. */
|
|
11
11
|
const hasFormBody = (opts) => {
|
|
12
12
|
const { content } = opts;
|
|
13
|
-
return content !== undefined && FORM_CONTENT_TYPES.some(contentType => contentType in content);
|
|
13
|
+
return content !== undefined && FORM_CONTENT_TYPES.some((contentType) => contentType in content);
|
|
14
14
|
};
|
|
15
15
|
exports.hasFormBody = hasFormBody;
|
|
16
16
|
/**
|
|
@@ -20,7 +20,7 @@ exports.hasFormBody = hasFormBody;
|
|
|
20
20
|
*/
|
|
21
21
|
const formBodyReader = async (context, next) => {
|
|
22
22
|
const contentType = context.req.header(common_1.HTTP.Headers.CONTENT_TYPE) ?? '';
|
|
23
|
-
if (FORM_CONTENT_TYPES.some(formType => contentType.includes(formType))) {
|
|
23
|
+
if (FORM_CONTENT_TYPES.some((formType) => contentType.includes(formType))) {
|
|
24
24
|
await (0, core_1.readFormBody)({ req: context.req });
|
|
25
25
|
}
|
|
26
26
|
await next();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form-body.middleware.js","sourceRoot":"","sources":["../../../../../src/base/middlewares/form-body/form-body.middleware.ts"],"names":[],"mappings":";;;AAAA,0DAAqD;AACrD,sDAA2D;AAG3D,MAAM,kBAAkB,GAAG;IACzB,aAAI,CAAC,YAAY,CAAC,mBAAmB;IACrC,aAAI,CAAC,YAAY,CAAC,2BAA2B;CAC9C,CAAC;AAEF,6EAA6E;AACtE,MAAM,WAAW,GAAG,CAAC,IAA2C,EAAW,EAAE;IAClF,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IACzB,OAAO,OAAO,KAAK,SAAS,IAAI,kBAAkB,CAAC,IAAI,CAAC,WAAW,
|
|
1
|
+
{"version":3,"file":"form-body.middleware.js","sourceRoot":"","sources":["../../../../../src/base/middlewares/form-body/form-body.middleware.ts"],"names":[],"mappings":";;;AAAA,0DAAqD;AACrD,sDAA2D;AAG3D,MAAM,kBAAkB,GAAG;IACzB,aAAI,CAAC,YAAY,CAAC,mBAAmB;IACrC,aAAI,CAAC,YAAY,CAAC,2BAA2B;CAC9C,CAAC;AAEF,6EAA6E;AACtE,MAAM,WAAW,GAAG,CAAC,IAA2C,EAAW,EAAE;IAClF,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IACzB,OAAO,OAAO,KAAK,SAAS,IAAI,kBAAkB,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,WAAW,IAAI,OAAO,CAAC,CAAC;AACnG,CAAC,CAAC;AAHW,QAAA,WAAW,eAGtB;AAEF;;;;GAIG;AACI,MAAM,cAAc,GAAsB,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;IACvE,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,aAAI,CAAC,OAAO,CAAC,YAAY,CAAC,IAAI,EAAE,CAAC;IAExE,IAAI,kBAAkB,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,WAAW,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC;QAC1E,MAAM,IAAA,mBAAY,EAAC,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;IAC3C,CAAC;IAED,MAAM,IAAI,EAAE,CAAC;AACf,CAAC,CAAC;AARW,QAAA,cAAc,kBAQzB","sourcesContent":["import { HTTP } from '@venizia/ignis-helpers/common';\nimport { readFormBody } from '@venizia/ignis-helpers/core';\nimport type { MiddlewareHandler } from 'hono/types';\n\nconst FORM_CONTENT_TYPES = [\n HTTP.HeaderValues.MULTIPART_FORM_DATA,\n HTTP.HeaderValues.APPLICATION_FORM_URLENCODED,\n];\n\n/** Whether a route declares a form body, so its validator will parse one. */\nexport const hasFormBody = (opts: { content?: Record<string, unknown> }): boolean => {\n const { content } = opts;\n return content !== undefined && FORM_CONTENT_TYPES.some((contentType) => contentType in content);\n};\n\n/**\n * Parses a declared form body just ahead of the route's validator, which reads the cached result.\n * Left to the validator, a malformed body is a bare `HTTPException(400)` carrying the parser's own\n * text and no code; read here, it is `core.request.body_malformed`.\n */\nexport const formBodyReader: MiddlewareHandler = async (context, next) => {\n const contentType = context.req.header(HTTP.Headers.CONTENT_TYPE) ?? '';\n\n if (FORM_CONTENT_TYPES.some((formType) => contentType.includes(formType))) {\n await readFormBody({ req: context.req });\n }\n\n await next();\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"not-found.middleware.js","sourceRoot":"","sources":["../../../../../src/base/middlewares/not-found/not-found.middleware.ts"],"names":[],"mappings":";;;AACA,0DAAqD;AAErD,sCAA2C;AAEpC,MAAM,eAAe,GAAG,CAAC,IAA0B,EAAE,EAAE;IAC5D,MAAM,EAAE,MAAM,GAAG,OAAO,EAAE,GAAG,IAAI,CAAC;IAElC,MAAM,EAAE,GAAoB,KAAK,
|
|
1
|
+
{"version":3,"file":"not-found.middleware.js","sourceRoot":"","sources":["../../../../../src/base/middlewares/not-found/not-found.middleware.ts"],"names":[],"mappings":";;;AACA,0DAAqD;AAErD,sCAA2C;AAEpC,MAAM,eAAe,GAAG,CAAC,IAA0B,EAAE,EAAE;IAC5D,MAAM,EAAE,MAAM,GAAG,OAAO,EAAE,GAAG,IAAI,CAAC;IAElC,MAAM,EAAE,GAAoB,KAAK,EAAE,OAAO,EAAE,EAAE;QAC5C,MAAM,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,uBAAc,CAAC,CAAC;QAE9C,6FAA6F;QAC7F,+FAA+F;QAC/F,6FAA6F;QAC7F,MAAM,CAAC,IAAI,CACT,yCAAyC,EACzC,SAAS,EACT,OAAO,CAAC,GAAG,CAAC,IAAI,EAChB,OAAO,CAAC,GAAG,CAAC,GAAG,CAChB,CAAC;QAEF,OAAO,OAAO,CAAC,IAAI,CACjB;YACE,OAAO,EAAE,eAAe;YACxB,UAAU,EAAE,aAAI,CAAC,WAAW,CAAC,IAAI,CAAC,QAAQ;YAC1C,SAAS;YACT,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,IAAI;YACtB,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC,GAAG;SACrB,EACD,aAAI,CAAC,WAAW,CAAC,IAAI,CAAC,QAAQ,CAC/B,CAAC;IACJ,CAAC,CAAC;IAEF,OAAO,EAAE,CAAC;AACZ,CAAC,CAAC;AA7BW,QAAA,eAAe,mBA6B1B","sourcesContent":["import type { ILogger } from '@venizia/ignis-helpers/core';\nimport { HTTP } from '@venizia/ignis-helpers/common';\nimport type { NotFoundHandler } from 'hono/types';\nimport { REQUEST_ID_KEY } from '../common';\n\nexport const notFoundHandler = (opts: { logger?: ILogger }) => {\n const { logger = console } = opts;\n\n const mw: NotFoundHandler = async (context) => {\n const requestId = context.get(REQUEST_ID_KEY);\n\n // WARN, not ERROR: an unrouted path is the callers mistake, and this middleware is installed\n // unconditionally - so scanner traffic filled the dedicated error log and tripped error-volume\n // alerting. The same reasoning is already applied to an expired token elsewhere in the tree.\n logger.warn(\n '[%s] URL NOT FOUND | path: %s | url: %s',\n requestId,\n context.req.path,\n context.req.url,\n );\n\n return context.json(\n {\n message: 'URL NOT FOUND',\n statusCode: HTTP.ResultCodes.RS_4.NotFound,\n requestId,\n path: context.req.path,\n url: context.req.url,\n },\n HTTP.ResultCodes.RS_4.NotFound,\n );\n };\n\n return mw;\n};\n"]}
|
|
@@ -17,7 +17,7 @@ const snakeToCamel = (shape) => {
|
|
|
17
17
|
}));
|
|
18
18
|
return zod_openapi_1.z
|
|
19
19
|
.object(shape)
|
|
20
|
-
.transform(data => (0, core_1.keysToCamel)(data))
|
|
20
|
+
.transform((data) => (0, core_1.keysToCamel)(data))
|
|
21
21
|
.pipe(zod_openapi_1.z.object(camelShape));
|
|
22
22
|
};
|
|
23
23
|
exports.snakeToCamel = snakeToCamel;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utilities.js","sourceRoot":"","sources":["../../../../../src/base/models/common/utilities.ts"],"names":[],"mappings":";;;AAAA,mDAAsC;AACtC,sDAA6E;AAG7E,uHAAuH;AAChH,MAAM,UAAU,GAAG,CAAC,IAAuB,EAAa,EAAE;IAC/D,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC5B,MAAM,IAAA,eAAQ,EAAC,EAAE,OAAO,EAAE,uDAAuD,EAAE,CAAC,CAAC;IACvF,CAAC;IAED,OAAO,IAAI,CAAC,KAAkB,CAAC;AACjC,CAAC,CAAC;AANW,QAAA,UAAU,cAMrB;AAYK,MAAM,YAAY,GAAG,CAA0B,KAAQ,EAAE,EAAE;IAChE,MAAM,UAAU,GAAG,MAAM,CAAC,WAAW,CACnC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE;QACzC,OAAO,CAAC,IAAA,cAAO,EAAC,GAAG,CAAC,EAAE,KAAK,CAAC,CAAC;IAC/B,CAAC,CAAC,CACkB,CAAC;IAEvB,OAAO,eAAC;SACL,MAAM,CAAC,KAAK,CAAC;SACb,SAAS,CAAC,IAAI,
|
|
1
|
+
{"version":3,"file":"utilities.js","sourceRoot":"","sources":["../../../../../src/base/models/common/utilities.ts"],"names":[],"mappings":";;;AAAA,mDAAsC;AACtC,sDAA6E;AAG7E,uHAAuH;AAChH,MAAM,UAAU,GAAG,CAAC,IAAuB,EAAa,EAAE;IAC/D,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC5B,MAAM,IAAA,eAAQ,EAAC,EAAE,OAAO,EAAE,uDAAuD,EAAE,CAAC,CAAC;IACvF,CAAC;IAED,OAAO,IAAI,CAAC,KAAkB,CAAC;AACjC,CAAC,CAAC;AANW,QAAA,UAAU,cAMrB;AAYK,MAAM,YAAY,GAAG,CAA0B,KAAQ,EAAE,EAAE;IAChE,MAAM,UAAU,GAAG,MAAM,CAAC,WAAW,CACnC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE;QACzC,OAAO,CAAC,IAAA,cAAO,EAAC,GAAG,CAAC,EAAE,KAAK,CAAC,CAAC;IAC/B,CAAC,CAAC,CACkB,CAAC;IAEvB,OAAO,eAAC;SACL,MAAM,CAAC,KAAK,CAAC;SACb,SAAS,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAA,kBAAW,EAAC,IAAI,CAAC,CAAC;SACtC,IAAI,CAAC,eAAC,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC;AAChC,CAAC,CAAC;AAXW,QAAA,YAAY,gBAWvB","sourcesContent":["import { z } from '@hono/zod-openapi';\nimport { getError, keysToCamel, toCamel } from '@venizia/ignis-helpers/core';\nimport type { TEntityId } from './types';\n\n/** The only way into `TEntityId`. Rejects an empty string - an id that is `''` collapses a `where` to no condition. */\nexport const toEntityId = (opts: { value: string }): TEntityId => {\n if (opts.value.length === 0) {\n throw getError({ message: '[toEntityId] Refusing an empty string as an entity id' });\n }\n\n return opts.value as TEntityId;\n};\n\ntype TSnakeToCamelCase<S extends string> = S extends `${infer T}_${infer U}`\n ? `${T}${Capitalize<TSnakeToCamelCase<U>>}`\n : S;\n\ntype TCamelCaseKeys<T extends z.ZodRawShape> = {\n [K in keyof T as K extends string ? TSnakeToCamelCase<K> : K]: T[K] extends z.ZodType<infer U>\n ? z.ZodType<U>\n : T[K];\n};\n\nexport const snakeToCamel = <T extends z.ZodRawShape>(shape: T) => {\n const camelShape = Object.fromEntries(\n Object.entries(shape).map(([key, value]) => {\n return [toCamel(key), value];\n }),\n ) as TCamelCaseKeys<T>;\n\n return z\n .object(shape)\n .transform((data) => keysToCamel(data))\n .pipe(z.object(camelShape));\n};\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { AbstractDataSource } from '../../../datasources';
|
|
2
2
|
import type { AbstractEntity, IdType } from '../../../models';
|
|
3
|
-
import type { TFilter, TWhere } from '@venizia/ignis-filter';
|
|
3
|
+
import type { TByIdFilter, TFields, TFilter, TRow, TWhere } from '@venizia/ignis-filter';
|
|
4
4
|
import type { TNullable } from '@venizia/ignis-helpers/common';
|
|
5
5
|
import type { IExtraOptions, TFindOneOptions, TFindOptions, TFindRangeOptions } from './options';
|
|
6
6
|
import type { TCount, TDataWithRange } from './results';
|
|
@@ -23,23 +23,23 @@ export interface IReadableRepository<TDataObject extends object = object, ExtraO
|
|
|
23
23
|
where: TWhere<TDataObject>;
|
|
24
24
|
options?: ExtraOptions;
|
|
25
25
|
}): Promise<boolean>;
|
|
26
|
-
find<R = TDataObject>(opts: {
|
|
27
|
-
filter: TFilter<TDataObject>;
|
|
28
|
-
options: TFindRangeOptions<ExtraOptions, R
|
|
29
|
-
}): Promise<TDataWithRange<R
|
|
30
|
-
find<R = TDataObject>(opts: {
|
|
31
|
-
filter: TFilter<TDataObject>;
|
|
32
|
-
options?: TFindOptions<ExtraOptions, R
|
|
33
|
-
}): Promise<Array<R
|
|
34
|
-
findOne<R = TDataObject>(opts: {
|
|
35
|
-
filter: TFilter<TDataObject>;
|
|
36
|
-
options?: TFindOneOptions<ExtraOptions, R
|
|
37
|
-
}): Promise<TNullable<R
|
|
38
|
-
findById<R = TDataObject>(opts: {
|
|
26
|
+
find<R = unknown, const F extends TFields<TDataObject> = TFields<TDataObject>>(opts: {
|
|
27
|
+
filter: TFilter<TDataObject, F>;
|
|
28
|
+
options: TFindRangeOptions<ExtraOptions, TRow<TDataObject, R, F>>;
|
|
29
|
+
}): Promise<TDataWithRange<TRow<TDataObject, R, F>>>;
|
|
30
|
+
find<R = unknown, const F extends TFields<TDataObject> = TFields<TDataObject>>(opts: {
|
|
31
|
+
filter: TFilter<TDataObject, F>;
|
|
32
|
+
options?: TFindOptions<ExtraOptions, TRow<TDataObject, R, F>>;
|
|
33
|
+
}): Promise<Array<TRow<TDataObject, R, F>>>;
|
|
34
|
+
findOne<R = unknown, const F extends TFields<TDataObject> = TFields<TDataObject>>(opts: {
|
|
35
|
+
filter: TFilter<TDataObject, F>;
|
|
36
|
+
options?: TFindOneOptions<ExtraOptions, TRow<TDataObject, R, F>>;
|
|
37
|
+
}): Promise<TNullable<TRow<TDataObject, R, F>>>;
|
|
38
|
+
findById<R = unknown, const F extends TFields<TDataObject> = TFields<TDataObject>>(opts: {
|
|
39
39
|
id: IdType;
|
|
40
|
-
filter?:
|
|
41
|
-
options?: TFindOneOptions<ExtraOptions, R
|
|
42
|
-
}): Promise<TNullable<R
|
|
40
|
+
filter?: TByIdFilter<TDataObject, F>;
|
|
41
|
+
options?: TFindOneOptions<ExtraOptions, TRow<TDataObject, R, F>>;
|
|
42
|
+
}): Promise<TNullable<TRow<TDataObject, R, F>>>;
|
|
43
43
|
}
|
|
44
44
|
/** Interface for create operations. */
|
|
45
45
|
export interface ICreatableRepository<TDataObject extends object = object, TPersistObject extends object = TDataObject, ExtraOptions extends IExtraOptions = IExtraOptions> extends IRepository {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contracts.d.ts","sourceRoot":"","sources":["../../../../../../src/base/repositories/common/types/contracts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAC5D,OAAO,KAAK,EAAE,OAAO,EAAE,MAA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AAM,EACnC,cAAc,SAAS,MAAM,GAAG,WAAW,EAC3C,YAAY,SAAS,aAAa,GAAG,aAAa,CAClD,SAAQ,sBAAsB,CAAC,WAAW,EAAE,cAAc,EAAE,YAAY,CAAC;CAAG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contracts.js","sourceRoot":"","sources":["../../../../../../src/base/repositories/common/types/contracts.ts"],"names":[],"mappings":"","sourcesContent":["import type { AbstractDataSource } from '@/base/datasources';\nimport type { AbstractEntity, IdType } from '@/base/models';\nimport type { TFilter, TWhere } from '@venizia/ignis-filter';\nimport type { TNullable } from '@venizia/ignis-helpers/common';\nimport type { IExtraOptions, TFindOneOptions, TFindOptions, TFindRangeOptions } from './options';\nimport type { TCount, TDataWithRange } from './results';\n\n/**\n * Base repository interface shared by every engine - engine-specific accessors (postgres's\n * `getEntitySchema()`/`getConnector()`) stay on the connector's own repository tier.\n */\nexport interface IRepository {\n dataSource: AbstractDataSource;\n entity: AbstractEntity;\n getEntity(): AbstractEntity;\n}\n\n/** Interface for read-only repository operations. `TDataObject` is the row/document shape itself. */\nexport interface IReadableRepository<\n TDataObject extends object = object,\n ExtraOptions extends IExtraOptions = IExtraOptions,\n> extends IRepository {\n count(opts: { where: TWhere<TDataObject>; options?: ExtraOptions }): Promise<TCount>;\n existsWith(opts: { where: TWhere<TDataObject>; options?: ExtraOptions }): Promise<boolean>;\n\n find<R = TDataObject>(opts: {\n filter: TFilter<TDataObject>;\n options: TFindRangeOptions<ExtraOptions, R
|
|
1
|
+
{"version":3,"file":"contracts.js","sourceRoot":"","sources":["../../../../../../src/base/repositories/common/types/contracts.ts"],"names":[],"mappings":"","sourcesContent":["import type { AbstractDataSource } from '@/base/datasources';\nimport type { AbstractEntity, IdType } from '@/base/models';\nimport type { TByIdFilter, TFields, TFilter, TRow, TWhere } from '@venizia/ignis-filter';\nimport type { TNullable } from '@venizia/ignis-helpers/common';\nimport type { IExtraOptions, TFindOneOptions, TFindOptions, TFindRangeOptions } from './options';\nimport type { TCount, TDataWithRange } from './results';\n\n/**\n * Base repository interface shared by every engine - engine-specific accessors (postgres's\n * `getEntitySchema()`/`getConnector()`) stay on the connector's own repository tier.\n */\nexport interface IRepository {\n dataSource: AbstractDataSource;\n entity: AbstractEntity;\n getEntity(): AbstractEntity;\n}\n\n/** Interface for read-only repository operations. `TDataObject` is the row/document shape itself. */\nexport interface IReadableRepository<\n TDataObject extends object = object,\n ExtraOptions extends IExtraOptions = IExtraOptions,\n> extends IRepository {\n count(opts: { where: TWhere<TDataObject>; options?: ExtraOptions }): Promise<TCount>;\n existsWith(opts: { where: TWhere<TDataObject>; options?: ExtraOptions }): Promise<boolean>;\n\n find<R = unknown, const F extends TFields<TDataObject> = TFields<TDataObject>>(opts: {\n filter: TFilter<TDataObject, F>;\n options: TFindRangeOptions<ExtraOptions, TRow<TDataObject, R, F>>;\n }): Promise<TDataWithRange<TRow<TDataObject, R, F>>>;\n\n find<R = unknown, const F extends TFields<TDataObject> = TFields<TDataObject>>(opts: {\n filter: TFilter<TDataObject, F>;\n options?: TFindOptions<ExtraOptions, TRow<TDataObject, R, F>>;\n }): Promise<Array<TRow<TDataObject, R, F>>>;\n\n findOne<R = unknown, const F extends TFields<TDataObject> = TFields<TDataObject>>(opts: {\n filter: TFilter<TDataObject, F>;\n options?: TFindOneOptions<ExtraOptions, TRow<TDataObject, R, F>>;\n }): Promise<TNullable<TRow<TDataObject, R, F>>>;\n\n findById<R = unknown, const F extends TFields<TDataObject> = TFields<TDataObject>>(opts: {\n id: IdType;\n filter?: TByIdFilter<TDataObject, F>;\n options?: TFindOneOptions<ExtraOptions, TRow<TDataObject, R, F>>;\n }): Promise<TNullable<TRow<TDataObject, R, F>>>;\n}\n\n/** Interface for create operations. */\nexport interface ICreatableRepository<\n TDataObject extends object = object,\n TPersistObject extends object = TDataObject,\n ExtraOptions extends IExtraOptions = IExtraOptions,\n> extends IRepository {\n create(opts: {\n data: TPersistObject;\n options: ExtraOptions & { shouldReturn: false };\n }): Promise<TCount & { data: undefined | null }>;\n\n create<R = TDataObject>(opts: {\n data: TPersistObject;\n options?: ExtraOptions & { shouldReturn?: true };\n }): Promise<TCount & { data: R }>;\n\n createAll(opts: {\n data: Array<TPersistObject>;\n options: ExtraOptions & { shouldReturn: false };\n }): Promise<TCount & { data: undefined | null }>;\n\n createAll<R = TDataObject>(opts: {\n data: Array<TPersistObject>;\n options?: ExtraOptions & { shouldReturn?: true };\n }): Promise<TCount & { data: Array<R> }>;\n}\n\n/** Interface for update operations. */\nexport interface IUpdatableRepository<\n TDataObject extends object = object,\n TPersistObject extends object = TDataObject,\n ExtraOptions extends IExtraOptions = IExtraOptions,\n> extends IRepository {\n updateById(opts: {\n id: IdType;\n data: Partial<TPersistObject>;\n options: ExtraOptions & { shouldReturn: false };\n }): Promise<TCount & { data: undefined | null }>;\n\n updateById<R = TDataObject>(opts: {\n id: IdType;\n data: Partial<TPersistObject>;\n options?: ExtraOptions & { shouldReturn?: true };\n }): Promise<TCount & { data: R }>;\n\n updateAll(opts: {\n data: Partial<TPersistObject>;\n where: TWhere<TDataObject>;\n options: ExtraOptions & { shouldReturn: false; force?: boolean };\n }): Promise<TCount & { data: undefined | null }>;\n\n updateAll<R = TDataObject>(opts: {\n data: Partial<TPersistObject>;\n where: TWhere<TDataObject>;\n options?: ExtraOptions & { shouldReturn?: true; force?: boolean };\n }): Promise<TCount & { data: Array<R> | null }>;\n\n /** Alias for updateAll. */\n updateBy(opts: {\n data: Partial<TPersistObject>;\n where: TWhere<TDataObject>;\n options: ExtraOptions & { shouldReturn: false; force?: boolean };\n }): Promise<TCount & { data: undefined | null }>;\n\n /** Alias for updateAll. */\n updateBy<R = TDataObject>(opts: {\n data: Partial<TPersistObject>;\n where: TWhere<TDataObject>;\n options?: ExtraOptions & { shouldReturn?: true; force?: boolean };\n }): Promise<TCount & { data: Array<R> | null }>;\n}\n\n/** Interface for delete operations. */\nexport interface IDeletableRepository<\n TDataObject extends object = object,\n ExtraOptions extends IExtraOptions = IExtraOptions,\n> extends IRepository {\n deleteById(opts: {\n id: IdType;\n options: ExtraOptions & { shouldReturn: false };\n }): Promise<TCount & { data: undefined | null }>;\n\n deleteById<R = TDataObject>(opts: {\n id: IdType;\n options?: ExtraOptions & { shouldReturn?: true };\n }): Promise<TCount & { data: R }>;\n\n deleteAll(opts: {\n where?: TWhere<TDataObject>;\n options: ExtraOptions & { shouldReturn: false; force?: boolean };\n }): Promise<TCount & { data: undefined | null }>;\n\n deleteAll<R = TDataObject>(opts: {\n where?: TWhere<TDataObject>;\n options?: ExtraOptions & { shouldReturn?: true; force?: boolean };\n }): Promise<TCount & { data: Array<R> | null }>;\n\n /** Alias for deleteAll. */\n deleteBy(opts: {\n where?: TWhere<TDataObject>;\n options: ExtraOptions & { shouldReturn: false; force?: boolean };\n }): Promise<TCount & { data: undefined | null }>;\n\n /** Alias for deleteAll. */\n deleteBy<R = TDataObject>(opts: {\n where?: TWhere<TDataObject>;\n options?: ExtraOptions & { shouldReturn?: true; force?: boolean };\n }): Promise<TCount & { data: Array<R> | null }>;\n}\n\n/** Interface for full CRUD repository operations - reads plus create, update, and delete. */\nexport interface IPersistableRepository<\n TDataObject extends object = object,\n TPersistObject extends object = TDataObject,\n ExtraOptions extends IExtraOptions = IExtraOptions,\n>\n extends\n IReadableRepository<TDataObject, ExtraOptions>,\n ICreatableRepository<TDataObject, TPersistObject, ExtraOptions>,\n IUpdatableRepository<TDataObject, TPersistObject, ExtraOptions>,\n IDeletableRepository<TDataObject, ExtraOptions> {}\n\n/**\n * Alias for IPersistableRepository - the name both DefaultRelationalRepository and\n * DefaultSearchRepository satisfy.\n */\nexport interface ICrudRepository<\n TDataObject extends object = object,\n TPersistObject extends object = TDataObject,\n ExtraOptions extends IExtraOptions = IExtraOptions,\n> extends IPersistableRepository<TDataObject, TPersistObject, ExtraOptions> {}\n"]}
|
|
@@ -4,7 +4,7 @@ import type { IModelMetadata } from '../../../helpers/inversion';
|
|
|
4
4
|
import type { TClass, TNullable } from '@venizia/ignis-helpers/common';
|
|
5
5
|
import { BaseHelper } from '@venizia/ignis-helpers/core';
|
|
6
6
|
import type { IExtraOptions, IPersistableRepository, IWithReadRetry, TCount, TDataWithRange, TFindOneOptions, TFindOptions, TFindRangeOptions, TRepositoryOperationScope } from '../common';
|
|
7
|
-
import type { TFilter, TWhere } from '@venizia/ignis-filter';
|
|
7
|
+
import type { TByIdFilter, TFields, TFilter, TRow, TWhere } from '@venizia/ignis-filter';
|
|
8
8
|
/**
|
|
9
9
|
* Engine-neutral repository plumbing - lazy dataSource/entity resolution, class-keyed `@model`
|
|
10
10
|
* settings, operation scope. `TOptions` defaults to `IExtraOptions` so connectors can narrow it
|
|
@@ -122,23 +122,23 @@ export declare abstract class AbstractRepository<TDataObject extends object, TPe
|
|
|
122
122
|
where: TWhere<TDataObject>;
|
|
123
123
|
options?: TOptions;
|
|
124
124
|
}): Promise<boolean>;
|
|
125
|
-
abstract find<R = TDataObject>(opts: {
|
|
126
|
-
filter: TFilter<TDataObject>;
|
|
127
|
-
options: TFindRangeOptions<TOptions, R
|
|
128
|
-
}): Promise<TDataWithRange<R
|
|
129
|
-
abstract find<R = TDataObject>(opts: {
|
|
130
|
-
filter: TFilter<TDataObject>;
|
|
131
|
-
options?: TFindOptions<TOptions, R
|
|
132
|
-
}): Promise<R
|
|
133
|
-
abstract findOne<R = TDataObject>(opts: {
|
|
134
|
-
filter: TFilter<TDataObject>;
|
|
135
|
-
options?: TFindOneOptions<TOptions, R
|
|
136
|
-
}): Promise<TNullable<R
|
|
137
|
-
abstract findById<R = TDataObject>(opts: {
|
|
125
|
+
abstract find<R = unknown, const F extends TFields<TDataObject> = TFields<TDataObject>>(opts: {
|
|
126
|
+
filter: TFilter<TDataObject, F>;
|
|
127
|
+
options: TFindRangeOptions<TOptions, TRow<TDataObject, R, F>>;
|
|
128
|
+
}): Promise<TDataWithRange<TRow<TDataObject, R, F>>>;
|
|
129
|
+
abstract find<R = unknown, const F extends TFields<TDataObject> = TFields<TDataObject>>(opts: {
|
|
130
|
+
filter: TFilter<TDataObject, F>;
|
|
131
|
+
options?: TFindOptions<TOptions, TRow<TDataObject, R, F>>;
|
|
132
|
+
}): Promise<Array<TRow<TDataObject, R, F>>>;
|
|
133
|
+
abstract findOne<R = unknown, const F extends TFields<TDataObject> = TFields<TDataObject>>(opts: {
|
|
134
|
+
filter: TFilter<TDataObject, F>;
|
|
135
|
+
options?: TFindOneOptions<TOptions, TRow<TDataObject, R, F>>;
|
|
136
|
+
}): Promise<TNullable<TRow<TDataObject, R, F>>>;
|
|
137
|
+
abstract findById<R = unknown, const F extends TFields<TDataObject> = TFields<TDataObject>>(opts: {
|
|
138
138
|
id: IdType;
|
|
139
|
-
filter?:
|
|
140
|
-
options?: TFindOneOptions<TOptions, R
|
|
141
|
-
}): Promise<TNullable<R
|
|
139
|
+
filter?: TByIdFilter<TDataObject, F>;
|
|
140
|
+
options?: TFindOneOptions<TOptions, TRow<TDataObject, R, F>>;
|
|
141
|
+
}): Promise<TNullable<TRow<TDataObject, R, F>>>;
|
|
142
142
|
abstract create(opts: {
|
|
143
143
|
data: TPersistObject;
|
|
144
144
|
options: TOptions & {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"abstract.d.ts","sourceRoot":"","sources":["../../../../../src/base/repositories/core/abstract.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAC5D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAE1D,OAAO,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AACvE,OAAO,EAAE,UAAU,EAAY,MAAM,6BAA6B,CAAC;AAGnE,OAAO,KAAK,EACV,aAAa,EACb,sBAAsB,EACtB,cAAc,EACd,MAAM,EACN,cAAc,EACd,eAAe,EACf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AE,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,GAAG,IAAI,CAAA;KAAE,CAAC;IAE/C,2BAA2B;IAC3B,QAAQ,CAAC,IAAI,EAAE;QACb,KAAK,EAAE,MAAM,CAAC,WAAW,CAAC,CAAC;QAC3B,OAAO,EAAE,QAAQ,GAAG;YAAE,YAAY,EAAE,KAAK,CAAC;YAAC,KAAK,CAAC,EAAE,OAAO,CAAA;SAAE,CAAC;KAC9D,GAAG,OAAO,CAAC,MAAM,GAAG;QAAE,IAAI,EAAE,SAAS,GAAG,IAAI,CAAA;KAAE,CAAC;IAChD,QAAQ,CAAC,CAAC,GAAG,WAAW,EAAE,IAAI,EAAE;QAC9B,KAAK,EAAE,MAAM,CAAC,WAAW,CAAC,CAAC;QAC3B,OAAO,CAAC,EAAE,QAAQ,GAAG;YAAE,YAAY,CAAC,EAAE,IAAI,CAAC;YAAC,KAAK,CAAC,EAAE,OAAO,CAAA;SAAE,CAAC;KAC/D,GAAG,OAAO,CAAC,MAAM,GAAG;QAAE,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,GAAG,IAAI,CAAA;KAAE,CAAC;CAahD"}
|
|
@@ -225,7 +225,8 @@ class AbstractRepository extends core_1.BaseHelper {
|
|
|
225
225
|
return this.executeReadWithRetry({
|
|
226
226
|
operation: 'find',
|
|
227
227
|
options: opts.options,
|
|
228
|
-
defaultUntil: result => result.length > 0,
|
|
228
|
+
defaultUntil: (result) => result.length > 0,
|
|
229
|
+
// `R` is named here, so the row is `R`; TypeScript cannot resolve `TRow` for an unresolved `R`.
|
|
229
230
|
execution: () => this.find({ filter: opts.filter, options }),
|
|
230
231
|
});
|
|
231
232
|
}
|
|
@@ -235,7 +236,7 @@ class AbstractRepository extends core_1.BaseHelper {
|
|
|
235
236
|
return this.executeReadWithRetry({
|
|
236
237
|
operation: 'find',
|
|
237
238
|
options: opts.options,
|
|
238
|
-
defaultUntil: result => result.data.length > 0,
|
|
239
|
+
defaultUntil: (result) => result.data.length > 0,
|
|
239
240
|
execution: () => this.find({ filter: opts.filter, options }),
|
|
240
241
|
});
|
|
241
242
|
}
|
|
@@ -245,7 +246,7 @@ class AbstractRepository extends core_1.BaseHelper {
|
|
|
245
246
|
return this.executeReadWithRetry({
|
|
246
247
|
operation: 'findOne',
|
|
247
248
|
options: opts.options,
|
|
248
|
-
defaultUntil: result => result !== null && result !== undefined,
|
|
249
|
+
defaultUntil: (result) => result !== null && result !== undefined,
|
|
249
250
|
execution: () => this.findOne({ filter: opts.filter, options }),
|
|
250
251
|
});
|
|
251
252
|
}
|