Skip to content

Commit 0866573

Browse files
authored
Merge pull request #196 from paustint/fix-193
Changed accessLevel property
2 parents f7b9def + f32c5e5 commit 0866573

File tree

8 files changed

+16
-14
lines changed

8 files changed

+16
-14
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Changelog
22

3-
## 4.5.0
3+
## 4.5.0 / 4.5.1
44

55
June 21, 2022
66

@@ -9,6 +9,7 @@ June 21, 2022
99
- `SELECT Id FROM Account WITH USER_MODE`
1010
- `SELECT Id FROM Account WITH SYSTEM_MODE`
1111
- Thank you @ghingis
12+
- Patch release - changed property from `accessLevel` to `withAccessLevel`
1213

1314
## 4.4.1
1415

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -795,6 +795,7 @@ export interface QueryBase {
795795
orderBy?: OrderByClause | OrderByClause[];
796796
withDataCategory?: WithDataCategoryClause;
797797
withSecurityEnforced?: boolean;
798+
withAccessLevel?: boolean;
798799
for?: ForClause;
799800
update?: UpdateClause;
800801
}

src/api/api-models.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ export interface QueryBase {
139139
orderBy?: OrderByClause | OrderByClause[];
140140
withDataCategory?: WithDataCategoryClause;
141141
withSecurityEnforced?: boolean;
142-
accessLevel?: AccessLevel;
142+
withAccessLevel?: AccessLevel;
143143
for?: ForClause;
144144
update?: UpdateClause;
145145
}

src/composer/composer.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,8 +233,8 @@ export class Compose {
233233
this.log(output);
234234
}
235235

236-
if (query.accessLevel) {
237-
output += this.formatter.formatClause(`WITH ${query.accessLevel}`);
236+
if (query.withAccessLevel) {
237+
output += this.formatter.formatClause(`WITH ${query.withAccessLevel}`);
238238
this.log(output);
239239
}
240240

src/models.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ export interface ConditionExpressionContext {
104104

105105
export interface WithClauseContext {
106106
withSecurityEnforced?: CstNode[];
107-
accessLevel?: IToken[];
107+
withAccessLevel?: IToken[];
108108
withDataCategory?: CstNode[];
109109
}
110110

src/parser/parser.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -309,8 +309,8 @@ export class SoqlParser extends CstParser {
309309
this.CONSUME(lexer.With);
310310
this.OR([
311311
{ ALT: () => this.CONSUME(lexer.SecurityEnforced, { LABEL: 'withSecurityEnforced' }) },
312-
{ ALT: () => this.CONSUME(lexer.UserMode, { LABEL: 'accessLevel' }) },
313-
{ ALT: () => this.CONSUME(lexer.SystemMode, { LABEL: 'accessLevel' }) },
312+
{ ALT: () => this.CONSUME(lexer.UserMode, { LABEL: 'withAccessLevel' }) },
313+
{ ALT: () => this.CONSUME(lexer.SystemMode, { LABEL: 'withAccessLevel' }) },
314314
{ ALT: () => this.SUBRULE(this.withDataCategory) },
315315
]);
316316
});

src/parser/visitor.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -277,12 +277,12 @@ class SOQLVisitor extends BaseSoqlVisitor {
277277
ctx.withClause
278278
.filter(item => !item.recoveredNode)
279279
.forEach(item => {
280-
const { withSecurityEnforced, accessLevel, withDataCategory } = this.visit(item);
280+
const { withSecurityEnforced, withAccessLevel, withDataCategory } = this.visit(item);
281281
if (withSecurityEnforced) {
282282
query.withSecurityEnforced = withSecurityEnforced;
283283
}
284-
if (accessLevel) {
285-
query.accessLevel = accessLevel;
284+
if (withAccessLevel) {
285+
query.withAccessLevel = withAccessLevel;
286286
}
287287
if (withDataCategory) {
288288
query.withDataCategory = withDataCategory;
@@ -485,9 +485,9 @@ class SOQLVisitor extends BaseSoqlVisitor {
485485
return {
486486
withSecurityEnforced: true,
487487
};
488-
} else if (ctx.accessLevel) {
488+
} else if (ctx.withAccessLevel) {
489489
return {
490-
accessLevel: ctx.accessLevel[0].image,
490+
withAccessLevel: ctx.withAccessLevel[0].image,
491491
};
492492
} else {
493493
return {

test/test-cases.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2503,7 +2503,7 @@ export const testCases: TestCase[] = [
25032503
output: {
25042504
fields: [{ type: 'Field', field: 'Id' }],
25052505
sObject: 'Account',
2506-
accessLevel: 'USER_MODE',
2506+
withAccessLevel: 'USER_MODE',
25072507
},
25082508
},
25092509
{
@@ -2512,7 +2512,7 @@ export const testCases: TestCase[] = [
25122512
output: {
25132513
fields: [{ type: 'Field', field: 'Id' }],
25142514
sObject: 'Account',
2515-
accessLevel: 'SYSTEM_MODE',
2515+
withAccessLevel: 'SYSTEM_MODE',
25162516
},
25172517
},
25182518
];

0 commit comments

Comments
 (0)