policies.ts — drizzle-orm Source File
Architecture documentation for policies.ts, a typescript file in the drizzle-orm codebase. 4 imports, 2 dependents.
Entity Profile
Dependency Diagram
graph LR 2653b8be_3a2e_d91d_bd2c_70b1c16e3b68["policies.ts"] e7aab828_03b8_3900_fc30_72bf989b2418["roles.ts"] 2653b8be_3a2e_d91d_bd2c_70b1c16e3b68 --> e7aab828_03b8_3900_fc30_72bf989b2418 cbe7af57_41be_454d_306f_02d0e6f81949["table.ts"] 2653b8be_3a2e_d91d_bd2c_70b1c16e3b68 --> cbe7af57_41be_454d_306f_02d0e6f81949 27705a9d_afe9_57dd_8c97_e52d8a67d426["entity.ts"] 2653b8be_3a2e_d91d_bd2c_70b1c16e3b68 --> 27705a9d_afe9_57dd_8c97_e52d8a67d426 be483a7f_d5d7_7a9b_9a13_44a4a6aafbbd["sql.ts"] 2653b8be_3a2e_d91d_bd2c_70b1c16e3b68 --> be483a7f_d5d7_7a9b_9a13_44a4a6aafbbd cbe7af57_41be_454d_306f_02d0e6f81949["table.ts"] cbe7af57_41be_454d_306f_02d0e6f81949 --> 2653b8be_3a2e_d91d_bd2c_70b1c16e3b68 9cb8488e_0ece_edef_af6a_5851d56cddda["utils.ts"] 9cb8488e_0ece_edef_af6a_5851d56cddda --> 2653b8be_3a2e_d91d_bd2c_70b1c16e3b68 style 2653b8be_3a2e_d91d_bd2c_70b1c16e3b68 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import { entityKind } from '~/entity.ts';
import type { SQL } from '~/sql/sql.ts';
import type { GelRole } from './roles.ts';
import type { GelTable } from './table.ts';
export type GelPolicyToOption =
| 'public'
| 'current_role'
| 'current_user'
| 'session_user'
| (string & {})
| GelPolicyToOption[]
| GelRole;
export interface GelPolicyConfig {
as?: 'permissive' | 'restrictive';
for?: 'all' | 'select' | 'insert' | 'update' | 'delete';
to?: GelPolicyToOption;
using?: SQL;
withCheck?: SQL;
}
export class GelPolicy implements GelPolicyConfig {
static readonly [entityKind]: string = 'GelPolicy';
readonly as: GelPolicyConfig['as'];
readonly for: GelPolicyConfig['for'];
readonly to: GelPolicyConfig['to'];
readonly using: GelPolicyConfig['using'];
readonly withCheck: GelPolicyConfig['withCheck'];
/** @internal */
_linkedTable?: GelTable;
constructor(
readonly name: string,
config?: GelPolicyConfig,
) {
if (config) {
this.as = config.as;
this.for = config.for;
this.to = config.to;
this.using = config.using;
this.withCheck = config.withCheck;
}
}
link(table: GelTable): this {
this._linkedTable = table;
return this;
}
}
export function gelPolicy(name: string, config?: GelPolicyConfig) {
return new GelPolicy(name, config);
}
Domain
Subdomains
Functions
Classes
Source
Frequently Asked Questions
What does policies.ts do?
policies.ts is a source file in the drizzle-orm codebase, written in typescript. It belongs to the DrizzleORM domain, RelationalQuery subdomain.
What functions are defined in policies.ts?
policies.ts defines 1 function(s): gelPolicy.
What does policies.ts depend on?
policies.ts imports 4 module(s): entity.ts, roles.ts, sql.ts, table.ts.
What files import policies.ts?
policies.ts is imported by 2 file(s): table.ts, utils.ts.
Where is policies.ts in the architecture?
policies.ts is located at drizzle-orm/src/gel-core/policies.ts (domain: DrizzleORM, subdomain: RelationalQuery, directory: drizzle-orm/src/gel-core).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free