IF Commons GitHub

sql/extensions/protected-access/mod

Written to: 1 requirement: 1 proved, 0 partly, 0 failing, 0 with no test recorded. 0014-sql-protected-access FR-001

The protection layer (commons data 0014-sql-protected-access): the tables in a schema of their own, a view of each in a schema that applications use, and where the engine can enforce it, the rights, the policies and a guard that keep it so. protection gives everything a project passes on: the options of bind, of plan and of execute; protectionExtension contributes the source and the transform through the engine; capabilities says what a dialect can do and what it can only do by convention.

const p = protection({ tablesSchema: "data", viewsSchema: "api" });
bind(schema, { dialect, ...p.bind });
plan(from, schema, { dialect, ...p.desired }, { transforms: p.transforms });
execute(plan, driver, dialect, { empty, before: p.session(dialect) });

Source: commons/data/sql/extensions/protected-access/mod.ts

3 of 5 exports are imported by a test of the run. A test that imports an export may not call it or check what it returns.

Capabilitiesinterfaceno test imports it
interface Capabilities

What a dialect can do for the layer.

MemberTypeWhat it is
enforcedbooleanWhether the layer is enforced (rights, policies, the guard) or a convention.
writableViewsbooleanWhether a row can be written through a view.
notesreadonly string[]What a person should know, in words.
capabilitiesfunction
function capabilities(dialect: Dialect, given?: ProtectionSettings): Capabilities

What a dialect can do for the layer, for the settings.

ParameterWhat it is
dialectthe dialect
givenwhat a project says of protection

Returns: the capabilities

Imported by 10 tests of the run (10 passed, 0 failed): the library's results

ProtectionKitinterfaceno test imports it
interface ProtectionKit

Everything a project passes on for a set of settings.

MemberTypeWhat it is
settingsProtection
bind{ readonly schema: string; readonly sources: readonly StatementSource[]; }What bind is given.
desired{ readonly schema: string; readonly sources: readonly StatementSource[]; }What plan is given as the desired state.
transformsreadonly StepTransform[]The transforms plan is given.
session(dialect: Dialect) => readonly string[]The statements execute runs at the start of each transaction.
protectionfunction
function protection(given?: ProtectionSettings): ProtectionKit

The protection layer for a set of settings.

ParameterWhat it is
givenwhat a project says of protection

Returns: what a project passes on

Imported by 29 tests of the run (29 passed, 0 failed): the library's results

protectionExtensionfunction
function protectionExtension(given?: ProtectionSettings, version?: string): Result<Extension, IdError>

The layer as an extension of the engine, sql.protected-access, which contributes its source and its transform.

ParameterWhat it is
givenwhat a project says of protection
versionthe extension's version

Returns: the extension, or why its identifier is not one

Imported by 10 tests of the run (10 passed, 0 failed): the library's results

Titles, headings, exports, tables, columns and requirements. Esc closes.