@nestarc/soft-delete
Classes
CascadeDmmfMissingError
Defined in: src/errors/cascade-dmmf-missing.error.ts:1
Extends
Error
Constructors
Constructor
new CascadeDmmfMissingError(): CascadeDmmfMissingError;Defined in: src/errors/cascade-dmmf-missing.error.ts:2
Returns
Overrides
Error.constructorProperties
cause?
optional cause?: unknown;Defined in: node_modules/typescript/lib/lib.es2022.error.d.ts:26
Inherited from
Error.causemessage
message: string;Defined in: node_modules/typescript/lib/lib.es5.d.ts:1077
Inherited from
Error.messagename
name: string;Defined in: node_modules/typescript/lib/lib.es5.d.ts:1076
Inherited from
Error.namestack?
optional stack?: string;Defined in: node_modules/typescript/lib/lib.es5.d.ts:1078
Inherited from
Error.stackstackTraceLimit
static stackTraceLimit: number;Defined in: node_modules/@types/node/globals.d.ts:67
The Error.stackTraceLimit property specifies the number of stack frames collected by a stack trace (whether generated by new Error().stack or Error.captureStackTrace(obj)).
The default value is 10 but may be set to any valid JavaScript number. Changes will affect any stack trace captured after the value has been changed.
If set to a non-number value, or set to a negative number, stack traces will not capture any frames.
Inherited from
Error.stackTraceLimitMethods
captureStackTrace()
static captureStackTrace(targetObject, constructorOpt?): void;Defined in: node_modules/@types/node/globals.d.ts:51
Creates a .stack property on targetObject, which when accessed returns a string representing the location in the code at which Error.captureStackTrace() was called.
const myObject = {};
Error.captureStackTrace(myObject);
myObject.stack; // Similar to `new Error().stack`The first line of the trace will be prefixed with ${myObject.name}: ${myObject.message}.
The optional constructorOpt argument accepts a function. If given, all frames above constructorOpt, including constructorOpt, will be omitted from the generated stack trace.
The constructorOpt argument is useful for hiding implementation details of error generation from the user. For instance:
function a() {
b();
}
function b() {
c();
}
function c() {
// Create an error without stack trace to avoid calculating the stack trace twice.
const { stackTraceLimit } = Error;
Error.stackTraceLimit = 0;
const error = new Error();
Error.stackTraceLimit = stackTraceLimit;
// Capture the stack trace above function b
Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace
throw error;
}
a();Parameters
| Parameter | Type |
|---|---|
targetObject | object |
constructorOpt? | Function |
Returns
void
Inherited from
Error.captureStackTraceprepareStackTrace()
static prepareStackTrace(err, stackTraces): any;Defined in: node_modules/@types/node/globals.d.ts:55
Parameters
| Parameter | Type |
|---|---|
err | Error |
stackTraces | CallSite[] |
Returns
any
See
https://v8.dev/docs/stack-trace-api#customizing-stack-traces
Inherited from
Error.prepareStackTraceCascadeRelationNotFoundError
Defined in: src/errors/cascade-relation-not-found.error.ts:1
Extends
Error
Constructors
Constructor
new CascadeRelationNotFoundError(parent, child): CascadeRelationNotFoundError;Defined in: src/errors/cascade-relation-not-found.error.ts:2
Parameters
| Parameter | Type |
|---|---|
parent | string |
child | string |
Returns
Overrides
Error.constructorProperties
cause?
optional cause?: unknown;Defined in: node_modules/typescript/lib/lib.es2022.error.d.ts:26
Inherited from
Error.causemessage
message: string;Defined in: node_modules/typescript/lib/lib.es5.d.ts:1077
Inherited from
Error.messagename
name: string;Defined in: node_modules/typescript/lib/lib.es5.d.ts:1076
Inherited from
Error.namestack?
optional stack?: string;Defined in: node_modules/typescript/lib/lib.es5.d.ts:1078
Inherited from
Error.stackstackTraceLimit
static stackTraceLimit: number;Defined in: node_modules/@types/node/globals.d.ts:67
The Error.stackTraceLimit property specifies the number of stack frames collected by a stack trace (whether generated by new Error().stack or Error.captureStackTrace(obj)).
The default value is 10 but may be set to any valid JavaScript number. Changes will affect any stack trace captured after the value has been changed.
If set to a non-number value, or set to a negative number, stack traces will not capture any frames.
Inherited from
Error.stackTraceLimitMethods
captureStackTrace()
static captureStackTrace(targetObject, constructorOpt?): void;Defined in: node_modules/@types/node/globals.d.ts:51
Creates a .stack property on targetObject, which when accessed returns a string representing the location in the code at which Error.captureStackTrace() was called.
const myObject = {};
Error.captureStackTrace(myObject);
myObject.stack; // Similar to `new Error().stack`The first line of the trace will be prefixed with ${myObject.name}: ${myObject.message}.
The optional constructorOpt argument accepts a function. If given, all frames above constructorOpt, including constructorOpt, will be omitted from the generated stack trace.
The constructorOpt argument is useful for hiding implementation details of error generation from the user. For instance:
function a() {
b();
}
function b() {
c();
}
function c() {
// Create an error without stack trace to avoid calculating the stack trace twice.
const { stackTraceLimit } = Error;
Error.stackTraceLimit = 0;
const error = new Error();
Error.stackTraceLimit = stackTraceLimit;
// Capture the stack trace above function b
Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace
throw error;
}
a();Parameters
| Parameter | Type |
|---|---|
targetObject | object |
constructorOpt? | Function |
Returns
void
Inherited from
Error.captureStackTraceprepareStackTrace()
static prepareStackTrace(err, stackTraces): any;Defined in: node_modules/@types/node/globals.d.ts:55
Parameters
| Parameter | Type |
|---|---|
err | Error |
stackTraces | CallSite[] |
Returns
any
See
https://v8.dev/docs/stack-trace-api#customizing-stack-traces
Inherited from
Error.prepareStackTracePurgedEvent
Defined in: src/events/soft-delete.events.ts:24
Constructors
Constructor
new PurgedEvent(
model,
count,
olderThan): PurgedEvent;Defined in: src/events/soft-delete.events.ts:27
Parameters
| Parameter | Type |
|---|---|
model | string |
count | number |
olderThan | Date |
Returns
Properties
count
readonly count: number;Defined in: src/events/soft-delete.events.ts:29
EVENT_NAME
readonly static EVENT_NAME: "soft-delete.purged";Defined in: src/events/soft-delete.events.ts:25
model
readonly model: string;Defined in: src/events/soft-delete.events.ts:28
olderThan
readonly olderThan: Date;Defined in: src/events/soft-delete.events.ts:30
RelationDmmfMissingError
Defined in: src/errors/relation-dmmf-missing.error.ts:1
Extends
Error
Constructors
Constructor
new RelationDmmfMissingError(): RelationDmmfMissingError;Defined in: src/errors/relation-dmmf-missing.error.ts:2
Returns
Overrides
Error.constructorProperties
cause?
optional cause?: unknown;Defined in: node_modules/typescript/lib/lib.es2022.error.d.ts:26
Inherited from
Error.causemessage
message: string;Defined in: node_modules/typescript/lib/lib.es5.d.ts:1077
Inherited from
Error.messagename
name: string;Defined in: node_modules/typescript/lib/lib.es5.d.ts:1076
Inherited from
Error.namestack?
optional stack?: string;Defined in: node_modules/typescript/lib/lib.es5.d.ts:1078
Inherited from
Error.stackstackTraceLimit
static stackTraceLimit: number;Defined in: node_modules/@types/node/globals.d.ts:67
The Error.stackTraceLimit property specifies the number of stack frames collected by a stack trace (whether generated by new Error().stack or Error.captureStackTrace(obj)).
The default value is 10 but may be set to any valid JavaScript number. Changes will affect any stack trace captured after the value has been changed.
If set to a non-number value, or set to a negative number, stack traces will not capture any frames.
Inherited from
Error.stackTraceLimitMethods
captureStackTrace()
static captureStackTrace(targetObject, constructorOpt?): void;Defined in: node_modules/@types/node/globals.d.ts:51
Creates a .stack property on targetObject, which when accessed returns a string representing the location in the code at which Error.captureStackTrace() was called.
const myObject = {};
Error.captureStackTrace(myObject);
myObject.stack; // Similar to `new Error().stack`The first line of the trace will be prefixed with ${myObject.name}: ${myObject.message}.
The optional constructorOpt argument accepts a function. If given, all frames above constructorOpt, including constructorOpt, will be omitted from the generated stack trace.
The constructorOpt argument is useful for hiding implementation details of error generation from the user. For instance:
function a() {
b();
}
function b() {
c();
}
function c() {
// Create an error without stack trace to avoid calculating the stack trace twice.
const { stackTraceLimit } = Error;
Error.stackTraceLimit = 0;
const error = new Error();
Error.stackTraceLimit = stackTraceLimit;
// Capture the stack trace above function b
Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace
throw error;
}
a();Parameters
| Parameter | Type |
|---|---|
targetObject | object |
constructorOpt? | Function |
Returns
void
Inherited from
Error.captureStackTraceprepareStackTrace()
static prepareStackTrace(err, stackTraces): any;Defined in: node_modules/@types/node/globals.d.ts:55
Parameters
| Parameter | Type |
|---|---|
err | Error |
stackTraces | CallSite[] |
Returns
any
See
https://v8.dev/docs/stack-trace-api#customizing-stack-traces
Inherited from
Error.prepareStackTraceRestoredEvent
Defined in: src/events/soft-delete.events.ts:13
Constructors
Constructor
new RestoredEvent(
model,
where,
actorId?,
count?): RestoredEvent;Defined in: src/events/soft-delete.events.ts:16
Parameters
| Parameter | Type | Default value |
|---|---|---|
model | string | undefined |
where | Record<string, unknown> | undefined |
actorId | string | null | null |
count? | number | undefined |
Returns
Properties
actorId
readonly actorId: string | null = null;Defined in: src/events/soft-delete.events.ts:19
count?
readonly optional count?: number;Defined in: src/events/soft-delete.events.ts:20
EVENT_NAME
readonly static EVENT_NAME: "soft-delete.restored";Defined in: src/events/soft-delete.events.ts:14
model
readonly model: string;Defined in: src/events/soft-delete.events.ts:17
where
readonly where: Record<string, unknown>;Defined in: src/events/soft-delete.events.ts:18
SoftDeleteContext
Defined in: src/services/soft-delete-context.ts:4
Constructors
Constructor
new SoftDeleteContext(): SoftDeleteContext;Returns
Methods
getActorId()
static getActorId(): string | null;Defined in: src/services/soft-delete-context.ts:44
Returns
string | null
getFilterMode()
static getFilterMode(): SoftDeleteFilterMode;Defined in: src/services/soft-delete-context.ts:36
Returns
getWithDeletedRelationPaths()
static getWithDeletedRelationPaths(): string[];Defined in: src/services/soft-delete-context.ts:48
Returns
string[]
isSkipped()
static isSkipped(): boolean;Defined in: src/services/soft-delete-context.ts:40
Returns
boolean
isWithDeletedRelationPath()
static isWithDeletedRelationPath(path): boolean;Defined in: src/services/soft-delete-context.ts:52
Parameters
| Parameter | Type |
|---|---|
path | string |
Returns
boolean
run()
static run<T>(store, callback): T;Defined in: src/services/soft-delete-context.ts:16
Runs a callback within the given soft-delete context store.
Supports both synchronous and asynchronous callbacks. When the callback returns a Promise (e.g. a Prisma query), the context is preserved throughout the entire async chain — including inside Prisma extension handlers whose internal Promise implementation may not propagate AsyncLocalStorage context on its own.
Type Parameters
| Type Parameter |
|---|
T |
Parameters
| Parameter | Type |
|---|---|
store | SoftDeleteStore |
callback | () => T |
Returns
T
SoftDeletedEvent
Defined in: src/events/soft-delete.events.ts:1
Constructors
Constructor
new SoftDeletedEvent(
model,
where,
deletedAt,
actorId?,
count?): SoftDeletedEvent;Defined in: src/events/soft-delete.events.ts:4
Parameters
| Parameter | Type | Default value |
|---|---|---|
model | string | undefined |
where | Record<string, unknown> | undefined |
deletedAt | Date | undefined |
actorId | string | null | null |
count? | number | undefined |
Returns
Properties
actorId
readonly actorId: string | null = null;Defined in: src/events/soft-delete.events.ts:8
count?
readonly optional count?: number;Defined in: src/events/soft-delete.events.ts:9
deletedAt
readonly deletedAt: Date;Defined in: src/events/soft-delete.events.ts:7
EVENT_NAME
readonly static EVENT_NAME: "soft-delete.deleted";Defined in: src/events/soft-delete.events.ts:2
model
readonly model: string;Defined in: src/events/soft-delete.events.ts:5
where
readonly where: Record<string, unknown>;Defined in: src/events/soft-delete.events.ts:6
SoftDeleteEventEmitter
Defined in: src/events/soft-delete-event-emitter.ts:21
Constructors
Constructor
new SoftDeleteEventEmitter(eventEmitter): SoftDeleteEventEmitter;Defined in: src/events/soft-delete-event-emitter.ts:22
Parameters
| Parameter | Type |
|---|---|
eventEmitter | any |
Returns
Accessors
isEnabled
Get Signature
get isEnabled(): boolean;Defined in: src/events/soft-delete-event-emitter.ts:30
Returns
boolean
Methods
emitPurged()
emitPurged(event): void;Defined in: src/events/soft-delete-event-emitter.ts:42
Parameters
| Parameter | Type |
|---|---|
event | PurgedEvent |
Returns
void
emitRestored()
emitRestored(event): void;Defined in: src/events/soft-delete-event-emitter.ts:38
Parameters
| Parameter | Type |
|---|---|
event | RestoredEvent |
Returns
void
emitSoftDeleted()
emitSoftDeleted(event): void;Defined in: src/events/soft-delete-event-emitter.ts:34
Parameters
| Parameter | Type |
|---|---|
event | SoftDeletedEvent |
Returns
void
SoftDeleteFieldMissingError
Defined in: src/errors/soft-delete-field-missing.error.ts:1
Extends
Error
Constructors
Constructor
new SoftDeleteFieldMissingError(model, field): SoftDeleteFieldMissingError;Defined in: src/errors/soft-delete-field-missing.error.ts:2
Parameters
| Parameter | Type |
|---|---|
model | string |
field | string |
Returns
Overrides
Error.constructorProperties
cause?
optional cause?: unknown;Defined in: node_modules/typescript/lib/lib.es2022.error.d.ts:26
Inherited from
Error.causemessage
message: string;Defined in: node_modules/typescript/lib/lib.es5.d.ts:1077
Inherited from
Error.messagename
name: string;Defined in: node_modules/typescript/lib/lib.es5.d.ts:1076
Inherited from
Error.namestack?
optional stack?: string;Defined in: node_modules/typescript/lib/lib.es5.d.ts:1078
Inherited from
Error.stackstackTraceLimit
static stackTraceLimit: number;Defined in: node_modules/@types/node/globals.d.ts:67
The Error.stackTraceLimit property specifies the number of stack frames collected by a stack trace (whether generated by new Error().stack or Error.captureStackTrace(obj)).
The default value is 10 but may be set to any valid JavaScript number. Changes will affect any stack trace captured after the value has been changed.
If set to a non-number value, or set to a negative number, stack traces will not capture any frames.
Inherited from
Error.stackTraceLimitMethods
captureStackTrace()
static captureStackTrace(targetObject, constructorOpt?): void;Defined in: node_modules/@types/node/globals.d.ts:51
Creates a .stack property on targetObject, which when accessed returns a string representing the location in the code at which Error.captureStackTrace() was called.
const myObject = {};
Error.captureStackTrace(myObject);
myObject.stack; // Similar to `new Error().stack`The first line of the trace will be prefixed with ${myObject.name}: ${myObject.message}.
The optional constructorOpt argument accepts a function. If given, all frames above constructorOpt, including constructorOpt, will be omitted from the generated stack trace.
The constructorOpt argument is useful for hiding implementation details of error generation from the user. For instance:
function a() {
b();
}
function b() {
c();
}
function c() {
// Create an error without stack trace to avoid calculating the stack trace twice.
const { stackTraceLimit } = Error;
Error.stackTraceLimit = 0;
const error = new Error();
Error.stackTraceLimit = stackTraceLimit;
// Capture the stack trace above function b
Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace
throw error;
}
a();Parameters
| Parameter | Type |
|---|---|
targetObject | object |
constructorOpt? | Function |
Returns
void
Inherited from
Error.captureStackTraceprepareStackTrace()
static prepareStackTrace(err, stackTraces): any;Defined in: node_modules/@types/node/globals.d.ts:55
Parameters
| Parameter | Type |
|---|---|
err | Error |
stackTraces | CallSite[] |
Returns
any
See
https://v8.dev/docs/stack-trace-api#customizing-stack-traces
Inherited from
Error.prepareStackTraceSoftDeleteFilterInterceptor
Defined in: src/interceptors/soft-delete-filter.interceptor.ts:14
Implements
NestInterceptor
Constructors
Constructor
new SoftDeleteFilterInterceptor(reflector): SoftDeleteFilterInterceptor;Defined in: src/interceptors/soft-delete-filter.interceptor.ts:15
Parameters
| Parameter | Type |
|---|---|
reflector | Reflector |
Returns
Methods
intercept()
intercept(context, next): Observable<any>;Defined in: src/interceptors/soft-delete-filter.interceptor.ts:17
Method to implement a custom interceptor.
Parameters
| Parameter | Type | Description |
|---|---|---|
context | ExecutionContext | an ExecutionContext object providing methods to access the route handler and class about to be invoked. |
next | CallHandler | a reference to the CallHandler, which provides access to an Observable representing the response stream from the route handler. |
Returns
Observable<any>
Implementation of
NestInterceptor.interceptSoftDeleteModule
Defined in: src/soft-delete.module.ts:54
Implements
NestModule
Constructors
Constructor
new SoftDeleteModule(): SoftDeleteModule;Returns
Methods
configure()
configure(consumer): void;Defined in: src/soft-delete.module.ts:117
Parameters
| Parameter | Type |
|---|---|
consumer | MiddlewareConsumer |
Returns
void
Implementation of
NestModule.configureforRoot()
static forRoot(options): DynamicModule;Defined in: src/soft-delete.module.ts:55
Parameters
| Parameter | Type |
|---|---|
options | SoftDeleteModuleOptions |
Returns
DynamicModule
forRootAsync()
static forRootAsync(options): DynamicModule;Defined in: src/soft-delete.module.ts:88
Parameters
| Parameter | Type |
|---|---|
options | SoftDeleteModuleAsyncOptions |
Returns
DynamicModule
SoftDeleteService
Defined in: src/services/soft-delete.service.ts:10
Constructors
Constructor
new SoftDeleteService(
options,
prisma,
cascadeHandler,
eventEmitter): SoftDeleteService;Defined in: src/services/soft-delete.service.ts:14
Parameters
| Parameter | Type |
|---|---|
options | SoftDeleteModuleOptions |
prisma | any |
cascadeHandler | CascadeHandler | null |
eventEmitter | SoftDeleteEventEmitter | null |
Returns
Methods
forceDelete()
forceDelete<T>(model, where): Promise<T>;Defined in: src/services/soft-delete.service.ts:170
Permanently delete a record, bypassing soft-delete logic.
Type Parameters
| Type Parameter | Default type |
|---|---|
T | any |
Parameters
| Parameter | Type |
|---|---|
model | string |
where | Record<string, any> |
Returns
Promise<T>
onlyDeleted()
onlyDeleted<T>(callback): Promise<T>;Defined in: src/services/soft-delete.service.ts:225
Execute a callback where only soft-deleted records are returned.
Type Parameters
| Type Parameter |
|---|
T |
Parameters
| Parameter | Type |
|---|---|
callback | () => T | Promise<T> |
Returns
Promise<T>
purge()
purge(model, options): Promise<{
count: number;
}>;Defined in: src/services/soft-delete.service.ts:184
Permanently delete soft-deleted records older than the specified date. Runs within skipSoftDelete context so the extension does not intercept the deleteMany.
Parameters
| Parameter | Type |
|---|---|
model | string |
options | { olderThan: Date; where?: Record<string, any>; } |
options.olderThan | Date |
options.where? | Record<string, any> |
Returns
Promise<{ count: number; }>
restore()
restore<T>(model, where): Promise<T>;Defined in: src/services/soft-delete.service.ts:54
Restore a soft-deleted record by setting deletedAt (and optionally deletedBy) back to null. If cascade is configured, cascade-restores child records as well.
Type Parameters
| Type Parameter | Default type |
|---|---|
T | any |
Parameters
| Parameter | Type |
|---|---|
model | string |
where | Record<string, any> |
Returns
Promise<T>
restoreMany()
restoreMany(model, options?): Promise<{
count: number;
}>;Defined in: src/services/soft-delete.service.ts:103
Restore all soft-deleted records matching the given filter. If cascade is configured, cascade-restores child records for each affected parent.
Parameters
| Parameter | Type |
|---|---|
model | string |
options | { where?: Record<string, any>; } |
options.where? | Record<string, any> |
Returns
Promise<{ count: number; }>
withDeleted()
withDeleted<T>(callback): Promise<T>;Defined in: src/services/soft-delete.service.ts:215
Execute a callback where all queries include soft-deleted records.
Type Parameters
| Type Parameter |
|---|
T |
Parameters
| Parameter | Type |
|---|---|
callback | () => T | Promise<T> |
Returns
Promise<T>
Interfaces
PrismaDmmfLike
Defined in: src/interfaces/soft-delete-options.interface.ts:3
Properties
datamodel
datamodel: {
models: {
fields: {
isId?: boolean;
isList?: boolean;
kind?: string;
name: string;
relationFromFields?: string[];
type?: string;
}[];
name: string;
}[];
};Defined in: src/interfaces/soft-delete-options.interface.ts:4
models
models: {
fields: {
isId?: boolean;
isList?: boolean;
kind?: string;
name: string;
relationFromFields?: string[];
type?: string;
}[];
name: string;
}[];RelationFilterOptions
Defined in: src/interfaces/soft-delete-options.interface.ts:19
Properties
enabled?
optional enabled?: boolean;Defined in: src/interfaces/soft-delete-options.interface.ts:20
maxDepth?
optional maxDepth?: number;Defined in: src/interfaces/soft-delete-options.interface.ts:21
SoftDeleteExtensionOptions
Defined in: src/interfaces/soft-delete-options.interface.ts:48
Properties
cascade?
optional cascade?: Record<string, string[]>;Defined in: src/interfaces/soft-delete-options.interface.ts:52
deletedAtField?
optional deletedAtField?: string;Defined in: src/interfaces/soft-delete-options.interface.ts:50
deletedByField?
optional deletedByField?: string | null;Defined in: src/interfaces/soft-delete-options.interface.ts:51
dmmf?
optional dmmf?: PrismaDmmfLike;Defined in: src/interfaces/soft-delete-options.interface.ts:57
Prisma DMMF metadata. Required when cascade or relationFilters are enabled.
eventEmitter?
optional eventEmitter?:
| {
emitSoftDeleted: (event) => void;
}
| null;Defined in: src/interfaces/soft-delete-options.interface.ts:55
Optional event emitter for soft-delete lifecycle events
maxCascadeDepth?
optional maxCascadeDepth?: number;Defined in: src/interfaces/soft-delete-options.interface.ts:53
relationFilters?
optional relationFilters?: boolean | RelationFilterOptions;Defined in: src/interfaces/soft-delete-options.interface.ts:59
Opt-in relation read filtering for to-many include/select trees. Default: false
softDeleteModels
softDeleteModels: string[];Defined in: src/interfaces/soft-delete-options.interface.ts:49
SoftDeleteModuleAsyncOptions
Defined in: src/interfaces/soft-delete-options.interface.ts:41
Extends
Pick<ModuleMetadata,"imports">
Properties
imports?
optional imports?: (
| DynamicModule
| Type<any>
| Promise<DynamicModule>
| ForwardReference<any>)[];Defined in: node_modules/@nestjs/common/interfaces/modules/module-metadata.interface.d.ts:18
Optional list of imported modules that export the providers which are required in this module.
Inherited from
Pick.importsinject?
optional inject?: any[];Defined in: src/interfaces/soft-delete-options.interface.ts:43
prismaServiceToken
prismaServiceToken: any;Defined in: src/interfaces/soft-delete-options.interface.ts:45
DI token for the PrismaService provider — known at registration time, not async
useFactory
useFactory: (...args) =>
| SoftDeleteModuleOptions
| Promise<SoftDeleteModuleOptions>;Defined in: src/interfaces/soft-delete-options.interface.ts:42
Parameters
| Parameter | Type |
|---|---|
...args | any[] |
Returns
| SoftDeleteModuleOptions | Promise<SoftDeleteModuleOptions>
SoftDeleteModuleOptions
Defined in: src/interfaces/soft-delete-options.interface.ts:24
Properties
actorExtractor?
optional actorExtractor?: (req) => string | null;Defined in: src/interfaces/soft-delete-options.interface.ts:28
Parameters
| Parameter | Type |
|---|---|
req | any |
Returns
string | null
cascade?
optional cascade?: Record<string, string[]>;Defined in: src/interfaces/soft-delete-options.interface.ts:29
deletedAtField?
optional deletedAtField?: string;Defined in: src/interfaces/soft-delete-options.interface.ts:26
deletedByField?
optional deletedByField?: string | null;Defined in: src/interfaces/soft-delete-options.interface.ts:27
dmmf?
optional dmmf?: PrismaDmmfLike;Defined in: src/interfaces/soft-delete-options.interface.ts:36
Prisma DMMF metadata. Required when cascade or relationFilters are enabled.
enableEvents?
optional enableEvents?: boolean;Defined in: src/interfaces/soft-delete-options.interface.ts:34
Enable event emission. Requires @nestjs/event-emitter to be installed. Default: false
maxCascadeDepth?
optional maxCascadeDepth?: number;Defined in: src/interfaces/soft-delete-options.interface.ts:30
prismaServiceToken
prismaServiceToken: any;Defined in: src/interfaces/soft-delete-options.interface.ts:32
DI token for the PrismaService provider in the consumer's module
relationFilters?
optional relationFilters?: boolean | RelationFilterOptions;Defined in: src/interfaces/soft-delete-options.interface.ts:38
Opt-in relation read filtering for to-many include/select trees. Default: false
softDeleteModels
softDeleteModels: string[];Defined in: src/interfaces/soft-delete-options.interface.ts:25
SoftDeleteStore
Defined in: src/interfaces/soft-delete-context.interface.ts:3
Properties
actorId?
optional actorId?: string | null;Defined in: src/interfaces/soft-delete-context.interface.ts:6
filterMode
filterMode: SoftDeleteFilterMode;Defined in: src/interfaces/soft-delete-context.interface.ts:4
skipSoftDelete
skipSoftDelete: boolean;Defined in: src/interfaces/soft-delete-context.interface.ts:5
withDeletedRelationPaths?
optional withDeletedRelationPaths?: string[];Defined in: src/interfaces/soft-delete-context.interface.ts:7
Type Aliases
SoftDeleteFilterMode
type SoftDeleteFilterMode = "default" | "withDeleted" | "onlyDeleted";Defined in: src/interfaces/soft-delete-context.interface.ts:1
Variables
SOFT_DELETE_MODULE_OPTIONS
const SOFT_DELETE_MODULE_OPTIONS: typeof SOFT_DELETE_MODULE_OPTIONS;Defined in: src/soft-delete.constants.ts:1
SOFT_DELETE_PRISMA_SERVICE
const SOFT_DELETE_PRISMA_SERVICE: typeof SOFT_DELETE_PRISMA_SERVICE;Defined in: src/soft-delete.constants.ts:2
Functions
createPrismaSoftDeleteExtension()
function createPrismaSoftDeleteExtension(options): (client) => PrismaClientExtends<InternalArgs>;Defined in: src/prisma/soft-delete-extension.ts:331
Creates a Prisma client extension that intercepts delete operations (converting them to soft-delete updates) and read operations (injecting deletedAt filters based on the current context).
Parameters
| Parameter | Type |
|---|---|
options | SoftDeleteExtensionOptions |
Returns
(client) => PrismaClientExtends<InternalArgs>
OnlyDeleted()
function OnlyDeleted(): CustomDecorator<string>;Defined in: src/decorators/only-deleted.decorator.ts:4
Returns
CustomDecorator<string>
SkipSoftDelete()
function SkipSoftDelete(): CustomDecorator<string>;Defined in: src/decorators/skip-soft-delete.decorator.ts:4
Returns
CustomDecorator<string>
WithDeleted()
function WithDeleted(): CustomDecorator<string>;Defined in: src/decorators/with-deleted.decorator.ts:4
Returns
CustomDecorator<string>
WithDeletedRelations()
function WithDeletedRelations(...paths): CustomDecorator<string>;Defined in: src/decorators/with-deleted-relations.decorator.ts:4
Parameters
| Parameter | Type |
|---|---|
...paths | string[] |
Returns
CustomDecorator<string>