@elyx-code/project-logic-tree 0.0.6883 → 0.0.6885

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.
Files changed (4) hide show
  1. package/dist/index.cjs +282 -282
  2. package/dist/index.d.ts +101 -17
  3. package/dist/index.js +54508 -54057
  4. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -333,7 +333,7 @@ declare class AggregationStatement implements ISearchNode {
333
333
  get id(): string;
334
334
  get columns(): ColumnRef[];
335
335
  get isValid(): boolean;
336
- get selections(): (ColumnRef | AllColumnsSelector)[];
336
+ get selections(): (ColumnRef | AllColumnsSelector | FunctionCall)[];
337
337
  get selectedColumns(): ColumnRef[];
338
338
  get primaryKeys(): ColumnRef[];
339
339
  get primaryKey(): ColumnRef | null;
@@ -10794,16 +10794,18 @@ export declare enum BaseValueDescriptorIds {
10794
10794
  entity: DefinitionEntityState | null;
10795
10795
  query: NestedSearchStatement | null;
10796
10796
  aggregation: AggregationStatement | null;
10797
+ functionCall: FunctionCall | null;
10797
10798
  sourceType: DataSourceType | null;
10799
+ private _asFallback;
10798
10800
  constructor(owner: SearchStatementState);
10799
10801
  get id(): string;
10800
10802
  get type(): SearchStatementNodeType.DataSource;
10801
10803
  get isValid(): boolean;
10802
- get source(): DefinitionEntityState | NestedSearchStatement | AggregationStatement | null;
10804
+ get source(): DefinitionEntityState | NestedSearchStatement | AggregationStatement | FunctionCall | null;
10803
10805
  set as(as: string);
10804
10806
  get as(): string;
10805
10807
  get columns(): ColumnRef[];
10806
- get selections(): (ColumnRef | AllColumnsSelector)[];
10808
+ get selections(): (ColumnRef | AllColumnsSelector | FunctionCall)[];
10807
10809
  get mainPersistedEntity(): DefinitionEntityState | null;
10808
10810
  get selectedColumns(): ColumnRef[];
10809
10811
  get primaryKeys(): ColumnRef[];
@@ -10813,7 +10815,8 @@ export declare enum BaseValueDescriptorIds {
10813
10815
  declare enum DataSourceType {
10814
10816
  Table = "table",
10815
10817
  Query = "query",
10816
- Aggregation = "aggregation"
10818
+ Aggregation = "aggregation",
10819
+ Function = "function"
10817
10820
  }
10818
10821
 
10819
10822
  export declare function dataTypeCompatibilityToErrorExplanation(entityWithValueA: EntityWithValueState, entityWithValueB: EntityWithValueState, compatibility: IDataTypeCompatible | IDataTypeIncompatibile): string;
@@ -14774,6 +14777,8 @@ export declare enum BaseValueDescriptorIds {
14774
14777
  /** Converts bytes into string using the given encoding. */
14775
14778
  export declare function fromBytes(bytes: Bytes, encoding?: AnyEncoding): string;
14776
14779
 
14780
+ declare function fromCallExprToFunctionCall(callExpr: Expr, scopeColumns: ColumnRef[], state: SearchStatementState, project: ProjectState): FunctionCall | null;
14781
+
14777
14782
  export declare function fromChangeSetToRecordChangeSet<TSelf extends {
14778
14783
  id: string;
14779
14784
  type: EntityType;
@@ -14808,13 +14813,13 @@ export declare enum BaseValueDescriptorIds {
14808
14813
 
14809
14814
  export declare const fromNowWithoutSuffixDataTypeParentRef: IValueDescriptorReference;
14810
14815
 
14811
- declare function fromOrderByClauseToSortStatements(orderByClause: OrderByClause, _selectStatement: SelectStmt, _allColumns: IColumnMapping[], state: SearchStatementState): SortStatement[];
14816
+ declare function fromOrderByClauseToSortStatements(orderByClause: OrderByClause, _selectStatement: SelectStmt, _allColumns: IColumnMapping[], state: SearchStatementState, project: ProjectState): SortStatement[];
14812
14817
 
14813
14818
  export declare function fromPublishingDisabledCodeToReadable(code: PUBLISHING_DISABLED_REASONS): string;
14814
14819
 
14815
14820
  declare function fromSelectClauseColumnsToColumnMappings(selectClause: SelectClause, objectName?: string): IShallowColumnMapping[];
14816
14821
 
14817
- declare function fromSelectClauseToLiteralValueSelections(selectClause: SelectClause, state: SearchStatementState, project: ProjectState, _debug?: boolean): ColumnRef[];
14822
+ declare function fromSelectClauseToLiteralValueSelections(selectClause: SelectClause, state: SearchStatementState, project: ProjectState, _debug?: boolean): (ColumnRef | FunctionCall)[];
14818
14823
 
14819
14824
  declare function fromSqlOperatorsExprToComparisonOperator(operator: SupportedOperators): WhereStatementOperator | 'not' | null;
14820
14825
 
@@ -14843,6 +14848,28 @@ export declare enum BaseValueDescriptorIds {
14843
14848
 
14844
14849
  export declare const FULL_EDITING_PROPERTIES_EXPLANATION = "Entities of any type have two types of fields: primitive meta-data fields, and relational fields that point to other entities.\nRelational fields can be upstream or downstream.\nOnly upstream fields are owned and can be edited by the entity itself.\nDownstream fields are owned and edited by the downstream entity that points to this entity.\nFor example, many entities have a 'parent' field that points to their parent entity. Once the parent is set, they show up in one of the downstream fields of the parent entity, like 'inputs' or 'body'.\n\nSome meta-data properties of entities can be changed after the initial creation, like 'name', 'description', etc...\nThese are called mutable meta-properties.\n\nSome meta-data properties of entities cannot be changed after the initial creation, like 'type', 'id', etc...\nThese are called inmutable meta-properties.\n\nSome upstream relational properties of entities cannot be changed after the initial creation, like 'parent' for some entities, etc...\nThese are called inmutable upstream properties.\n\nSome fields on an entity point to a downstream/nested entity, which means it is a child of the current entity in the tree. Downstream properties are owned and managed by the downstream entity itself, and cannot be modified directly on the upstream entity.\nFor example, a 'function-declaration' entity has a list of downstream references to its 'argument-declaration' in the property called 'inputs'. To edit the relationship, or modify any of the inputs, the input itself must be targeted directly.";
14845
14850
 
14851
+ declare type FunctionArgument = ColumnRef | ValueRef | SearchStatementLiteralValue | FunctionCall | AllColumnsSelector;
14852
+
14853
+ declare class FunctionCall implements ISearchNode {
14854
+ owner: SearchStatementState;
14855
+ private _functionName;
14856
+ category: SQLFunctionCategory;
14857
+ arguments: FunctionArgument[];
14858
+ parent: DataSource | null;
14859
+ _id: string;
14860
+ _as: string | null;
14861
+ constructor(owner: SearchStatementState);
14862
+ set functionName(name: FunctionNames);
14863
+ get functionName(): FunctionNames | '';
14864
+ set as(as: string);
14865
+ get as(): string;
14866
+ get type(): SearchStatementNodeType.FunctionCall;
14867
+ get id(): string;
14868
+ get isValid(): boolean;
14869
+ toQuery(): string;
14870
+ hasFunctionOfCategory(category: SQLFunctionCategory): boolean;
14871
+ }
14872
+
14846
14873
  export declare enum FunctionCallDependencyField {
14847
14874
  FunctionCallParentField = "function-call-parent-field",
14848
14875
  FunctionCallDeclarationField = "function-call-declaration-field"
@@ -15205,6 +15232,25 @@ export declare enum BaseValueDescriptorIds {
15205
15232
  }
15206
15233
  export { functionDeclarationValidation }
15207
15234
 
15235
+ declare enum FunctionNames {
15236
+ Upper = "UPPER",
15237
+ Lower = "LOWER",
15238
+ Max = "MAX",
15239
+ Min = "MIN",
15240
+ JsonBuildObject = "json_build_object",
15241
+ RowToJson = "row_to_json",
15242
+ JsonAgg = "json_agg",
15243
+ Count = "COUNT",
15244
+ GenerateSeries = "generate_series",
15245
+ Unnest = "unnest",
15246
+ Coalesce = "COALESCE",
15247
+ Concat = "CONCAT",
15248
+ Sum = "SUM",
15249
+ Length = "LENGTH",
15250
+ Round = "ROUND",
15251
+ Now = "NOW"
15252
+ }
15253
+
15208
15254
  export declare const gdriveSmartFetchActionDescriptorTransfer: IActionDescriptorTransfer;
15209
15255
 
15210
15256
  /** 0) connection (asType external connection entity) */
@@ -18992,18 +19038,30 @@ export declare enum BaseValueDescriptorIds {
18992
19038
  type: 'query';
18993
19039
  subquery: SelectStmt;
18994
19040
  as: string;
19041
+ } | {
19042
+ type: 'function';
19043
+ functionCall: Expr;
19044
+ as: string;
18995
19045
  } | null;
18996
19046
 
18997
19047
  declare function getMainSourceNameFromFromClauseExpr(fromExpr: JoinExpr | PivotExpr | UnpivotExpr | TablesampleExpr | ForSystemTimeAsOfExpr | TableFactor, parentExpr?: JoinExpr): {
18998
19048
  type: 'table';
18999
19049
  name: string;
19000
19050
  as: string;
19051
+ } | {
19052
+ type: 'function';
19053
+ functionCall: Expr;
19054
+ as: string;
19001
19055
  } | null;
19002
19056
 
19003
19057
  declare function getMainSourceNameFromSelectStatement(selectStatement: SelectStmt): {
19004
19058
  type: 'table';
19005
19059
  name: string;
19006
19060
  as: string;
19061
+ } | {
19062
+ type: 'function';
19063
+ functionCall: Expr;
19064
+ as: string;
19007
19065
  } | null;
19008
19066
 
19009
19067
  export declare function getMillisecond(input: ISODateString): number;
@@ -25936,7 +25994,7 @@ export declare enum BaseValueDescriptorIds {
25936
25994
  get isValid(): boolean;
25937
25995
  get columns(): ColumnRef[];
25938
25996
  get mainPersistedEntity(): DefinitionEntityState | null;
25939
- get selections(): (ColumnRef | AllColumnsSelector)[];
25997
+ get selections(): (ColumnRef | AllColumnsSelector | FunctionCall)[];
25940
25998
  get selectedColumns(): ColumnRef[];
25941
25999
  get primaryKeys(): ColumnRef[];
25942
26000
  get primaryKey(): ColumnRef | null;
@@ -31553,6 +31611,8 @@ export declare enum BaseValueDescriptorIds {
31553
31611
 
31554
31612
  export declare function resolveEntitySubheader(entity: VariableState | DefinitionEntityState | LoopState | SearchState | FunctionDeclarationState | GlobalEventState | ReturnStatementState | BreakStatementState | ContinueStatementState | BuiltInBaseEntityState): string;
31555
31613
 
31614
+ declare function resolveExprToFunctionArgument(expr: Expr | any, scopeColumns: ColumnRef[], state: SearchStatementState, project: ProjectState): FunctionArgument | null;
31615
+
31556
31616
  export declare function resolveFirstCallsSecond(first: DraggableExecutableEntityState, second: DraggableCallableEntityState): boolean;
31557
31617
 
31558
31618
  export declare function resolveFirstWritesSecond(first: ValueWritingEntityState, second: ValueReadingEntityState): boolean;
@@ -31833,7 +31893,7 @@ export declare enum BaseValueDescriptorIds {
31833
31893
 
31834
31894
  declare function sanitizeQuery(query: string): string;
31835
31895
 
31836
- declare function sanitizeSQLIdentifierText(text: string): string;
31896
+ declare function sanitizeSQLIdentifierText(text: string): FunctionNames;
31837
31897
 
31838
31898
  export declare type ScopeCompatibility = ICompatibleSameBothLocalScope | ICompatibleSameBothGlobalScope | ICompatibleAInBScope | ICompatibleBInAScope | IIncompatibleParallelInProjectScope | IIncompatibleParallelInCommonParentScope | IIncompatibleAIsGlobalBIsNotScope | IIncompatibleBIsGlobalAIsNotScope;
31839
31899
 
@@ -32057,6 +32117,17 @@ export declare enum BaseValueDescriptorIds {
32057
32117
  getDataType(changeSet?: ChangeSet | null): DataTypeState | null;
32058
32118
  }
32059
32119
 
32120
+ declare namespace searchStatementDefs {
32121
+ export {
32122
+ SearchStatementNodeType,
32123
+ AggregationStatementType,
32124
+ SQLFunctionCategory,
32125
+ SQLDataType,
32126
+ FunctionNames
32127
+ }
32128
+ }
32129
+ export { searchStatementDefs }
32130
+
32060
32131
  export declare const searchStatementErrorGlobalValueDescriptor: IValueDescriptorTransfer;
32061
32132
 
32062
32133
  export declare const searchStatementErrorGlobalValueDescriptorDataType: IDataTypeTransfer;
@@ -32084,12 +32155,13 @@ export declare enum BaseValueDescriptorIds {
32084
32155
  WhereStatement = "where-statement",
32085
32156
  AggregationStatement = "aggregation-statement",
32086
32157
  SortStatement = "sort-statement",
32087
- AllColumnsSelector = "all-columns-selector"
32158
+ AllColumnsSelector = "all-columns-selector",
32159
+ FunctionCall = "function-call"
32088
32160
  }
32089
32161
 
32090
32162
  declare class SearchStatementState implements ISearchNode {
32091
32163
  id: string;
32092
- selections: (ColumnRef | AllColumnsSelector)[];
32164
+ selections: (ColumnRef | AllColumnsSelector | FunctionCall)[];
32093
32165
  from: DataSource | null;
32094
32166
  aggregations: AggregationStatement[];
32095
32167
  where: WhereStatement | null;
@@ -32099,6 +32171,7 @@ export declare enum BaseValueDescriptorIds {
32099
32171
  sorting: SortStatement[];
32100
32172
  dataSources: DataSource[];
32101
32173
  constructor(id: string);
32174
+ get validationErrors(): string[];
32102
32175
  get isUntouchedEntity(): boolean;
32103
32176
  get usedDataSources(): DataSource[];
32104
32177
  get type(): SearchStatementNodeType.SearchStatement;
@@ -32106,7 +32179,7 @@ export declare enum BaseValueDescriptorIds {
32106
32179
  get mainDatabaseEntity(): DefinitionEntityState | null;
32107
32180
  get validSortings(): SortStatement[];
32108
32181
  get selectedColumns(): ColumnRef[];
32109
- get validSelections(): (ColumnRef | AllColumnsSelector)[];
32182
+ get validSelections(): (ColumnRef | AllColumnsSelector | FunctionCall)[];
32110
32183
  get validSelectedColumns(): ColumnRef[];
32111
32184
  get columns(): ColumnRef[];
32112
32185
  get isValid(): boolean;
@@ -32128,7 +32201,7 @@ export declare enum BaseValueDescriptorIds {
32128
32201
  addSort(sort: SortStatement): void;
32129
32202
  removeSort(sort: SortStatement): void;
32130
32203
  editSort(sort: SortStatement): void;
32131
- addSelection(selection: ColumnRef | AllColumnsSelector): void;
32204
+ addSelection(selection: ColumnRef | AllColumnsSelector | FunctionCall): void;
32132
32205
  removeSelection(selection: ColumnRef | AllColumnsSelector): void;
32133
32206
  editSelection(selection: ColumnRef | AllColumnsSelector): void;
32134
32207
  setFrom(from: DataSource): void;
@@ -32142,9 +32215,9 @@ export declare enum BaseValueDescriptorIds {
32142
32215
  export {
32143
32216
  resolveAreThereConflictingColumnsInSelectAll,
32144
32217
  whereStatementOperatorToSQL,
32145
- SearchStatementNodeType,
32146
32218
  ISearchNode,
32147
- AggregationStatementType,
32219
+ FunctionArgument,
32220
+ FunctionCall,
32148
32221
  AggregationStatement,
32149
32222
  ValueRef,
32150
32223
  SearchLiteralValueType,
@@ -32185,6 +32258,8 @@ export declare enum BaseValueDescriptorIds {
32185
32258
  fromWhereBinaryExprToAndOrOperatorValue,
32186
32259
  flattenBinaryExprComparisonsToWhereStatements,
32187
32260
  fromWhereExprToWhereStatement,
32261
+ fromCallExprToFunctionCall,
32262
+ resolveExprToFunctionArgument,
32188
32263
  getJoinOnSpecificationAsWhereStatementFromJoinExpr,
32189
32264
  flattenJoinExprIntoAggregationStatementsSync,
32190
32265
  getAggregationStatementsFromSelectStatementSync,
@@ -32768,7 +32843,7 @@ export declare enum BaseValueDescriptorIds {
32768
32843
 
32769
32844
  declare class SortStatement implements ISearchNode {
32770
32845
  owner: SearchStatementState;
32771
- column: ColumnRef | null;
32846
+ column: ColumnRef | FunctionCall | null;
32772
32847
  direction: SortStatementDirection;
32773
32848
  index: number;
32774
32849
  constructor(owner: SearchStatementState);
@@ -32907,6 +32982,14 @@ export declare enum BaseValueDescriptorIds {
32907
32982
 
32908
32983
  export { SQLAST }
32909
32984
 
32985
+ declare type SQLDataType = 'string' | 'number' | 'boolean' | 'date' | 'table' | 'any' | 'json' | 'array';
32986
+
32987
+ declare enum SQLFunctionCategory {
32988
+ Scalar = "SCALAR",
32989
+ Aggregate = "AGGREGATE",
32990
+ TableValued = "TABLE_VALUED"
32991
+ }
32992
+
32910
32993
  export declare const sqlRowTransformerBuiltInBaseEntity: IBuiltInBaseEntityTransfer;
32911
32994
 
32912
32995
  export declare const sqlRowTransformerBuiltInBaseEntityDefinitionProperty: IPropertyTransfer;
@@ -35861,9 +35944,9 @@ export declare enum BaseValueDescriptorIds {
35861
35944
  parent: WhereStatement | null;
35862
35945
  and: WhereStatement[];
35863
35946
  or: WhereStatement[];
35864
- left: ColumnRef | ValueRef | SearchStatementLiteralValue | null;
35947
+ left: ColumnRef | ValueRef | SearchStatementLiteralValue | FunctionCall | null;
35865
35948
  operator: WhereStatementOperator | null;
35866
- right: ColumnRef | ValueRef | SearchStatementLiteralValue | null;
35949
+ right: ColumnRef | ValueRef | SearchStatementLiteralValue | FunctionCall | null;
35867
35950
  _id: string;
35868
35951
  constructor(owner: SearchStatementState, parent?: WhereStatement);
35869
35952
  get type(): SearchStatementNodeType.WhereStatement;
@@ -35874,6 +35957,7 @@ export declare enum BaseValueDescriptorIds {
35874
35957
  sanitize(): void;
35875
35958
  removeFromParent(): void;
35876
35959
  remove(): void;
35960
+ hasFunctionOfCategory(category: SQLFunctionCategory): boolean;
35877
35961
  }
35878
35962
 
35879
35963
  declare enum WhereStatementOperator {