Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@qbobjx/plugins

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@qbobjx/plugins

Official OBJX plugins, including timestamps, snake case naming, soft delete, tenant scope, and audit trail.

Source
npmnpm
Version
0.4.0
Version published
Maintainers
1
Created
Source

@qbobjx/plugins

Official OBJX plugins, including timestamps, snake case naming, soft delete, tenant scope, and audit trail.

Install

npm install @qbobjx/plugins

Quick Usage

import { col, defineModel } from '@qbobjx/core';
import {
  createSnakeCaseNamingPlugin,
  createSoftDeletePlugin,
  createTenantScopePlugin,
} from '@qbobjx/plugins';

export const Account = defineModel({
  table: 'accounts',
  columns: {
    id: col.int().primary(),
    tenantId: col.text(),
    deletedAt: col.timestamp().nullable(),
  },
  plugins: [
    createSnakeCaseNamingPlugin(),
    createTenantScopePlugin(),
    createSoftDeletePlugin(),
  ],
});

Included Plugins

  • createTimestampsPlugin()
  • createSnakeCaseNamingPlugin()
  • createSoftDeletePlugin()
  • createTenantScopePlugin()
  • createAuditTrailPlugin()

Snake Case Naming

Use createSnakeCaseNamingPlugin() when your model keys are camelCase but your physical database columns are snake_case.

import { col, defineModel } from '@qbobjx/core';
import { createSnakeCaseNamingPlugin } from '@qbobjx/plugins';

export const Account = defineModel({
  table: 'accounts',
  columns: {
    id: col.int().primary(),
    tenantId: col.text(),
    createdAt: col.timestamp(),
  },
  plugins: [
    createSnakeCaseNamingPlugin({
      exclude: ['id'],
      overrides: {
        createdAt: 'created_on',
      },
    }),
  ],
});

The compiler emits physical names like tenant_id, while hydrated rows continue to use model keys like tenantId.

Important: this plugin should be attached at model definition time. It updates column metadata in the onModelDefine hook, so adding it only as a session-global plugin is too late for remapping.

Repository examples using this pattern:

  • examples/complex-runtime
  • examples/express-api
  • examples/nestjs-api

Tenant Scope Vs PostgreSQL RLS

createTenantScopePlugin() injects tenant predicates into OBJX-generated SQL. It does not replace PostgreSQL RLS policies that depend on set_config(...) / current_setting(...).

If your database enforces tenant isolation through PostgreSQL RLS, configure createPostgresSession({ executionContextSettings: ... }) in @qbobjx/postgres-driver and execute protected work inside session.transaction(...).

FAQs

Package last updated on 20 Apr 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts