From f32c5e511150789a109637fcdb1a40e647ce005c Mon Sep 17 00:00:00 2001 From: Austin Turner Date: Tue, 21 Jun 2022 17:38:32 -0500 Subject: [PATCH] Changed accessLevel property Changed accessLevel to withAccessLevel #193 #194 --- CHANGELOG.md | 3 ++- README.md | 1 + src/api/api-models.ts | 2 +- src/composer/composer.ts | 4 ++-- src/models.ts | 2 +- src/parser/parser.ts | 4 ++-- src/parser/visitor.ts | 10 +++++----- test/test-cases.ts | 4 ++-- 8 files changed, 16 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a811b42..e8b894a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Changelog -## 4.5.0 +## 4.5.0 / 4.5.1 June 21, 2022 @@ -9,6 +9,7 @@ June 21, 2022 - `SELECT Id FROM Account WITH USER_MODE` - `SELECT Id FROM Account WITH SYSTEM_MODE` - Thank you @ghingis +- Patch release - changed property from `accessLevel` to `withAccessLevel` ## 4.4.1 diff --git a/README.md b/README.md index b17ae29..cc14ec0 100644 --- a/README.md +++ b/README.md @@ -795,6 +795,7 @@ export interface QueryBase { orderBy?: OrderByClause | OrderByClause[]; withDataCategory?: WithDataCategoryClause; withSecurityEnforced?: boolean; + withAccessLevel?: boolean; for?: ForClause; update?: UpdateClause; } diff --git a/src/api/api-models.ts b/src/api/api-models.ts index 7de9b21..fe89729 100644 --- a/src/api/api-models.ts +++ b/src/api/api-models.ts @@ -139,7 +139,7 @@ export interface QueryBase { orderBy?: OrderByClause | OrderByClause[]; withDataCategory?: WithDataCategoryClause; withSecurityEnforced?: boolean; - accessLevel?: AccessLevel; + withAccessLevel?: AccessLevel; for?: ForClause; update?: UpdateClause; } diff --git a/src/composer/composer.ts b/src/composer/composer.ts index edfe1b0..286da28 100644 --- a/src/composer/composer.ts +++ b/src/composer/composer.ts @@ -233,8 +233,8 @@ export class Compose { this.log(output); } - if (query.accessLevel) { - output += this.formatter.formatClause(`WITH ${query.accessLevel}`); + if (query.withAccessLevel) { + output += this.formatter.formatClause(`WITH ${query.withAccessLevel}`); this.log(output); } diff --git a/src/models.ts b/src/models.ts index 1c07fd2..678c37f 100644 --- a/src/models.ts +++ b/src/models.ts @@ -104,7 +104,7 @@ export interface ConditionExpressionContext { export interface WithClauseContext { withSecurityEnforced?: CstNode[]; - accessLevel?: IToken[]; + withAccessLevel?: IToken[]; withDataCategory?: CstNode[]; } diff --git a/src/parser/parser.ts b/src/parser/parser.ts index 26c7d3a..ff45826 100644 --- a/src/parser/parser.ts +++ b/src/parser/parser.ts @@ -309,8 +309,8 @@ export class SoqlParser extends CstParser { this.CONSUME(lexer.With); this.OR([ { ALT: () => this.CONSUME(lexer.SecurityEnforced, { LABEL: 'withSecurityEnforced' }) }, - { ALT: () => this.CONSUME(lexer.UserMode, { LABEL: 'accessLevel' }) }, - { ALT: () => this.CONSUME(lexer.SystemMode, { LABEL: 'accessLevel' }) }, + { ALT: () => this.CONSUME(lexer.UserMode, { LABEL: 'withAccessLevel' }) }, + { ALT: () => this.CONSUME(lexer.SystemMode, { LABEL: 'withAccessLevel' }) }, { ALT: () => this.SUBRULE(this.withDataCategory) }, ]); }); diff --git a/src/parser/visitor.ts b/src/parser/visitor.ts index ed57589..3bb9517 100644 --- a/src/parser/visitor.ts +++ b/src/parser/visitor.ts @@ -277,12 +277,12 @@ class SOQLVisitor extends BaseSoqlVisitor { ctx.withClause .filter(item => !item.recoveredNode) .forEach(item => { - const { withSecurityEnforced, accessLevel, withDataCategory } = this.visit(item); + const { withSecurityEnforced, withAccessLevel, withDataCategory } = this.visit(item); if (withSecurityEnforced) { query.withSecurityEnforced = withSecurityEnforced; } - if (accessLevel) { - query.accessLevel = accessLevel; + if (withAccessLevel) { + query.withAccessLevel = withAccessLevel; } if (withDataCategory) { query.withDataCategory = withDataCategory; @@ -485,9 +485,9 @@ class SOQLVisitor extends BaseSoqlVisitor { return { withSecurityEnforced: true, }; - } else if (ctx.accessLevel) { + } else if (ctx.withAccessLevel) { return { - accessLevel: ctx.accessLevel[0].image, + withAccessLevel: ctx.withAccessLevel[0].image, }; } else { return { diff --git a/test/test-cases.ts b/test/test-cases.ts index ff82bab..7fbff01 100644 --- a/test/test-cases.ts +++ b/test/test-cases.ts @@ -2503,7 +2503,7 @@ export const testCases: TestCase[] = [ output: { fields: [{ type: 'Field', field: 'Id' }], sObject: 'Account', - accessLevel: 'USER_MODE', + withAccessLevel: 'USER_MODE', }, }, { @@ -2512,7 +2512,7 @@ export const testCases: TestCase[] = [ output: { fields: [{ type: 'Field', field: 'Id' }], sObject: 'Account', - accessLevel: 'SYSTEM_MODE', + withAccessLevel: 'SYSTEM_MODE', }, }, ];