Skip to content

Commit

Permalink
add object name validator as property (#84)
Browse files Browse the repository at this point in the history
* add object name validator as property

* 2.11.3
  • Loading branch information
kbarbounakis authored Apr 5, 2024
1 parent 11c2084 commit 30bde57
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 4 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@themost/query",
"version": "2.11.2",
"version": "2.11.3",
"description": "MOST Web Framework Codename ZeroGravity - Query Module",
"main": "dist/index.cjs.js",
"module": "dist/index.esm.js",
Expand Down
2 changes: 2 additions & 0 deletions src/formatter.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// MOST Web Framework Codename Zero Gravity Copyright (c) 2017-2022, THEMOST LP All rights reserved
import { ObjectNameValidator } from './object-name.validator';
import {QueryExpression, QueryField, QueryValueRef} from "./query";

export declare interface FormatterSettings {
Expand All @@ -10,6 +11,7 @@ export declare interface FormatterSettings {
export declare class SqlFormatter {
provider: any;
settings: FormatterSettings;
get validator(): ObjectNameValidator;

escape(value: any,unquoted?: boolean): string | any;
escapeConstant(value: any,unquoted?: boolean): string | any;
Expand Down
10 changes: 9 additions & 1 deletion src/formatter.js
Original file line number Diff line number Diff line change
Expand Up @@ -986,8 +986,16 @@ class SqlFormatter {
if (isNameReference(str)) {
str = trimNameReference(name);
}
return ObjectNameValidator.validator.escape(str, this.settings.nameFormat);
return this.validator.escape(str, this.settings.nameFormat);
}

/**
* @returns {ObjectNameValidator}
*/
get validator() {
return ObjectNameValidator.validator;
}

/**
* @param obj {QueryField}
* @param format {string}
Expand Down
1 change: 1 addition & 0 deletions src/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export * from './closures/PrototypeMethodParser';
export * from './closures/MathMethodParser';
export * from './closures/DateMethodParser';
export * from './closures/StringMethodParser';
export * from './object-name.validator';
export * from './open-data-query.expression';
export * from './open-data-query.formatter';

0 comments on commit 30bde57

Please sign in to comment.