@jetstreamapp/soql-parser-js 7.4.1 → 8.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import { FieldType, GroupByClause, HavingClause, OrderByClause, Query, WhereClause, WithDataCategoryClause, FieldTypeOf, Subquery } from '../api/api-models';
1
+ import { FieldType, FieldTypeOf, GroupByClause, HavingClause, OrderByClause, Query, Subquery, WhereClause, WithDataCategoryClause } from '../api/api-models';
2
2
  import { Formatter, FormatOptions } from '../formatter/formatter';
3
3
  import { ParseQueryConfig } from '../parser/parser';
4
4
  export interface SoqlComposeConfig {
@@ -18,14 +18,13 @@ export declare class Compose {
18
18
  constructor(soql: Query, config?: Partial<SoqlComposeConfig>);
19
19
  start(): void;
20
20
  private log;
21
- private parseFn;
22
21
  parseQuery(query: Query | Subquery): string;
23
22
  parseFields(fields: FieldType[]): {
24
23
  text: string;
25
24
  typeOfClause?: string[];
26
25
  }[];
27
26
  parseTypeOfField(typeOfField: FieldTypeOf): string[];
28
- parseWhereOrHavingClause(whereOrHaving: WhereClause | HavingClause, tabOffset?: number, priorConditionIsNegation?: boolean): string;
27
+ parseWhereOrHavingClause(whereOrHaving: WhereClause | HavingClause, indent?: number): string;
29
28
  parseGroupByClause(groupBy: GroupByClause | GroupByClause[]): string;
30
29
  parseOrderBy(orderBy: OrderByClause | OrderByClause[]): string;
31
30
  parseWithDataCategory(withDataCategory: WithDataCategoryClause): string;
@@ -0,0 +1,38 @@
1
+ import { ConditionWithValueQuery, FieldType, FieldTypeOf, FieldTypeOfCondition, FunctionExp, GroupByClause, HavingClause, NegationCondition, OrderByClause, Query, Subquery, ValueQueryCondition, WhereClause, WithDataCategoryClause } from '../api/api-models';
2
+ export declare function renderFn(fn: FunctionExp): string;
3
+ export declare function renderFieldText(field: Exclude<FieldType, {
4
+ type: 'FieldSubquery';
5
+ }>): string;
6
+ export declare function renderTypeOfParts(field: FieldTypeOf): string[];
7
+ export declare function renderTypeOfCondition(condition: FieldTypeOfCondition): string;
8
+ export declare function renderFrom(query: Query | Subquery): string;
9
+ export type NonNegationCondition = Exclude<ConditionWithValueQuery, NegationCondition>;
10
+ export type SimpleCondition = Exclude<ConditionWithValueQuery, NegationCondition | ValueQueryCondition>;
11
+ export declare function renderConditionLhs(condition: NonNegationCondition): string;
12
+ export declare function renderConditionValue(condition: SimpleCondition): string;
13
+ export declare function renderGroupByItem(groupBy: GroupByClause): string;
14
+ export declare function renderOrderByItem(orderBy: OrderByClause): string;
15
+ export declare function renderWithDataCategory(withDataCategory: WithDataCategoryClause): string;
16
+ export declare function hasGroupBy(query: Query | Subquery): boolean;
17
+ export declare function hasOrderBy(query: Query | Subquery): boolean;
18
+ export declare function asArray<T>(value: T | T[]): T[];
19
+ export type ClausePart = {
20
+ kind: 'select';
21
+ fields: FieldType[];
22
+ } | {
23
+ kind: 'value';
24
+ keyword: string;
25
+ value: string;
26
+ } | {
27
+ kind: 'bare';
28
+ keyword: string;
29
+ } | {
30
+ kind: 'list';
31
+ keyword: string;
32
+ items: string[];
33
+ } | {
34
+ kind: 'conditions';
35
+ keyword: string;
36
+ clause: WhereClause | HavingClause;
37
+ };
38
+ export declare function queryClauses(query: Query | Subquery): Generator<ClausePart>;
@@ -0,0 +1,3 @@
1
+ import { HavingClause, Query, Subquery, WhereClause } from '../api/api-models';
2
+ export declare function composePlain(query: Query | Subquery): string;
3
+ export declare function composePlainConditions(whereOrHaving: WhereClause | HavingClause): string;
@@ -1,42 +1,35 @@
1
- import { FieldTypeOfCondition } from '../api/api-models';
2
- export interface FieldData {
3
- fields: {
4
- text: string;
5
- typeOfClause?: string[];
6
- isSubquery: boolean;
7
- prefix: string;
8
- suffix: string;
9
- }[];
10
- isSubquery: boolean;
11
- lineBreaks: number[];
12
- }
1
+ import { HavingClause, Query, Subquery, WhereClause } from '../api/api-models';
13
2
  export interface FormatOptions {
14
3
  numIndent?: number;
4
+ indentString?: string;
15
5
  fieldMaxLineLength?: number;
16
6
  fieldSubqueryParensOnOwnLine?: boolean;
17
7
  whereClauseOperatorsIndented?: boolean;
18
8
  newLineAfterKeywords?: boolean;
19
9
  logging?: boolean;
20
10
  }
11
+ export type ResolvedFormatOptions = Required<Pick<FormatOptions, 'numIndent' | 'indentString' | 'fieldMaxLineLength' | 'fieldSubqueryParensOnOwnLine' | 'newLineAfterKeywords'>>;
12
+ export declare function resolveFormatOptions(options?: FormatOptions): ResolvedFormatOptions;
21
13
  export declare class Formatter {
22
- enabled: boolean;
23
- private options;
24
- private currIndent;
25
- constructor(enabled: boolean, options: FormatOptions);
26
- private log;
27
- private getIndent;
28
- private repeatChar;
29
- setSubquery(isSubquery: boolean): void;
30
- stepCurrIndex(num: number): void;
31
- formatFields(fieldData: FieldData): void;
32
- formatTyeOfField(text: string, typeOfClause: string[]): string;
33
- formatTypeofFieldCondition(condition: FieldTypeOfCondition): string;
34
- formatSubquery(queryStr: string, numTabs?: number, incrementTabsWhereClauseOpIndent?: boolean): string;
35
- formatClause(clause: string): string;
36
- formatText(text: string): string;
37
- formatWithIndent(text: string): string;
38
- formatOrderByArray(groupBy: string[]): string;
39
- formatParens(count: number | undefined, character: '(' | ')', leadingParenInline?: boolean): string;
40
- formatWhereClauseOperators(operator: string, whereClause: string, additionalIndent?: number): string;
41
- formatAddNewLine(alt?: string, skipNewLineAndIndent?: boolean): string;
14
+ readonly options: ResolvedFormatOptions;
15
+ constructor(options?: FormatOptions);
16
+ formatQuery(query: Query | Subquery): string;
17
+ formatWhereOrHavingClause(whereOrHaving: WhereClause | HavingClause, base?: number): string;
18
+ formatSubqueryField(subquery: Subquery): string;
19
+ formatList(items: string[]): string;
20
+ private render;
21
+ private renderFragment;
22
+ private indent;
23
+ private query;
24
+ private clause;
25
+ private keywordThen;
26
+ private selectClause;
27
+ private wrapper;
28
+ private selectSubquery;
29
+ private typeOfField;
30
+ private listClause;
31
+ private listRows;
32
+ private conditions;
33
+ private isSelfContainedNegation;
34
+ private condition;
42
35
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetstreamapp/soql-parser-js",
3
- "version": "7.4.1",
3
+ "version": "8.0.0",
4
4
  "salesforceApiVersion": "66.0",
5
5
  "description": "Salesforce.com SOQL parser and composer",
6
6
  "main": "dist/cjs/index.js",
@@ -52,6 +52,7 @@
52
52
  "README.md"
53
53
  ],
54
54
  "devDependencies": {
55
+ "@release-it/keep-a-changelog": "^8.0.0",
55
56
  "@types/node": "^25.5.0",
56
57
  "esbuild": "^0.28.0",
57
58
  "lodash.get": "^4.4.2",