Profiles (commons lang-sql 0010-aide FR-002 ): a subset of the language, as data. A little language made of SQL says which statements, nodes, functions and tables it has and how large a statement may be, and conform gives every violation of a parse with the span of its node and one sentence, so that a language of one table and no joins is a value and not a grammar.
const files = defineProfile ({ name: "files" , statements: ["select" ], forbidNodes: ["join" , "subquery" ], tables: ["files" ], functions: ["lower" ], maxDepth: 40 });
conform (parse ("SELECT name FROM files" , ansi), files); // ok Spec: 0010-aide FR-001 , FR-002
Source: commons/lang-sql/src/aide/profile/mod.ts
2 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.
Profileinterface no test imports it interface Profile A subset of the language.
Member Type What it is namestringstatementsreadonly ("alter-table" | "command" | "create-index" | "create-routine" | "create-table" | "create-view" | "delete" | "drop" | "insert" | "select" | "set-op" | "unparsed" | "update" | "values" | "with")[]The kinds of statement that are allowed. forbidNodesreadonly ("add-column" | "add-constraint" | "alias" | "alter-table" | "array" | "assignment" | "between" | "binary" | "boolean" | "call" | "case" | "cast" | "check" | "collate" | "column-def" | "column-option" | "command" | "create-index" | "create-routine" | "create-table" | "create-view" | "cte" | "data-type" | "default" | "delete" | "drop" | "drop-column" | "drop-constraint" | "exists" | "extract" | "field" | "foreign-key" | "frame" | "frame-bound" | "ident" | "in" | "in-query" | "insert" | "interval" | "is" | "join" | "keyword-arg" | "lambda" | "like" | "name" | "named-arg" | "not-null" | "null" | "number" | "on-conflict" | "operator" | "order-item" | "param" | "primary-key" | "reference" | "rename-column" | "rename-table" | "routine-body" | "routine-param" | "scalar-query" | "script" | "select" | "select-item" | "set-op" | "star" | "star-modifier" | "string" | "struct" | "struct-entry" | "subquery" | "subscript" | "table" | "table-fn" | "table-like" | "table-op" | "tuple" | "type-field" | "typed-string" | "unary" | "unique" | "unparsed" | "update" | "values" | "when" | "window-def" | "window-spec" | "with")[]The kinds of node that are not. functionsreadonly string[] | undefinedThe functions that may be called, without regard to case; any where not given. tablesreadonly string[] | undefinedThe tables that may be read, without regard to case; any where not given. maxDepthnumber | undefinedmaxNodesnumber | undefinedmaxTablesnumber | undefineddeniedFunctionsreadonly string[]The functions that may not be called, without regard to case or to a schema before the name. maxStatementsnumber | undefinedThe most statements a text may hold; any where not given.
ProfileSpecinterface no test imports it interface ProfileSpec What a profile is made from.
Member Type What it is namestringstatementsreadonly ("alter-table" | "command" | "create-index" | "create-routine" | "create-table" | "create-view" | "delete" | "drop" | "insert" | "select" | "set-op" | "unparsed" | "update" | "values" | "with")[]forbidNodes?readonly ("add-column" | "add-constraint" | "alias" | "alter-table" | "array" | "assignment" | "between" | "binary" | "boolean" | "call" | "case" | "cast" | "check" | "collate" | "column-def" | "column-option" | "command" | "create-index" | "create-routine" | "create-table" | "create-view" | "cte" | "data-type" | "default" | "delete" | "drop" | "drop-column" | "drop-constraint" | "exists" | "extract" | "field" | "foreign-key" | "frame" | "frame-bound" | "ident" | "in" | "in-query" | "insert" | "interval" | "is" | "join" | "keyword-arg" | "lambda" | "like" | "name" | "named-arg" | "not-null" | "null" | "number" | "on-conflict" | "operator" | "order-item" | "param" | "primary-key" | "reference" | "rename-column" | "rename-table" | "routine-body" | "routine-param" | "scalar-query" | "script" | "select" | "select-item" | "set-op" | "star" | "star-modifier" | "string" | "struct" | "struct-entry" | "subquery" | "subscript" | "table" | "table-fn" | "table-like" | "table-op" | "tuple" | "type-field" | "typed-string" | "unary" | "unique" | "unparsed" | "update" | "values" | "when" | "window-def" | "window-spec" | "with")[]functions?readonly string[]tables?readonly string[]maxDepth?numbermaxNodes?numbermaxTables?numberdeniedFunctions?readonly string[]maxStatements?number
Violationinterface no test imports it interface Violation What a parse does that its profile does not allow.
Member Type What it is startnumberendnumbermessagestring
function defineProfile (spec : ProfileSpec ): Profile A profile from its parts.
Imported by 8 tests of the run (8 passed, 0 failed): the library's results
function conform (parsed : Parsed , profile : Profile ): Result <Parsed , readonly Violation []>The parse where it is inside the profile; every violation, with its span, where it is not.
Imported by 8 tests of the run (8 passed, 0 failed): the library's results