semanticdb-v2 2.0.0-alpha.5 → 2.0.0-alpha.6

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 (89) hide show
  1. package/README.md +164 -7
  2. package/dist/cache/redis-query-cache.esm.js +1 -1
  3. package/dist/cache/redis-query-cache.js +1 -1
  4. package/dist/cache/types.d.ts +2 -0
  5. package/dist/executor/connection-registry.d.ts +2 -2
  6. package/dist/executor/execute-query.d.ts +6 -1
  7. package/dist/executor/federated-execution.d.ts +37 -0
  8. package/dist/executor/fetch-entities.d.ts +3 -1
  9. package/dist/executor/result-hydrator/types.d.ts +2 -0
  10. package/dist/executor/total.d.ts +11 -0
  11. package/dist/executor/types.d.ts +33 -4
  12. package/dist/index.d.ts +8 -7
  13. package/dist/logicform-types.d.ts +44 -12
  14. package/dist/normalizer/pred-expression.d.ts +6 -0
  15. package/dist/operators/builtins/query-expression.d.ts +3 -0
  16. package/dist/operators/index.d.ts +1 -1
  17. package/dist/operators/types.d.ts +39 -8
  18. package/dist/physical/clickhouse-provider.d.ts +6 -2
  19. package/dist/physical/connection.d.ts +57 -15
  20. package/dist/physical/dameng-provider.d.ts +61 -0
  21. package/dist/physical/databricks-provider.d.ts +83 -0
  22. package/dist/physical/display-query.d.ts +3 -0
  23. package/dist/physical/doris-provider.d.ts +2 -1
  24. package/dist/physical/duckdb-coordinator-provider.d.ts +37 -0
  25. package/dist/physical/gbase-provider.d.ts +11 -0
  26. package/dist/physical/index.d.ts +21 -9
  27. package/dist/physical/load-driver.d.ts +1 -0
  28. package/dist/physical/maxcompute-provider.d.ts +37 -0
  29. package/dist/physical/mysql-protocol-provider.d.ts +21 -6
  30. package/dist/physical/mysql-provider.d.ts +2 -1
  31. package/dist/physical/oracle-provider.d.ts +15 -4
  32. package/dist/physical/postgresql-provider.d.ts +18 -4
  33. package/dist/physical/provider.d.ts +12 -1
  34. package/dist/physical/snowflake-provider.d.ts +15 -3
  35. package/dist/physical/sqlserver-provider.d.ts +65 -0
  36. package/dist/physical/starrocks-provider.d.ts +2 -1
  37. package/dist/planner/build-lineage.d.ts +1 -1
  38. package/dist/planner/create-logical-plan.d.ts +7 -0
  39. package/dist/planner/index.d.ts +4 -2
  40. package/dist/planner/mapping-granularity.d.ts +7 -0
  41. package/dist/planner/rewrite-nested-components.d.ts +8 -0
  42. package/dist/planner/select-schema-mapping.d.ts +16 -2
  43. package/dist/planner/semantics/index.d.ts +0 -4
  44. package/dist/planner/semantics/periods.d.ts +13 -0
  45. package/dist/planner/semantics/registry-defaults.d.ts +2 -1
  46. package/dist/planner/types.d.ts +71 -34
  47. package/dist/plugins/hierarchy/index.d.ts +1 -1
  48. package/dist/plugins/hierarchy/mapping-granularity.d.ts +4 -0
  49. package/dist/plugins/hierarchy/types.d.ts +17 -0
  50. package/dist/plugins/index.d.ts +10 -1
  51. package/dist/{planner/semantics → plugins}/observation/classification.d.ts +1 -1
  52. package/dist/plugins/observation/index.d.ts +17 -0
  53. package/dist/{planner/semantics → plugins}/observation/operator-policy.d.ts +2 -3
  54. package/dist/{planner/semantics → plugins}/observation/periods.d.ts +2 -3
  55. package/dist/{planner/semantics → plugins}/observation/rule.d.ts +1 -1
  56. package/dist/{planner/semantics → plugins}/observation/types.d.ts +1 -1
  57. package/dist/plugins/property-hierarchy/index.d.ts +11 -0
  58. package/dist/plugins/recursive/index.d.ts +26 -0
  59. package/dist/plugins/temporal/index.d.ts +13 -0
  60. package/dist/plugins/types.d.ts +165 -1
  61. package/dist/plugins/validity/classification.d.ts +5 -0
  62. package/dist/{planner/semantics → plugins}/validity/index.d.ts +9 -0
  63. package/dist/{planner/semantics → plugins}/validity/periods.d.ts +2 -3
  64. package/dist/{planner/semantics → plugins}/validity/query-policy.d.ts +1 -2
  65. package/dist/{planner/semantics → plugins}/validity/rule.d.ts +1 -1
  66. package/dist/plugins/validity/semantic-types.d.ts +3 -0
  67. package/dist/schema-mappings/freshness.d.ts +1 -1
  68. package/dist/schema-mappings/granularity.d.ts +5 -0
  69. package/dist/schema-mappings/index.d.ts +2 -1
  70. package/dist/schema-mappings/registry.d.ts +5 -3
  71. package/dist/schema-mappings/types.d.ts +43 -0
  72. package/dist/schema-mappings/yiask.d.ts +6 -2
  73. package/dist/semantic-types/index.d.ts +5 -3
  74. package/dist/semantic-types/registry.d.ts +2 -0
  75. package/dist/semantic-types/resolve-schema.d.ts +1 -1
  76. package/dist/semantic-types/types.d.ts +0 -14
  77. package/dist/semantic-types/validate-resolved-schema.d.ts +2 -5
  78. package/dist/semanticdb.esm.js +4 -3
  79. package/dist/semanticdb.js +4 -3
  80. package/package.json +46 -5
  81. package/dist/planner/semantics/annual-periods.d.ts +0 -11
  82. package/dist/planner/semantics/lifecycle/classification.d.ts +0 -5
  83. package/dist/planner/semantics/lifecycle/index.d.ts +0 -3
  84. package/dist/planner/semantics/lifecycle/query-policy.d.ts +0 -2
  85. package/dist/planner/semantics/lifecycle/rule.d.ts +0 -2
  86. package/dist/planner/semantics/observation/index.d.ts +0 -6
  87. package/dist/planner/semantics/validity/classification.d.ts +0 -14
  88. package/dist/semantic-types/builtins/end-date.d.ts +0 -2
  89. package/dist/semantic-types/builtins/start-date.d.ts +0 -2
@@ -1,5 +1,4 @@
1
- import type { PoolAttributes } from 'oracledb';
2
- import type { CoreComputeProvider, DataRow, ProviderExecutionRequest } from './provider';
1
+ import type { CoreComputeProvider, DatePart, DataRow, ProviderExecutionRequest } from './provider';
3
2
  type OracleBind = string | number | boolean | Date | Buffer | null;
4
3
  export interface OracleConnectionLike {
5
4
  execute(sql: string, binds: OracleBind[], options: {
@@ -14,12 +13,22 @@ export interface OraclePoolLike {
14
13
  getConnection(): Promise<OracleConnectionLike>;
15
14
  close(drainTime?: number): Promise<void>;
16
15
  }
16
+ export interface OracleConnectionOptions {
17
+ readonly user?: string;
18
+ readonly password?: string;
19
+ readonly connectString?: string;
20
+ readonly poolMin?: number;
21
+ readonly poolMax?: number;
22
+ readonly poolIncrement?: number;
23
+ readonly poolTimeout?: number;
24
+ readonly [option: string]: unknown;
25
+ }
17
26
  export interface OracleDriverLike {
18
- createPool(options: PoolAttributes): Promise<OraclePoolLike>;
27
+ createPool(options: OracleConnectionOptions): Promise<OraclePoolLike>;
19
28
  }
20
29
  export interface OracleProviderOptions {
21
30
  /** Passed to oracledb.createPool(). Thin mode is used unless the caller initialized Thick mode. */
22
- readonly connection?: PoolAttributes;
31
+ readonly connection?: object;
23
32
  /** Injectable pool for applications that own pool creation or for tests. */
24
33
  readonly pool?: OraclePoolLike;
25
34
  /** Injectable driver factory used to test lazy pool creation. */
@@ -37,11 +46,13 @@ export declare class OracleProvider implements CoreComputeProvider {
37
46
  parameter(index: number, value: unknown): string;
38
47
  displayQuery(sql: string, parameters: readonly unknown[]): string;
39
48
  dateBucket(expression: string, level: string): string;
49
+ datePart(expression: string, part: DatePart): string;
40
50
  dateShift(expression: string, granularity: string, offset: number): string;
41
51
  aggregateFunction(name: string, expression?: string): string;
42
52
  stringify(expression: string): string;
43
53
  concat(expressions: readonly string[]): string;
44
54
  substring(expression: string, start: number, length: number): string;
55
+ stringLength(expression: string): string;
45
56
  regex(expression: string, pattern: string, options?: string): string;
46
57
  arrayContains(arrayExpression: string, valueExpression: string): string;
47
58
  expandArray(arrayExpression: string, alias: string, column: string): {
@@ -1,20 +1,32 @@
1
- import type { PoolConfig } from 'pg';
2
- import type { CoreComputeProvider, DataRow, ProviderExecutionRequest } from './provider';
1
+ import type { CoreComputeProvider, DatePart, DataRow, ProviderExecutionRequest } from './provider';
3
2
  export interface PostgreSQLPoolLike {
4
3
  query(sql: string, values: unknown[]): Promise<{
5
4
  readonly rows: unknown;
6
5
  }>;
7
6
  end(): Promise<void>;
8
7
  }
8
+ export interface PostgreSQLConnectionOptions {
9
+ readonly connectionString?: string;
10
+ readonly host?: string;
11
+ readonly port?: number;
12
+ readonly user?: string;
13
+ readonly password?: string;
14
+ readonly database?: string;
15
+ readonly ssl?: unknown;
16
+ readonly max?: number;
17
+ readonly idleTimeoutMillis?: number;
18
+ readonly connectionTimeoutMillis?: number;
19
+ readonly [option: string]: unknown;
20
+ }
9
21
  export interface PostgreSQLProviderOptions {
10
- readonly connection?: PoolConfig;
22
+ readonly connection?: object;
11
23
  readonly pool?: PostgreSQLPoolLike;
12
24
  }
13
25
  export declare class PostgreSQLProvider implements CoreComputeProvider {
26
+ #private;
14
27
  readonly kind: "postgresql";
15
28
  readonly supportsHavingAlias = false;
16
29
  readonly supportsRecursiveCte = true;
17
- private readonly pool;
18
30
  constructor(options?: PostgreSQLProviderOptions);
19
31
  quoteIdentifier(identifier: string): string;
20
32
  tableAlias(expression: string, alias: string): string;
@@ -22,11 +34,13 @@ export declare class PostgreSQLProvider implements CoreComputeProvider {
22
34
  parameter(index: number, value: unknown): string;
23
35
  displayQuery(sql: string, parameters: readonly unknown[]): string;
24
36
  dateBucket(expression: string, level: string): string;
37
+ datePart(expression: string, part: DatePart): string;
25
38
  dateShift(expression: string, granularity: string, offset: number): string;
26
39
  aggregateFunction(name: string, expression?: string): string;
27
40
  stringify(expression: string): string;
28
41
  concat(expressions: readonly string[]): string;
29
42
  substring(expression: string, start: number, length: number): string;
43
+ stringLength(expression: string): string;
30
44
  regex(expression: string, pattern: string, options?: string): string;
31
45
  arrayContains(arrayExpression: string, valueExpression: string): string;
32
46
  expandArray(arrayExpression: string, alias: string, column: string): {
@@ -1,5 +1,10 @@
1
1
  export type DataRow = Record<string, unknown>;
2
2
  export type SqlParameters = readonly unknown[];
3
+ export type DatePart = 'second' | 'minute' | 'hour' | 'weekday' | 'day' | 'week' | 'month' | 'quarter' | 'year';
4
+ /** Module-augmentation seam for application-owned Provider kinds. */
5
+ export interface ProviderKindExtensions {
6
+ }
7
+ export type ProviderKind = 'clickhouse' | 'databricks' | 'dameng' | 'doris' | 'duckdb' | 'gbase' | 'maxcompute' | 'mysql' | 'oracle' | 'postgresql' | 'snowflake' | 'sqlserver' | 'starrocks' | Extract<keyof ProviderKindExtensions, string>;
3
8
  export interface ProviderExecutionRequest {
4
9
  readonly sql: string;
5
10
  readonly parameters: SqlParameters;
@@ -12,6 +17,8 @@ export interface SqlRenderCapabilities {
12
17
  tableAlias(expression: string, alias: string): string;
13
18
  paginate(sql: string, pageSize: number, offset: number): string;
14
19
  dateBucket(expression: string, level: string): string;
20
+ /** Extract a numeric date component. weekday uses Monday=1 through Sunday=7. */
21
+ datePart(expression: string, part: DatePart): string;
15
22
  dateShift(expression: string, granularity: string, offset: number): string;
16
23
  datePeriodBoundary?(expression: string, granularity: string, boundary: 'start' | 'end'): string;
17
24
  /** Cast a bound literal to the semantic type required by the SQL expression. */
@@ -22,9 +29,13 @@ export interface SqlRenderCapabilities {
22
29
  stringify(expression: string): string;
23
30
  concat(expressions: readonly string[]): string;
24
31
  substring(expression: string, start: number, length: number): string;
32
+ /** Return the number of characters in a string expression. */
33
+ stringLength(expression: string): string;
25
34
  regex(expression: string, pattern: string, options?: string): string;
26
35
  /** Whether the dialect supports a WITH RECURSIVE subquery. */
27
36
  readonly supportsRecursiveCte?: boolean;
37
+ /** Recursive-term set operator. Defaults to UNION when omitted. */
38
+ readonly recursiveCteUnion?: 'UNION' | 'UNION ALL';
28
39
  arrayContains?(arrayExpression: string, valueExpression: string): string;
29
40
  expandArray?(arrayExpression: string, alias: string, column: string): {
30
41
  readonly joinSql: string;
@@ -35,7 +46,7 @@ export interface SqlRenderCapabilities {
35
46
  * Internal physical database contract used by the compiler and executor.
36
47
  */
37
48
  export interface CoreComputeProvider extends SqlRenderCapabilities {
38
- readonly kind: 'clickhouse' | 'doris' | 'mysql' | 'oracle' | 'postgresql' | 'snowflake' | 'starrocks';
49
+ readonly kind: ProviderKind;
39
50
  /** Maximum items accepted by one SQL IN expression, when the dialect has a limit. */
40
51
  readonly maxInListItems?: number;
41
52
  parameter(index: number, value: unknown): string;
@@ -1,5 +1,4 @@
1
- import type { ConnectionOptions } from 'snowflake-sdk';
2
- import type { CoreComputeProvider, DataRow, ProviderExecutionRequest } from './provider';
1
+ import type { CoreComputeProvider, DatePart, DataRow, ProviderExecutionRequest } from './provider';
3
2
  type SnowflakeBind = string | number | boolean | null;
4
3
  export interface SnowflakeStatementLike {
5
4
  cancel(callback?: (error?: Error) => void): void;
@@ -13,9 +12,20 @@ export interface SnowflakeConnectionLike {
13
12
  }): SnowflakeStatementLike;
14
13
  destroy(callback: (error?: Error) => void): unknown;
15
14
  }
15
+ export interface SnowflakeConnectionOptions {
16
+ readonly account?: string;
17
+ readonly username?: string;
18
+ readonly password?: string;
19
+ readonly warehouse?: string;
20
+ readonly database?: string;
21
+ readonly schema?: string;
22
+ readonly role?: string;
23
+ readonly authenticator?: string;
24
+ readonly [option: string]: unknown;
25
+ }
16
26
  export interface SnowflakeProviderOptions {
17
27
  /** Options passed to snowflake-sdk's createConnection(). */
18
- readonly connection?: ConnectionOptions;
28
+ readonly connection?: object;
19
29
  /** Injectable SDK connection used by tests or caller-managed connection factories. */
20
30
  readonly client?: SnowflakeConnectionLike;
21
31
  }
@@ -29,11 +39,13 @@ export declare class SnowflakeProvider implements CoreComputeProvider {
29
39
  parameter(index: number, value: unknown): string;
30
40
  displayQuery(sql: string, parameters: readonly unknown[]): string;
31
41
  dateBucket(expression: string, level: string): string;
42
+ datePart(expression: string, part: DatePart): string;
32
43
  dateShift(expression: string, granularity: string, offset: number): string;
33
44
  aggregateFunction(name: string, expression?: string): string;
34
45
  stringify(expression: string): string;
35
46
  concat(expressions: readonly string[]): string;
36
47
  substring(expression: string, start: number, length: number): string;
48
+ stringLength(expression: string): string;
37
49
  regex(expression: string, pattern: string, options?: string): string;
38
50
  arrayContains(arrayExpression: string, valueExpression: string): string;
39
51
  expandArray(arrayExpression: string, alias: string, column: string): {
@@ -0,0 +1,65 @@
1
+ import type { CoreComputeProvider, DataRow, DatePart, ProviderExecutionRequest } from './provider';
2
+ type SQLServerBind = string | number | boolean | Date | Buffer | null;
3
+ export interface SQLServerRequestLike {
4
+ input(name: string, value: SQLServerBind): this;
5
+ query(sql: string): Promise<{
6
+ readonly recordset?: unknown;
7
+ }>;
8
+ cancel(): void;
9
+ }
10
+ export interface SQLServerPoolLike {
11
+ connect(): Promise<unknown>;
12
+ request(): SQLServerRequestLike;
13
+ close(): Promise<void>;
14
+ }
15
+ export interface SQLServerDriverLike {
16
+ readonly ConnectionPool: new (options: object) => SQLServerPoolLike;
17
+ }
18
+ export interface SQLServerConnectionOptions {
19
+ readonly host?: string;
20
+ readonly server?: string;
21
+ readonly port?: number;
22
+ readonly user?: string;
23
+ readonly password?: string;
24
+ readonly database?: string;
25
+ readonly options?: Readonly<Record<string, unknown>>;
26
+ readonly pool?: Readonly<Record<string, unknown>>;
27
+ readonly requestTimeout?: number;
28
+ readonly connectionTimeout?: number;
29
+ readonly [option: string]: unknown;
30
+ }
31
+ export interface SQLServerProviderOptions {
32
+ readonly connection?: SQLServerConnectionOptions;
33
+ readonly pool?: SQLServerPoolLike;
34
+ readonly driver?: SQLServerDriverLike;
35
+ }
36
+ export declare const sqlServerPoolOptions: (connection: SQLServerConnectionOptions) => object;
37
+ export declare class SQLServerProvider implements CoreComputeProvider {
38
+ #private;
39
+ readonly kind: "sqlserver";
40
+ readonly supportsHavingAlias = false;
41
+ constructor(options?: SQLServerProviderOptions);
42
+ quoteIdentifier(identifier: string): string;
43
+ tableAlias(expression: string, alias: string): string;
44
+ paginate(sql: string, pageSize: number, offset: number): string;
45
+ parameter(index: number, value: unknown): string;
46
+ displayQuery(sql: string, parameters: readonly unknown[]): string;
47
+ dateBucket(expression: string, level: string): string;
48
+ datePart(expression: string, part: DatePart): string;
49
+ dateShift(expression: string, granularity: string, offset: number): string;
50
+ castValue(expression: string, type: string): string;
51
+ aggregateFunction(name: string, expression?: string): string;
52
+ stringify(expression: string): string;
53
+ concat(expressions: readonly string[]): string;
54
+ substring(expression: string, start: number, length: number): string;
55
+ stringLength(expression: string): string;
56
+ regex(expression: string, pattern: string, options?: string): string;
57
+ arrayContains(arrayExpression: string, valueExpression: string): string;
58
+ expandArray(arrayExpression: string, alias: string, column: string): {
59
+ readonly joinSql: string;
60
+ readonly valueExpression: string;
61
+ };
62
+ execute(execution: ProviderExecutionRequest): Promise<DataRow[]>;
63
+ close(): Promise<void>;
64
+ }
65
+ export {};
@@ -1,6 +1,7 @@
1
1
  import { MySQLProtocolProvider } from './mysql-protocol-provider';
2
- import type { MySQLProtocolPoolLike, MySQLProtocolProviderOptions } from './mysql-protocol-provider';
2
+ import type { MySQLProtocolPoolLike, MySQLProtocolConnectionOptions, MySQLProtocolProviderOptions } from './mysql-protocol-provider';
3
3
  export type StarRocksPoolLike = MySQLProtocolPoolLike;
4
+ export type StarRocksConnectionOptions = MySQLProtocolConnectionOptions;
4
5
  export type StarRocksProviderOptions = MySQLProtocolProviderOptions;
5
6
  /** StarRocks adapter using its MySQL-compatible protocol and SQL surface. */
6
7
  export declare class StarRocksProvider extends MySQLProtocolProvider {
@@ -2,4 +2,4 @@ import type { OperatorRegistry } from '../operators/index';
2
2
  import type { CoreComputeProvider } from '../physical/index';
3
3
  import type { ResolvedSemanticSchema } from '../semantic-types/index';
4
4
  import type { LogicalPlan, QueryLineage } from './types';
5
- export declare const buildLineage: (plan: LogicalPlan, schema: ResolvedSemanticSchema, provider: CoreComputeProvider, operators?: OperatorRegistry) => QueryLineage;
5
+ export declare const buildLineage: (plan: LogicalPlan, schema: ResolvedSemanticSchema, provider: CoreComputeProvider, operators?: OperatorRegistry, providerForConnection?: (connectionId: string) => CoreComputeProvider) => QueryLineage;
@@ -1,6 +1,8 @@
1
1
  import type { LogicformType } from '../logicform-types';
2
2
  import type { OperatorRegistry } from '../operators/index';
3
3
  import { SchemaMappingRegistry } from '../schema-mappings/index';
4
+ import type { SchemaMappingSelection } from '../schema-mappings/index';
5
+ import type { SemanticDBPlugin } from '../plugins/index';
4
6
  import type { ResolvedSemanticSchema } from '../semantic-types/index';
5
7
  import type { ResolvedSemanticProperty } from '../semantic-types/index';
6
8
  import { type PlannerSemanticRegistry } from './semantics/index';
@@ -8,8 +10,13 @@ import type { LogicalPlan } from './types';
8
10
  export declare const createResultSchema: (plan: LogicalPlan, sourceSchema: ResolvedSemanticSchema) => ResolvedSemanticSchema;
9
11
  export declare const createDerivedSourceSchema: (sourcePlan: LogicalPlan, outerSchema: ResolvedSemanticSchema) => ResolvedSemanticSchema;
10
12
  export interface CreateLogicalPlanOptions {
13
+ readonly plugins?: readonly SemanticDBPlugin[];
11
14
  readonly resolveSchema?: (schemaId: string) => ResolvedSemanticSchema;
15
+ /** Prefer physical mappings colocated with the execution's main connection. */
16
+ readonly preferredConnectionId?: string;
12
17
  readonly canUsePropertyRowIdentity?: (schema: ResolvedSemanticSchema, property: ResolvedSemanticProperty) => boolean;
13
18
  readonly semanticRegistry?: PlannerSemanticRegistry;
19
+ /** Observe each physical Schema mapping decision made during planning. */
20
+ readonly onSchemaMappingSelection?: (selection: SchemaMappingSelection) => void;
14
21
  }
15
22
  export declare const createLogicalPlan: (logicform: LogicformType, schema: ResolvedSemanticSchema, operators?: OperatorRegistry, schemaMappings?: SchemaMappingRegistry, options?: CreateLogicalPlanOptions) => LogicalPlan;
@@ -1,7 +1,9 @@
1
1
  export { buildLineage } from './build-lineage';
2
2
  export { createDerivedSourceSchema, createLogicalPlan, createResultSchema } from './create-logical-plan';
3
3
  export type { CreateLogicalPlanOptions } from './create-logical-plan';
4
- export type { Expression, ArrayExpansionPlan, FieldReferencePlan, GroupLimitPlan, JoinPlan, LogicalQuerySubquery, LogicalRecursiveQuery, LogicalOrdinalQuery, LineageColumnSource, LineageOutput, LogicalPlan, OrderPlan, ObservationPeriodPlan, PaginationPlan, ProjectionPlan, QueryLineage, RowIdentityPlan, ValidityPeriodPlan, } from './types';
5
- export { isLogicalQuerySubquery, isLogicalRecursiveQuery } from './types';
4
+ export type { Expression, ArrayExpansionPlan, EnrichmentJoinPlan, FieldReferencePlan, GroupLimitPlan, JoinPlan, LogicalQuerySubquery, LogicalQueryOperator, LogicalOrdinalQuery, LogicalExpressionQuery, LineageColumnSource, LineageOutput, LogicalPlan, OrderPlan, PaginationPlan, ProjectionPlan, QueryLineage, RowIdentityPlan, PeriodSourcePlan, TemporalJoinConditionPlan, } from './types';
5
+ export { isLogicalQuerySubquery, isLogicalQueryOperator } from './types';
6
6
  export { isLogicalOrdinalQuery } from './types';
7
+ export { isLogicalExpressionQuery } from './types';
7
8
  export * from './semantics/index';
9
+ export { createPlannerSemanticRegistry } from './semantics/registry-defaults';
@@ -0,0 +1,7 @@
1
+ import type { LogicformType } from '../logicform-types';
2
+ import type { SemanticDBPlugin } from '../plugins/index';
3
+ import { type OperatorRegistry } from '../operators/index';
4
+ import { type SchemaMappingDefinition } from '../schema-mappings/index';
5
+ import type { ResolvedSemanticSchema } from '../semantic-types/index';
6
+ /** Checks grouped-source Property coverage and delegates plugin-owned physical grains. */
7
+ export declare const mappingGranularityReason: (logicform: LogicformType, schema: ResolvedSemanticSchema, mapping: SchemaMappingDefinition, resolveSchema?: (schemaId: string) => ResolvedSemanticSchema, plugins?: readonly SemanticDBPlugin[], operators?: OperatorRegistry) => string | undefined;
@@ -0,0 +1,8 @@
1
+ import type { LogicformType } from '../logicform-types';
2
+ import type { OperatorRegistry } from '../operators/index';
3
+ /**
4
+ * Lift component inputs into a derived LogicForm so ordinary expression operators can consume
5
+ * their result columns. The inner LogicForm owns source-grain work; the outer LogicForm owns
6
+ * result operations and the expression path above every component.
7
+ */
8
+ export declare const rewriteNestedComponents: (logicform: LogicformType, operators: OperatorRegistry) => LogicformType | undefined;
@@ -1,6 +1,8 @@
1
1
  import type { LogicformType } from '../logicform-types';
2
- import type { SchemaMappingDefinition, SchemaMappingRegistry } from '../schema-mappings/index';
2
+ import type { SemanticDBPlugin } from '../plugins/index';
3
+ import type { SchemaMappingDefinition, SchemaMappingRegistry, SchemaMappingSelection } from '../schema-mappings/index';
3
4
  import type { ResolvedSemanticSchema } from '../semantic-types/index';
5
+ import { type OperatorRegistry } from '../operators/index';
4
6
  export interface PredMappingRewrite {
5
7
  readonly predIndex: number;
6
8
  readonly column: string;
@@ -9,6 +11,18 @@ export interface SelectedSchemaMapping {
9
11
  readonly mapping: SchemaMappingDefinition;
10
12
  readonly logicform: LogicformType;
11
13
  readonly predRewrites: readonly PredMappingRewrite[];
14
+ readonly selection: SchemaMappingSelection;
15
+ }
16
+ export interface MappedPropertySource {
17
+ readonly column: string;
18
+ readonly sourceRef?: string;
12
19
  }
13
20
  export declare const mappedPropertyColumn: (mapping: SchemaMappingDefinition, schema: ResolvedSemanticSchema, reference: string) => string | undefined;
14
- export declare const selectSchemaMapping: (logicform: LogicformType, schema: ResolvedSemanticSchema, mappings: SchemaMappingRegistry) => SelectedSchemaMapping;
21
+ export declare const mappedPropertySource: (mapping: SchemaMappingDefinition, schema: ResolvedSemanticSchema, reference: string) => MappedPropertySource | undefined;
22
+ export declare const selectSchemaMapping: (logicform: LogicformType, schema: ResolvedSemanticSchema, mappings: SchemaMappingRegistry, options?: {
23
+ readonly preferredConnectionId?: string;
24
+ readonly resolveSchema?: (schemaId: string) => ResolvedSemanticSchema;
25
+ /** Extra plugins used by this execution; must also be supplied when registering plugin grains. */
26
+ readonly plugins?: readonly SemanticDBPlugin[];
27
+ readonly operators?: OperatorRegistry;
28
+ }) => SelectedSchemaMapping;
@@ -1,6 +1,2 @@
1
- export * from './observation/index';
2
- export * from './validity/index';
3
- export * from './lifecycle/index';
4
1
  export { PlannerSemanticRegistry } from './registry';
5
2
  export type { PlannerSemanticResolution, PlannerSemanticQueryContext, PlannerSemanticRule, PlannerSemanticRuleContext, } from './registry';
6
- export { createPlannerSemanticRegistry } from './registry-defaults';
@@ -0,0 +1,13 @@
1
+ import type { TimeGranularity } from '../../semantic-types/index';
2
+ export interface Period {
3
+ readonly label: string;
4
+ readonly start: string;
5
+ readonly end: string;
6
+ }
7
+ export interface PeriodErrorContext {
8
+ readonly codePrefix: string;
9
+ readonly label: string;
10
+ }
11
+ export declare const isTimeGranularity: (value: unknown) => value is TimeGranularity;
12
+ /** Expand one bounded time condition into natural boundaries at the requested granularity. */
13
+ export declare const resolvePeriods: (condition: unknown, granularity: TimeGranularity, context: PeriodErrorContext) => readonly Period[];
@@ -1,2 +1,3 @@
1
1
  import { PlannerSemanticRegistry } from './registry';
2
- export declare const createPlannerSemanticRegistry: () => PlannerSemanticRegistry;
2
+ import type { SemanticDBPlugin } from '../../plugins/index';
3
+ export declare const createPlannerSemanticRegistry: (plugins?: readonly SemanticDBPlugin[]) => PlannerSemanticRegistry;
@@ -2,6 +2,7 @@ import type { CoreComputeProvider } from '../physical/index';
2
2
  import type { LogicformType } from '../logicform-types';
3
3
  import type { ResultProperty } from '../operators/index';
4
4
  import type { ComparableCategoryDefinition, TimeGranularity } from '../semantic-types/index';
5
+ import type { QueryOperatorDefinition } from '../plugins/index';
5
6
  export interface FieldReferencePlan {
6
7
  readonly schemaId: string;
7
8
  readonly property: string;
@@ -20,24 +21,33 @@ export interface LogicalQuerySubquery {
20
21
  readonly kind: 'logicform-subquery';
21
22
  readonly plan: LogicalPlan;
22
23
  }
23
- export interface LogicalRecursiveQuery {
24
- readonly kind: 'recursive-query';
25
- readonly schemaId: string;
26
- readonly source: string;
27
- readonly sourceSql?: string;
28
- readonly idColumn: string;
29
- readonly parentColumn: string;
30
- readonly roots: readonly unknown[];
31
- readonly includeSelf: boolean;
24
+ export interface LogicalQueryOperator {
25
+ readonly kind: 'query-operator';
26
+ readonly operator: string;
27
+ readonly value: unknown;
28
+ readonly sources?: readonly {
29
+ readonly schemaId: string;
30
+ readonly source: string;
31
+ readonly connectionId?: string;
32
+ }[];
33
+ /** Capability selected during planning; omitted only by manually constructed plans. */
34
+ readonly definition?: QueryOperatorDefinition;
32
35
  }
33
36
  export interface LogicalOrdinalQuery {
34
37
  readonly kind: 'ordinal-query';
35
38
  readonly comparable: ComparableCategoryDefinition;
36
39
  readonly condition: unknown;
37
40
  }
41
+ export interface LogicalExpressionQuery {
42
+ readonly kind: 'expression-query';
43
+ readonly expression: Expression;
44
+ readonly condition: unknown;
45
+ readonly properties: readonly string[];
46
+ }
38
47
  export declare const isLogicalQuerySubquery: (value: unknown) => value is LogicalQuerySubquery;
39
- export declare const isLogicalRecursiveQuery: (value: unknown) => value is LogicalRecursiveQuery;
48
+ export declare const isLogicalQueryOperator: (value: unknown) => value is LogicalQueryOperator;
40
49
  export declare const isLogicalOrdinalQuery: (value: unknown) => value is LogicalOrdinalQuery;
50
+ export declare const isLogicalExpressionQuery: (value: unknown) => value is LogicalExpressionQuery;
41
51
  export type Expression = {
42
52
  readonly kind: 'array-element';
43
53
  readonly schemaId: string;
@@ -111,20 +121,45 @@ export interface JoinPlan {
111
121
  readonly sourceColumn: string;
112
122
  readonly sourceSql?: string;
113
123
  readonly sourceTimestampColumn?: string;
114
- readonly sourceTimestampGranularity?: TimeGranularity;
115
124
  readonly targetSchemaId: string;
125
+ /** Physical connection selected for the target Schema mapping. */
126
+ readonly targetConnectionId?: string;
116
127
  readonly targetSource: string;
117
128
  readonly targetSourceSql?: string;
118
129
  readonly targetAlias: string;
119
130
  readonly targetColumn: string;
120
131
  readonly targetSql?: string;
121
132
  readonly targetTimestampColumn?: string;
122
- readonly targetTimestampGranularity?: TimeGranularity;
123
- /** Half-open validity interval columns on a versioned entity target. */
124
- readonly targetValidityStartColumn?: string;
125
- readonly targetValidityEndColumn?: string;
133
+ readonly temporalCondition?: TemporalJoinConditionPlan;
126
134
  readonly sourceArrayExpansionPath?: string;
127
135
  }
136
+ export type TemporalJoinConditionPlan = {
137
+ readonly kind: 'date-bucket-equal';
138
+ readonly sourceColumn: string;
139
+ readonly targetColumn: string;
140
+ readonly sourceGranularity: TimeGranularity;
141
+ readonly targetGranularity: TimeGranularity;
142
+ } | {
143
+ readonly kind: 'point-in-interval';
144
+ readonly pointSide: 'source' | 'target';
145
+ readonly pointColumn: string;
146
+ readonly intervalSide: 'source' | 'target';
147
+ readonly startColumn: string;
148
+ readonly endColumn: string;
149
+ };
150
+ export interface EnrichmentJoinPlan {
151
+ readonly kind: 'enrichment-left';
152
+ readonly id: string;
153
+ readonly source: string;
154
+ readonly sourceSql?: string;
155
+ readonly alias: string;
156
+ readonly baseAlias: string;
157
+ readonly keys: readonly {
158
+ readonly baseColumn: string;
159
+ readonly targetColumn: string;
160
+ }[];
161
+ readonly temporalCondition?: TemporalJoinConditionPlan;
162
+ }
128
163
  export interface ArrayExpansionPlan {
129
164
  readonly path: string;
130
165
  readonly sourceAlias: string;
@@ -147,29 +182,24 @@ export interface GroupLimitPlan {
147
182
  readonly partitionBy: readonly string[];
148
183
  readonly orderBy: readonly OrderPlan[];
149
184
  }
150
- export interface ValidityPeriodPlan {
151
- readonly alias: string;
152
- readonly labelColumn: string;
153
- readonly asOfColumn: string;
154
- readonly sourceAlias: string;
155
- readonly startColumn: string;
156
- readonly endColumn: string;
157
- readonly periods: readonly {
158
- readonly label: string;
159
- readonly asOf: string;
160
- }[];
161
- }
162
- export interface ObservationPeriodPlan {
185
+ export interface PeriodSourcePlan {
163
186
  readonly alias: string;
164
187
  readonly labelColumn: string;
165
188
  readonly asOfColumn: string;
166
189
  readonly sourceAlias: string;
167
- readonly lookupAlias: string;
168
- readonly timestampColumn: string;
169
190
  readonly periods: readonly {
170
191
  readonly label: string;
171
192
  readonly asOf: string;
172
193
  }[];
194
+ readonly match: {
195
+ readonly kind: 'interval';
196
+ readonly startColumn: string;
197
+ readonly endColumn: string;
198
+ } | {
199
+ readonly kind: 'latest';
200
+ readonly lookupAlias: string;
201
+ readonly timestampColumn: string;
202
+ };
173
203
  }
174
204
  export type RowIdentityPlan = {
175
205
  readonly kind: 'group';
@@ -188,6 +218,8 @@ export type RowIdentityPlan = {
188
218
  export interface LogicalPlan {
189
219
  readonly schemaId: string;
190
220
  readonly source: string;
221
+ /** Physical connection selected for this plan's source mapping. */
222
+ readonly connectionId?: string;
191
223
  /** Trusted derived-table SQL supplied by the selected physical mapping. */
192
224
  readonly sourceSql?: string;
193
225
  /** Physical mapping selected by the Planner for this logical Schema. */
@@ -202,11 +234,11 @@ export interface LogicalPlan {
202
234
  readonly fields: Readonly<Record<string, string>>;
203
235
  readonly fieldReferences?: Readonly<Record<string, FieldReferencePlan>>;
204
236
  readonly joins?: readonly JoinPlan[];
237
+ /** Physical extensions of this mapping, added only when a mapped property uses them. */
238
+ readonly enrichmentJoins?: readonly EnrichmentJoinPlan[];
205
239
  readonly arrayExpansions?: readonly ArrayExpansionPlan[];
206
- /** Period spine used to evaluate a valid-time entity once per requested period. */
207
- readonly validityPeriods?: ValidityPeriodPlan;
208
- /** Period spine used to select the latest snapshot at each requested boundary. */
209
- readonly observationPeriods?: ObservationPeriodPlan;
240
+ /** Generated period rows matched to a source by a plugin-selected generic strategy. */
241
+ readonly periodSource?: PeriodSourcePlan;
210
242
  readonly projections: readonly ProjectionPlan[];
211
243
  readonly columnProperties?: readonly ResultProperty[];
212
244
  readonly groupBy: readonly ProjectionPlan[];
@@ -235,6 +267,11 @@ export interface QueryLineage {
235
267
  readonly schemaName: string;
236
268
  readonly physicalTable: string;
237
269
  readonly provider: CoreComputeProvider['kind'];
270
+ readonly connectionId?: string;
271
+ readonly connections?: readonly {
272
+ readonly connectionId: string;
273
+ readonly provider: CoreComputeProvider['kind'];
274
+ }[];
238
275
  };
239
276
  readonly outputs: readonly LineageOutput[];
240
277
  readonly filters: readonly LineageColumnSource[];
@@ -1,3 +1,3 @@
1
1
  import type { SemanticDBPlugin } from '../types';
2
- export type { HierarchyDefinition, HierarchyLevelDefinition, ResolvedHierarchyDefinition, } from './types';
2
+ export type { HierarchyDefinition, HierarchyLevelDefinition, ResolvedHierarchyDefinition, SchemaMappingHierarchyGranularity, } from './types';
3
3
  export declare const hierarchyPlugin: SemanticDBPlugin;
@@ -0,0 +1,4 @@
1
+ import type { MappingGranularityPlugin } from '../types';
2
+ import type { SchemaMappingHierarchyGranularity } from './types';
3
+ export declare const isMappingHierarchyGranularity: (value: unknown) => value is SchemaMappingHierarchyGranularity;
4
+ export declare const hierarchyMappingGranularity: MappingGranularityPlugin;
@@ -1,3 +1,13 @@
1
+ export interface SchemaMappingHierarchyGranularity {
2
+ readonly kind: 'hierarchy';
3
+ /** Physical level name or synonym declared by the referenced hierarchy Schema. */
4
+ readonly level: string;
5
+ }
6
+ declare module '../../schema-mappings/types' {
7
+ interface SchemaMappingGranularityExtensions {
8
+ readonly hierarchy: SchemaMappingHierarchyGranularity;
9
+ }
10
+ }
1
11
  export interface HierarchyLevelDefinition {
2
12
  readonly name: string;
3
13
  readonly syno?: readonly string[];
@@ -17,6 +27,13 @@ export interface ResolvedHierarchyDefinition extends Omit<HierarchyDefinition, '
17
27
  readonly storage: 'compact' | 'zero-padded';
18
28
  }
19
29
  declare module '../../semantic-types/types' {
30
+ interface SemanticPropertyDraft {
31
+ /** Default hierarchy level for an Entity relation. */
32
+ readonly level?: string;
33
+ }
34
+ interface ResolvedSemanticProperty {
35
+ readonly level?: string;
36
+ }
20
37
  interface SemanticSchemaMetadata {
21
38
  readonly hierarchy?: HierarchyDefinition;
22
39
  }
@@ -1,5 +1,14 @@
1
1
  import type { SemanticDBPlugin } from './types';
2
- export type { LegacySchemaPluginContext, SchemaMetadataPlugin, SemanticDBPlugin } from './types';
2
+ import type { LogicformType } from '../logicform-types';
3
+ import type { ResolvedSemanticSchema } from '../semantic-types/index';
4
+ export type { LegacySchemaPluginContext, MappingGranularityContext, MappingGranularityPlugin, QueryOperatorAuthorizeContext, QueryOperatorCompileContext, QueryOperatorDefinition, QueryOperatorNormalizeContext, QueryOperatorPhysicalSource, QueryOperatorPlanContext, QueryOperatorPlanResult, PropertyMetadataPlugin, SchemaMetadataPlugin, SemanticDBPlugin, OutputHandlerContext, OutputHandlerDefinition, IntervalSemanticProperties, IntervalSemanticsDefinition, PlannerPeriodDefinition, PlannerPeriodEvaluation, RelationSemanticsDefinition, RelationTemporalPlan, TimeWatermarkLogicformContext, SchemaMappingPlugin, } from './types';
5
+ export type { SchemaMappingHierarchyGranularity } from './hierarchy/index';
6
+ export type { RecursiveQueryType } from './recursive/index';
3
7
  /** Built-in capabilities are composed here; feature implementations live in their own folders. */
4
8
  export declare const builtinPlugins: readonly SemanticDBPlugin[];
5
9
  export declare const resolvePlugins: (plugins?: readonly SemanticDBPlugin[]) => readonly SemanticDBPlugin[];
10
+ export declare const findQueryOperator: (name: string, plugins?: readonly SemanticDBPlugin[]) => import("./types").QueryOperatorDefinition | undefined;
11
+ export declare const findOutputHandler: (type: string, plugins?: readonly SemanticDBPlugin[]) => import("./types").OutputHandlerDefinition | undefined;
12
+ export declare const resolveIntervalSemanticProperties: (schema: ResolvedSemanticSchema, plugins?: readonly SemanticDBPlugin[]) => import("./types").IntervalSemanticProperties | undefined;
13
+ export declare const resolveRelationTemporalPlan: (sourceSchema: ResolvedSemanticSchema, targetSchema: ResolvedSemanticSchema, plugins?: readonly SemanticDBPlugin[]) => import("./types").RelationTemporalPlan | undefined;
14
+ export declare const resolvePlannerPeriodEvaluation: (logicform: LogicformType, schema: ResolvedSemanticSchema, plugins?: readonly SemanticDBPlugin[]) => import("./types").PlannerPeriodEvaluation | undefined;
@@ -1,3 +1,3 @@
1
- import type { ResolvedSemanticProperty, ResolvedSemanticSchema } from '../../../semantic-types/index';
1
+ import type { ResolvedSemanticProperty, ResolvedSemanticSchema } from '../../semantic-types/index';
2
2
  export declare const isObservationProperty: (property: ResolvedSemanticProperty | undefined, schema?: Pick<ResolvedSemanticSchema, "temporalSemantics">) => boolean;
3
3
  export declare const observationProperties: (schema: Pick<ResolvedSemanticSchema, "properties" | "temporalSemantics">) => readonly ResolvedSemanticProperty[];
@@ -0,0 +1,17 @@
1
+ import type { SemanticDBPlugin } from '../types';
2
+ type SchemaTemporalSemantics = 'normal' | 'snapshot';
3
+ export { isObservationProperty, observationProperties } from './classification';
4
+ export { resolveObservationOperatorPolicy, type ObservationOperatorPolicy, } from './operator-policy';
5
+ export { removeObservationTimeCondition, resolveObservationPeriodSpec, } from './periods';
6
+ export type { ObservationPeriodMetric, ObservationPeriodSpec } from './periods';
7
+ export { observationSemanticRule } from './rule';
8
+ export type { ObservationOperator, ObservationTemporalMetadata } from './types';
9
+ declare module '../../semantic-types/types' {
10
+ interface SemanticSchemaMetadata {
11
+ readonly temporalSemantics?: SchemaTemporalSemantics;
12
+ }
13
+ interface ResolvedSemanticSchemaMetadata {
14
+ readonly temporalSemantics?: SchemaTemporalSemantics;
15
+ }
16
+ }
17
+ export declare const observationPlugin: SemanticDBPlugin;