Skip to content

@nestarc/soft-delete ​

Classes ​

CascadeDmmfMissingError ​

Defined in: src/errors/cascade-dmmf-missing.error.ts:1

Extends ​

  • Error

Constructors ​

Constructor ​
ts
new CascadeDmmfMissingError(): CascadeDmmfMissingError;

Defined in: src/errors/cascade-dmmf-missing.error.ts:2

Returns ​

CascadeDmmfMissingError

Overrides ​
ts
Error.constructor

Properties ​

cause? ​
ts
optional cause?: unknown;

Defined in: node_modules/typescript/lib/lib.es2022.error.d.ts:26

Inherited from ​
ts
Error.cause

message ​
ts
message: string;

Defined in: node_modules/typescript/lib/lib.es5.d.ts:1077

Inherited from ​
ts
Error.message

name ​
ts
name: string;

Defined in: node_modules/typescript/lib/lib.es5.d.ts:1076

Inherited from ​
ts
Error.name

stack? ​
ts
optional stack?: string;

Defined in: node_modules/typescript/lib/lib.es5.d.ts:1078

Inherited from ​
ts
Error.stack

stackTraceLimit ​
ts
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 ​
ts
Error.stackTraceLimit

Methods ​

captureStackTrace() ​
ts
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.

js
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:

js
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 ​
ParameterType
targetObjectobject
constructorOpt?Function
Returns ​

void

Inherited from ​
ts
Error.captureStackTrace

prepareStackTrace() ​
ts
static prepareStackTrace(err, stackTraces): any;

Defined in: node_modules/@types/node/globals.d.ts:55

Parameters ​
ParameterType
errError
stackTracesCallSite[]
Returns ​

any

See ​

https://v8.dev/docs/stack-trace-api#customizing-stack-traces

Inherited from ​
ts
Error.prepareStackTrace

CascadeRelationNotFoundError ​

Defined in: src/errors/cascade-relation-not-found.error.ts:1

Extends ​

  • Error

Constructors ​

Constructor ​
ts
new CascadeRelationNotFoundError(parent, child): CascadeRelationNotFoundError;

Defined in: src/errors/cascade-relation-not-found.error.ts:2

Parameters ​
ParameterType
parentstring
childstring
Returns ​

CascadeRelationNotFoundError

Overrides ​
ts
Error.constructor

Properties ​

cause? ​
ts
optional cause?: unknown;

Defined in: node_modules/typescript/lib/lib.es2022.error.d.ts:26

Inherited from ​
ts
Error.cause

message ​
ts
message: string;

Defined in: node_modules/typescript/lib/lib.es5.d.ts:1077

Inherited from ​
ts
Error.message

name ​
ts
name: string;

Defined in: node_modules/typescript/lib/lib.es5.d.ts:1076

Inherited from ​
ts
Error.name

stack? ​
ts
optional stack?: string;

Defined in: node_modules/typescript/lib/lib.es5.d.ts:1078

Inherited from ​
ts
Error.stack

stackTraceLimit ​
ts
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 ​
ts
Error.stackTraceLimit

Methods ​

captureStackTrace() ​
ts
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.

js
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:

js
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 ​
ParameterType
targetObjectobject
constructorOpt?Function
Returns ​

void

Inherited from ​
ts
Error.captureStackTrace

prepareStackTrace() ​
ts
static prepareStackTrace(err, stackTraces): any;

Defined in: node_modules/@types/node/globals.d.ts:55

Parameters ​
ParameterType
errError
stackTracesCallSite[]
Returns ​

any

See ​

https://v8.dev/docs/stack-trace-api#customizing-stack-traces

Inherited from ​
ts
Error.prepareStackTrace

PurgedEvent ​

Defined in: src/events/soft-delete.events.ts:24

Constructors ​

Constructor ​
ts
new PurgedEvent(
   model,
   count,
   olderThan): PurgedEvent;

Defined in: src/events/soft-delete.events.ts:27

Parameters ​
ParameterType
modelstring
countnumber
olderThanDate
Returns ​

PurgedEvent

Properties ​

count ​
ts
readonly count: number;

Defined in: src/events/soft-delete.events.ts:29

EVENT_NAME ​
ts
readonly static EVENT_NAME: "soft-delete.purged";

Defined in: src/events/soft-delete.events.ts:25

model ​
ts
readonly model: string;

Defined in: src/events/soft-delete.events.ts:28

olderThan ​
ts
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 ​
ts
new RelationDmmfMissingError(): RelationDmmfMissingError;

Defined in: src/errors/relation-dmmf-missing.error.ts:2

Returns ​

RelationDmmfMissingError

Overrides ​
ts
Error.constructor

Properties ​

cause? ​
ts
optional cause?: unknown;

Defined in: node_modules/typescript/lib/lib.es2022.error.d.ts:26

Inherited from ​
ts
Error.cause

message ​
ts
message: string;

Defined in: node_modules/typescript/lib/lib.es5.d.ts:1077

Inherited from ​
ts
Error.message

name ​
ts
name: string;

Defined in: node_modules/typescript/lib/lib.es5.d.ts:1076

Inherited from ​
ts
Error.name

stack? ​
ts
optional stack?: string;

Defined in: node_modules/typescript/lib/lib.es5.d.ts:1078

Inherited from ​
ts
Error.stack

stackTraceLimit ​
ts
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 ​
ts
Error.stackTraceLimit

Methods ​

captureStackTrace() ​
ts
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.

js
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:

js
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 ​
ParameterType
targetObjectobject
constructorOpt?Function
Returns ​

void

Inherited from ​
ts
Error.captureStackTrace

prepareStackTrace() ​
ts
static prepareStackTrace(err, stackTraces): any;

Defined in: node_modules/@types/node/globals.d.ts:55

Parameters ​
ParameterType
errError
stackTracesCallSite[]
Returns ​

any

See ​

https://v8.dev/docs/stack-trace-api#customizing-stack-traces

Inherited from ​
ts
Error.prepareStackTrace

RestoredEvent ​

Defined in: src/events/soft-delete.events.ts:13

Constructors ​

Constructor ​
ts
new RestoredEvent(
   model,
   where,
   actorId?,
   count?): RestoredEvent;

Defined in: src/events/soft-delete.events.ts:16

Parameters ​
ParameterTypeDefault value
modelstringundefined
whereRecord<string, unknown>undefined
actorIdstring | nullnull
count?numberundefined
Returns ​

RestoredEvent

Properties ​

actorId ​
ts
readonly actorId: string | null = null;

Defined in: src/events/soft-delete.events.ts:19

count? ​
ts
readonly optional count?: number;

Defined in: src/events/soft-delete.events.ts:20

EVENT_NAME ​
ts
readonly static EVENT_NAME: "soft-delete.restored";

Defined in: src/events/soft-delete.events.ts:14

model ​
ts
readonly model: string;

Defined in: src/events/soft-delete.events.ts:17

where ​
ts
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 ​
ts
new SoftDeleteContext(): SoftDeleteContext;
Returns ​

SoftDeleteContext

Methods ​

getActorId() ​
ts
static getActorId(): string | null;

Defined in: src/services/soft-delete-context.ts:44

Returns ​

string | null

getFilterMode() ​
ts
static getFilterMode(): SoftDeleteFilterMode;

Defined in: src/services/soft-delete-context.ts:36

Returns ​

SoftDeleteFilterMode

getWithDeletedRelationPaths() ​
ts
static getWithDeletedRelationPaths(): string[];

Defined in: src/services/soft-delete-context.ts:48

Returns ​

string[]

isSkipped() ​
ts
static isSkipped(): boolean;

Defined in: src/services/soft-delete-context.ts:40

Returns ​

boolean

isWithDeletedRelationPath() ​
ts
static isWithDeletedRelationPath(path): boolean;

Defined in: src/services/soft-delete-context.ts:52

Parameters ​
ParameterType
pathstring
Returns ​

boolean

run() ​
ts
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 ​
ParameterType
storeSoftDeleteStore
callback() => T
Returns ​

T


SoftDeletedEvent ​

Defined in: src/events/soft-delete.events.ts:1

Constructors ​

Constructor ​
ts
new SoftDeletedEvent(
   model,
   where,
   deletedAt,
   actorId?,
   count?): SoftDeletedEvent;

Defined in: src/events/soft-delete.events.ts:4

Parameters ​
ParameterTypeDefault value
modelstringundefined
whereRecord<string, unknown>undefined
deletedAtDateundefined
actorIdstring | nullnull
count?numberundefined
Returns ​

SoftDeletedEvent

Properties ​

actorId ​
ts
readonly actorId: string | null = null;

Defined in: src/events/soft-delete.events.ts:8

count? ​
ts
readonly optional count?: number;

Defined in: src/events/soft-delete.events.ts:9

deletedAt ​
ts
readonly deletedAt: Date;

Defined in: src/events/soft-delete.events.ts:7

EVENT_NAME ​
ts
readonly static EVENT_NAME: "soft-delete.deleted";

Defined in: src/events/soft-delete.events.ts:2

model ​
ts
readonly model: string;

Defined in: src/events/soft-delete.events.ts:5

where ​
ts
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 ​
ts
new SoftDeleteEventEmitter(eventEmitter): SoftDeleteEventEmitter;

Defined in: src/events/soft-delete-event-emitter.ts:22

Parameters ​
ParameterType
eventEmitterany
Returns ​

SoftDeleteEventEmitter

Accessors ​

isEnabled ​
Get Signature ​
ts
get isEnabled(): boolean;

Defined in: src/events/soft-delete-event-emitter.ts:30

Returns ​

boolean

Methods ​

emitPurged() ​
ts
emitPurged(event): void;

Defined in: src/events/soft-delete-event-emitter.ts:42

Parameters ​
ParameterType
eventPurgedEvent
Returns ​

void

emitRestored() ​
ts
emitRestored(event): void;

Defined in: src/events/soft-delete-event-emitter.ts:38

Parameters ​
ParameterType
eventRestoredEvent
Returns ​

void

emitSoftDeleted() ​
ts
emitSoftDeleted(event): void;

Defined in: src/events/soft-delete-event-emitter.ts:34

Parameters ​
ParameterType
eventSoftDeletedEvent
Returns ​

void


SoftDeleteFieldMissingError ​

Defined in: src/errors/soft-delete-field-missing.error.ts:1

Extends ​

  • Error

Constructors ​

Constructor ​
ts
new SoftDeleteFieldMissingError(model, field): SoftDeleteFieldMissingError;

Defined in: src/errors/soft-delete-field-missing.error.ts:2

Parameters ​
ParameterType
modelstring
fieldstring
Returns ​

SoftDeleteFieldMissingError

Overrides ​
ts
Error.constructor

Properties ​

cause? ​
ts
optional cause?: unknown;

Defined in: node_modules/typescript/lib/lib.es2022.error.d.ts:26

Inherited from ​
ts
Error.cause

message ​
ts
message: string;

Defined in: node_modules/typescript/lib/lib.es5.d.ts:1077

Inherited from ​
ts
Error.message

name ​
ts
name: string;

Defined in: node_modules/typescript/lib/lib.es5.d.ts:1076

Inherited from ​
ts
Error.name

stack? ​
ts
optional stack?: string;

Defined in: node_modules/typescript/lib/lib.es5.d.ts:1078

Inherited from ​
ts
Error.stack

stackTraceLimit ​
ts
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 ​
ts
Error.stackTraceLimit

Methods ​

captureStackTrace() ​
ts
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.

js
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:

js
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 ​
ParameterType
targetObjectobject
constructorOpt?Function
Returns ​

void

Inherited from ​
ts
Error.captureStackTrace

prepareStackTrace() ​
ts
static prepareStackTrace(err, stackTraces): any;

Defined in: node_modules/@types/node/globals.d.ts:55

Parameters ​
ParameterType
errError
stackTracesCallSite[]
Returns ​

any

See ​

https://v8.dev/docs/stack-trace-api#customizing-stack-traces

Inherited from ​
ts
Error.prepareStackTrace

SoftDeleteFilterInterceptor ​

Defined in: src/interceptors/soft-delete-filter.interceptor.ts:14

Implements ​

  • NestInterceptor

Constructors ​

Constructor ​
ts
new SoftDeleteFilterInterceptor(reflector): SoftDeleteFilterInterceptor;

Defined in: src/interceptors/soft-delete-filter.interceptor.ts:15

Parameters ​
ParameterType
reflectorReflector
Returns ​

SoftDeleteFilterInterceptor

Methods ​

intercept() ​
ts
intercept(context, next): Observable<any>;

Defined in: src/interceptors/soft-delete-filter.interceptor.ts:17

Method to implement a custom interceptor.

Parameters ​
ParameterTypeDescription
contextExecutionContextan ExecutionContext object providing methods to access the route handler and class about to be invoked.
nextCallHandlera reference to the CallHandler, which provides access to an Observable representing the response stream from the route handler.
Returns ​

Observable<any>

Implementation of ​
ts
NestInterceptor.intercept

SoftDeleteModule ​

Defined in: src/soft-delete.module.ts:54

Implements ​

  • NestModule

Constructors ​

Constructor ​
ts
new SoftDeleteModule(): SoftDeleteModule;
Returns ​

SoftDeleteModule

Methods ​

configure() ​
ts
configure(consumer): void;

Defined in: src/soft-delete.module.ts:117

Parameters ​
ParameterType
consumerMiddlewareConsumer
Returns ​

void

Implementation of ​
ts
NestModule.configure

forRoot() ​
ts
static forRoot(options): DynamicModule;

Defined in: src/soft-delete.module.ts:55

Parameters ​
ParameterType
optionsSoftDeleteModuleOptions
Returns ​

DynamicModule

forRootAsync() ​
ts
static forRootAsync(options): DynamicModule;

Defined in: src/soft-delete.module.ts:88

Parameters ​
ParameterType
optionsSoftDeleteModuleAsyncOptions
Returns ​

DynamicModule


SoftDeleteService ​

Defined in: src/services/soft-delete.service.ts:15

Constructors ​

Constructor ​
ts
new SoftDeleteService(
   options,
   prisma,
   cascadeHandler,
   eventEmitter): SoftDeleteService;

Defined in: src/services/soft-delete.service.ts:19

Parameters ​
ParameterType
optionsSoftDeleteModuleOptions
prismaany
cascadeHandlerCascadeHandler | null
eventEmitterSoftDeleteEventEmitter | null
Returns ​

SoftDeleteService

Methods ​

forceDelete() ​
ts
forceDelete<T>(model, where): Promise<T>;

Defined in: src/services/soft-delete.service.ts:256

Permanently delete a record, bypassing soft-delete logic.

Type Parameters ​
Type ParameterDefault type
Tany
Parameters ​
ParameterType
modelstring
whereRecord<string, any>
Returns ​

Promise<T>

onlyDeleted() ​
ts
onlyDeleted<T>(callback): Promise<T>;

Defined in: src/services/soft-delete.service.ts:304

Execute a callback where only soft-deleted records are returned.

Type Parameters ​
Type Parameter
T
Parameters ​
ParameterType
callback() => T | Promise<T>
Returns ​

Promise<T>

purge() ​
ts
purge(model, options): Promise<{
  count: number;
}>;

Defined in: src/services/soft-delete.service.ts:269

Permanently delete soft-deleted records older than the specified date. Runs within skipSoftDelete context so the extension does not intercept the deleteMany.

Parameters ​
ParameterType
modelstring
options{ olderThan: Date; where?: Record<string, any>; }
options.olderThanDate
options.where?Record<string, any>
Returns ​

Promise<{ count: number; }>

restore() ​
ts
restore<T>(model, where): Promise<T>;

Defined in: src/services/soft-delete.service.ts:83

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 ParameterDefault type
Tany
Parameters ​
ParameterType
modelstring
whereRecord<string, any>
Returns ​

Promise<T>

restoreMany() ​
ts
restoreMany(model, options?): Promise<{
  count: number;
}>;

Defined in: src/services/soft-delete.service.ts:139

Restore all soft-deleted records matching the given filter. If cascade is configured, cascade-restores child records for each affected parent.

Parameters ​
ParameterType
modelstring
options{ where?: Record<string, any>; }
options.where?Record<string, any>
Returns ​

Promise<{ count: number; }>

withDeleted() ​
ts
withDeleted<T>(callback): Promise<T>;

Defined in: src/services/soft-delete.service.ts:297

Execute a callback where all queries include soft-deleted records.

Type Parameters ​
Type Parameter
T
Parameters ​
ParameterType
callback() => T | Promise<T>
Returns ​

Promise<T>

Interfaces ​

PrismaDmmfLike ​

Defined in: src/interfaces/soft-delete-options.interface.ts:3

Properties ​

datamodel ​
ts
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 ​
ts
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? ​
ts
optional enabled?: boolean;

Defined in: src/interfaces/soft-delete-options.interface.ts:20

maxDepth? ​
ts
optional maxDepth?: number;

Defined in: src/interfaces/soft-delete-options.interface.ts:21


SoftDeleteExtensionOptions ​

Defined in: src/interfaces/soft-delete-options.interface.ts:55

Properties ​

auditLifecycle? ​
ts
optional auditLifecycle?: "atomic-required";

Defined in: src/interfaces/soft-delete-options.interface.ts:68

Require same-transaction record-level soft-delete audit integration.

auditMaxBatchRecords? ​
ts
optional auditMaxBatchRecords?: number;

Defined in: src/interfaces/soft-delete-options.interface.ts:70

Maximum records converted to record-level lifecycle mutations. Default: 1000.

cascade? ​
ts
optional cascade?: Record<string, string[]>;

Defined in: src/interfaces/soft-delete-options.interface.ts:59

deletedAtField? ​
ts
optional deletedAtField?: string;

Defined in: src/interfaces/soft-delete-options.interface.ts:57

deletedByField? ​
ts
optional deletedByField?: string | null;

Defined in: src/interfaces/soft-delete-options.interface.ts:58

dmmf? ​
ts
optional dmmf?: PrismaDmmfLike;

Defined in: src/interfaces/soft-delete-options.interface.ts:64

Prisma DMMF metadata. Required when cascade or relationFilters are enabled.

eventEmitter? ​
ts
optional eventEmitter?:
  | {
  emitSoftDeleted: (event) => void;
}
  | null;

Defined in: src/interfaces/soft-delete-options.interface.ts:62

Optional event emitter for soft-delete lifecycle events

maxCascadeDepth? ​
ts
optional maxCascadeDepth?: number;

Defined in: src/interfaces/soft-delete-options.interface.ts:60

relationFilters? ​
ts
optional relationFilters?: boolean | RelationFilterOptions;

Defined in: src/interfaces/soft-delete-options.interface.ts:66

Opt-in relation read filtering for to-many include/select trees. Default: false

softDeleteModels ​
ts
softDeleteModels: string[];

Defined in: src/interfaces/soft-delete-options.interface.ts:56


SoftDeleteModuleAsyncOptions ​

Defined in: src/interfaces/soft-delete-options.interface.ts:48

Extends ​

  • Pick<ModuleMetadata, "imports">

Properties ​

imports? ​
ts
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 ​
ts
Pick.imports

inject? ​
ts
optional inject?: any[];

Defined in: src/interfaces/soft-delete-options.interface.ts:50

prismaServiceToken ​
ts
prismaServiceToken: any;

Defined in: src/interfaces/soft-delete-options.interface.ts:52

DI token for the PrismaService provider — known at registration time, not async

useFactory ​
ts
useFactory: (...args) =>
  | SoftDeleteModuleOptions
| Promise<SoftDeleteModuleOptions>;

Defined in: src/interfaces/soft-delete-options.interface.ts:49

Parameters ​
ParameterType
...argsany[]
Returns ​

| SoftDeleteModuleOptions | Promise<SoftDeleteModuleOptions>


SoftDeleteModuleOptions ​

Defined in: src/interfaces/soft-delete-options.interface.ts:24

Properties ​

actorExtractor? ​
ts
optional actorExtractor?: (req) => string | null;

Defined in: src/interfaces/soft-delete-options.interface.ts:28

Parameters ​
ParameterType
reqany
Returns ​

string | null

auditLifecycle? ​
ts
optional auditLifecycle?: "atomic-required";

Defined in: src/interfaces/soft-delete-options.interface.ts:43

Require the @nestarc/audit-log atomic lifecycle bridge. The official extension order is tenancy -> audit-log -> soft-delete.

auditMaxBatchRecords? ​
ts
optional auditMaxBatchRecords?: number;

Defined in: src/interfaces/soft-delete-options.interface.ts:45

Maximum records converted to record-level lifecycle mutations. Default: 1000.

cascade? ​
ts
optional cascade?: Record<string, string[]>;

Defined in: src/interfaces/soft-delete-options.interface.ts:29

deletedAtField? ​
ts
optional deletedAtField?: string;

Defined in: src/interfaces/soft-delete-options.interface.ts:26

deletedByField? ​
ts
optional deletedByField?: string | null;

Defined in: src/interfaces/soft-delete-options.interface.ts:27

dmmf? ​
ts
optional dmmf?: PrismaDmmfLike;

Defined in: src/interfaces/soft-delete-options.interface.ts:36

Prisma DMMF metadata. Required when cascade or relationFilters are enabled.

enableEvents? ​
ts
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? ​
ts
optional maxCascadeDepth?: number;

Defined in: src/interfaces/soft-delete-options.interface.ts:30

prismaServiceToken ​
ts
prismaServiceToken: any;

Defined in: src/interfaces/soft-delete-options.interface.ts:32

DI token for the PrismaService provider in the consumer's module

relationFilters? ​
ts
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 ​
ts
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? ​
ts
optional actorId?: string | null;

Defined in: src/interfaces/soft-delete-context.interface.ts:6

filterMode ​
ts
filterMode: SoftDeleteFilterMode;

Defined in: src/interfaces/soft-delete-context.interface.ts:4

skipSoftDelete ​
ts
skipSoftDelete: boolean;

Defined in: src/interfaces/soft-delete-context.interface.ts:5

withDeletedRelationPaths? ​
ts
optional withDeletedRelationPaths?: string[];

Defined in: src/interfaces/soft-delete-context.interface.ts:7

Type Aliases ​

SoftDeleteFilterMode ​

ts
type SoftDeleteFilterMode = "default" | "withDeleted" | "onlyDeleted";

Defined in: src/interfaces/soft-delete-context.interface.ts:1

Variables ​

SOFT_DELETE_MODULE_OPTIONS ​

ts
const SOFT_DELETE_MODULE_OPTIONS: typeof SOFT_DELETE_MODULE_OPTIONS;

Defined in: src/soft-delete.constants.ts:1


SOFT_DELETE_PRISMA_SERVICE ​

ts
const SOFT_DELETE_PRISMA_SERVICE: typeof SOFT_DELETE_PRISMA_SERVICE;

Defined in: src/soft-delete.constants.ts:2

Functions ​

createPrismaSoftDeleteExtension() ​

ts
function createPrismaSoftDeleteExtension(options): (client) => PrismaClientExtends<InternalArgs>;

Defined in: src/prisma/soft-delete-extension.ts:434

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 ​

ParameterType
optionsSoftDeleteExtensionOptions

Returns ​

(client) => PrismaClientExtends<InternalArgs>


OnlyDeleted() ​

ts
function OnlyDeleted(): CustomDecorator<string>;

Defined in: src/decorators/only-deleted.decorator.ts:4

Returns ​

CustomDecorator<string>


SkipSoftDelete() ​

ts
function SkipSoftDelete(): CustomDecorator<string>;

Defined in: src/decorators/skip-soft-delete.decorator.ts:4

Returns ​

CustomDecorator<string>


WithDeleted() ​

ts
function WithDeleted(): CustomDecorator<string>;

Defined in: src/decorators/with-deleted.decorator.ts:4

Returns ​

CustomDecorator<string>


WithDeletedRelations() ​

ts
function WithDeletedRelations(...paths): CustomDecorator<string>;

Defined in: src/decorators/with-deleted-relations.decorator.ts:4

Parameters ​

ParameterType
...pathsstring[]

Returns ​

CustomDecorator<string>

Released under the MIT License.