semanticdb-v2 2.0.0-alpha.1 → 2.0.0-alpha.10

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 (272) hide show
  1. package/README.md +346 -46
  2. package/dist/cache/index.d.ts +2 -1
  3. package/dist/cache/manager.d.ts +5 -0
  4. package/dist/cache/registry.d.ts +14 -0
  5. package/dist/cache/types.d.ts +17 -0
  6. package/dist/close.d.ts +1 -0
  7. package/dist/compatibility/index.d.ts +2 -2
  8. package/dist/compatibility/logicform.d.ts +1 -7
  9. package/dist/compiler/compile-cte.d.ts +17 -2
  10. package/dist/compiler/index.d.ts +2 -1
  11. package/dist/compiler/shorten-sql.d.ts +1 -1
  12. package/dist/errors.d.ts +3 -0
  13. package/dist/executor/compatibility.d.ts +13 -0
  14. package/dist/executor/components.d.ts +8 -3
  15. package/dist/executor/connection-registry.d.ts +1 -12
  16. package/dist/executor/execute-query.d.ts +8 -2
  17. package/dist/executor/federated-execution.d.ts +38 -0
  18. package/dist/executor/fetch-entities.d.ts +7 -1
  19. package/dist/executor/index.d.ts +1 -1
  20. package/dist/executor/result-hydrator/types.d.ts +2 -0
  21. package/dist/executor/row-identity.d.ts +2 -1
  22. package/dist/executor/total.d.ts +11 -0
  23. package/dist/executor/types.d.ts +64 -19
  24. package/dist/i18n/index.d.ts +4 -0
  25. package/dist/i18n/locales/en-US.d.ts +2 -0
  26. package/dist/i18n/locales/zh-CN.d.ts +2 -0
  27. package/dist/i18n/registry.d.ts +13 -0
  28. package/dist/i18n/types.d.ts +9 -0
  29. package/dist/index.d.ts +16 -16
  30. package/dist/logicform-types.d.ts +56 -36
  31. package/dist/normalizer/core.d.ts +16 -2
  32. package/dist/normalizer/default-pred-name.d.ts +2 -0
  33. package/dist/normalizer/index.d.ts +1 -0
  34. package/dist/normalizer/pred-expression.d.ts +6 -0
  35. package/dist/normalizer/property-resolve.d.ts +6 -0
  36. package/dist/operators/builtins/constant.d.ts +2 -0
  37. package/dist/operators/builtins/period-name.d.ts +2 -1
  38. package/dist/operators/builtins/period-value.d.ts +2 -0
  39. package/dist/operators/builtins/query-expression.d.ts +3 -0
  40. package/dist/operators/builtins/scalar-extremum.d.ts +3 -0
  41. package/dist/operators/index.d.ts +2 -1
  42. package/dist/operators/registry.d.ts +5 -3
  43. package/dist/operators/resolve.d.ts +3 -0
  44. package/dist/operators/types.d.ts +102 -49
  45. package/dist/physical/clickhouse-provider.d.ts +29 -2
  46. package/dist/physical/connection-registry.d.ts +13 -0
  47. package/dist/physical/connection.d.ts +57 -15
  48. package/dist/physical/dameng-provider.d.ts +66 -0
  49. package/dist/physical/databricks-provider.d.ts +88 -0
  50. package/dist/physical/db-connector.d.ts +23 -0
  51. package/dist/physical/display-query.d.ts +3 -0
  52. package/dist/physical/doris-provider.d.ts +7 -1
  53. package/dist/physical/duckdb-coordinator-provider.d.ts +37 -0
  54. package/dist/physical/gbase-provider.d.ts +11 -0
  55. package/dist/physical/index.d.ts +24 -9
  56. package/dist/physical/load-driver.d.ts +1 -0
  57. package/dist/physical/maxcompute-provider.d.ts +44 -0
  58. package/dist/physical/mysql-protocol-provider.d.ts +27 -7
  59. package/dist/physical/mysql-provider.d.ts +2 -1
  60. package/dist/physical/oracle-provider.d.ts +21 -4
  61. package/dist/physical/postgresql-provider.d.ts +25 -4
  62. package/dist/physical/provider.d.ts +66 -2
  63. package/dist/physical/snowflake-provider.d.ts +20 -3
  64. package/dist/physical/sqlserver-provider.d.ts +69 -0
  65. package/dist/physical/starrocks-provider.d.ts +7 -1
  66. package/dist/physical/table-description.d.ts +5 -0
  67. package/dist/physical/table-discovery.d.ts +10 -0
  68. package/dist/planner/build-lineage.d.ts +1 -1
  69. package/dist/planner/create-logical-plan.d.ts +7 -0
  70. package/dist/planner/index.d.ts +4 -2
  71. package/dist/planner/mapping-granularity.d.ts +7 -0
  72. package/dist/planner/rewrite-nested-components.d.ts +8 -0
  73. package/dist/planner/select-schema-mapping.d.ts +16 -2
  74. package/dist/planner/semantics/index.d.ts +0 -3
  75. package/dist/planner/semantics/periods.d.ts +13 -0
  76. package/dist/planner/semantics/registry-defaults.d.ts +2 -1
  77. package/dist/planner/semantics/registry.d.ts +2 -1
  78. package/dist/planner/types.d.ts +94 -14
  79. package/dist/plugins/hierarchy/index.d.ts +1 -1
  80. package/dist/plugins/hierarchy/mapping-granularity.d.ts +4 -0
  81. package/dist/plugins/hierarchy/types.d.ts +20 -2
  82. package/dist/plugins/index.d.ts +10 -1
  83. package/dist/{planner/semantics → plugins}/observation/classification.d.ts +1 -1
  84. package/dist/plugins/observation/index.d.ts +17 -0
  85. package/dist/{planner/semantics → plugins}/observation/operator-policy.d.ts +4 -5
  86. package/dist/plugins/observation/periods.d.ts +18 -0
  87. package/dist/{planner/semantics → plugins}/observation/rule.d.ts +1 -1
  88. package/dist/plugins/observation/types.d.ts +3 -0
  89. package/dist/plugins/property-hierarchy/index.d.ts +11 -0
  90. package/dist/plugins/recursive/index.d.ts +26 -0
  91. package/dist/plugins/temporal/index.d.ts +13 -0
  92. package/dist/plugins/types.d.ts +165 -1
  93. package/dist/plugins/validity/classification.d.ts +5 -0
  94. package/dist/plugins/validity/index.d.ts +15 -0
  95. package/dist/plugins/validity/periods.d.ts +15 -0
  96. package/dist/plugins/validity/query-policy.d.ts +3 -0
  97. package/dist/plugins/validity/rule.d.ts +2 -0
  98. package/dist/plugins/validity/semantic-types.d.ts +3 -0
  99. package/dist/schema/dependent-projection.d.ts +8 -0
  100. package/dist/schema/entity-identity.d.ts +1 -1
  101. package/dist/schema/index.d.ts +1 -0
  102. package/dist/schema-mappings/freshness.d.ts +1 -1
  103. package/dist/schema-mappings/granularity.d.ts +5 -0
  104. package/dist/schema-mappings/index.d.ts +4 -1
  105. package/dist/schema-mappings/registry.d.ts +6 -3
  106. package/dist/schema-mappings/types.d.ts +52 -8
  107. package/dist/schema-mappings/yiask.d.ts +26 -0
  108. package/dist/semantic-types/builtins/tag.d.ts +2 -0
  109. package/dist/semantic-types/index.d.ts +5 -3
  110. package/dist/semantic-types/registry.d.ts +2 -0
  111. package/dist/semantic-types/resolve-schema.d.ts +1 -1
  112. package/dist/semantic-types/types.d.ts +22 -10
  113. package/dist/semantic-types/validate-resolved-schema.d.ts +2 -5
  114. package/dist/semanticdb.esm.js +5 -0
  115. package/dist/semanticdb.js +5 -0
  116. package/package.json +49 -17
  117. package/dist/cache/expiry.js +0 -1
  118. package/dist/cache/identity.js +0 -1
  119. package/dist/cache/redis-query-cache.js +0 -1
  120. package/dist/cache/serialization.js +0 -1
  121. package/dist/calendar/constants.d.ts +0 -7
  122. package/dist/calendar/constants.js +0 -1
  123. package/dist/calendar/index.d.ts +0 -6
  124. package/dist/calendar/provider-relation-store.d.ts +0 -9
  125. package/dist/calendar/provider-relation-store.js +0 -1
  126. package/dist/calendar/resolver.d.ts +0 -10
  127. package/dist/calendar/resolver.js +0 -1
  128. package/dist/calendar/system-schemas.d.ts +0 -3
  129. package/dist/calendar/system-schemas.js +0 -1
  130. package/dist/calendar/types.d.ts +0 -31
  131. package/dist/compatibility/logicform.js +0 -1
  132. package/dist/compiler/compile-cte.js +0 -1
  133. package/dist/compiler/compile-plan.js +0 -1
  134. package/dist/compiler/shorten-sql.js +0 -2
  135. package/dist/custom-functions/custom-functions.d.ts +0 -6
  136. package/dist/custom-functions/custom-functions.js +0 -1
  137. package/dist/custom-functions/index.d.ts +0 -3
  138. package/dist/custom-functions/operator-adapter.d.ts +0 -12
  139. package/dist/custom-functions/operator-adapter.js +0 -1
  140. package/dist/custom-functions/types.d.ts +0 -62
  141. package/dist/errors.js +0 -1
  142. package/dist/executor/compatibility.js +0 -1
  143. package/dist/executor/components.js +0 -1
  144. package/dist/executor/connection-registry.js +0 -1
  145. package/dist/executor/evaluate.js +0 -1
  146. package/dist/executor/execute-query.js +0 -1
  147. package/dist/executor/execute.js +0 -1
  148. package/dist/executor/fetch-entities.js +0 -1
  149. package/dist/executor/result-hydrator/entity-loader.js +0 -1
  150. package/dist/executor/result-hydrator/format-values.js +0 -1
  151. package/dist/executor/result-hydrator/hydrate-result.js +0 -1
  152. package/dist/executor/result-hydrator/missing-entity.js +0 -1
  153. package/dist/executor/result-hydrator/populate-entities.js +0 -1
  154. package/dist/executor/row-identity.js +0 -1
  155. package/dist/index.js +0 -1
  156. package/dist/logicform-types.js +0 -1
  157. package/dist/normalizer/core.js +0 -1
  158. package/dist/normalizer/default-pred-name.js +0 -1
  159. package/dist/normalizer/entity-id.js +0 -1
  160. package/dist/normalizer/groupby.js +0 -1
  161. package/dist/normalizer/normalize-logicform.js +0 -1
  162. package/dist/normalizer/pagination.js +0 -1
  163. package/dist/normalizer/pred-query-name.js +0 -1
  164. package/dist/normalizer/preds.js +0 -1
  165. package/dist/normalizer/query.js +0 -1
  166. package/dist/normalizer/version.js +0 -1
  167. package/dist/operators/builtins/abs.js +0 -1
  168. package/dist/operators/builtins/accumulate.js +0 -1
  169. package/dist/operators/builtins/add.js +0 -1
  170. package/dist/operators/builtins/arithmetic.js +0 -1
  171. package/dist/operators/builtins/average-per-period.js +0 -1
  172. package/dist/operators/builtins/avg.js +0 -1
  173. package/dist/operators/builtins/case.js +0 -1
  174. package/dist/operators/builtins/concat.js +0 -1
  175. package/dist/operators/builtins/count-distinct.js +0 -1
  176. package/dist/operators/builtins/count.js +0 -1
  177. package/dist/operators/builtins/date-bucket.js +0 -1
  178. package/dist/operators/builtins/divide.js +0 -1
  179. package/dist/operators/builtins/index.js +0 -1
  180. package/dist/operators/builtins/max.js +0 -1
  181. package/dist/operators/builtins/min.js +0 -1
  182. package/dist/operators/builtins/multiply.js +0 -1
  183. package/dist/operators/builtins/newly.js +0 -1
  184. package/dist/operators/builtins/period-boundary.js +0 -1
  185. package/dist/operators/builtins/period-difference.js +0 -1
  186. package/dist/operators/builtins/period-growth.js +0 -1
  187. package/dist/operators/builtins/period-name.js +0 -1
  188. package/dist/operators/builtins/period-shift.js +0 -1
  189. package/dist/operators/builtins/rank.js +0 -1
  190. package/dist/operators/builtins/row-number.js +0 -1
  191. package/dist/operators/builtins/share-of-total.js +0 -1
  192. package/dist/operators/builtins/sql.js +0 -1
  193. package/dist/operators/builtins/substring.js +0 -1
  194. package/dist/operators/builtins/subtract.js +0 -1
  195. package/dist/operators/builtins/sum.js +0 -1
  196. package/dist/operators/builtins/time-range.js +0 -1
  197. package/dist/operators/groupby.js +0 -1
  198. package/dist/operators/index.js +0 -1
  199. package/dist/operators/registry.js +0 -1
  200. package/dist/operators/sql-expression.js +0 -1
  201. package/dist/permissions/permissions.js +0 -1
  202. package/dist/physical/clickhouse-provider.js +0 -1
  203. package/dist/physical/connection.js +0 -1
  204. package/dist/physical/display-query.js +0 -1
  205. package/dist/physical/doris-provider.js +0 -1
  206. package/dist/physical/mysql-compatible-sql.js +0 -1
  207. package/dist/physical/mysql-protocol-provider.js +0 -1
  208. package/dist/physical/mysql-provider.js +0 -1
  209. package/dist/physical/oracle-provider.js +0 -1
  210. package/dist/physical/postgresql-provider.js +0 -1
  211. package/dist/physical/snowflake-provider.js +0 -1
  212. package/dist/physical/starrocks-provider.js +0 -1
  213. package/dist/planner/build-lineage.js +0 -1
  214. package/dist/planner/create-logical-plan.js +0 -1
  215. package/dist/planner/select-schema-mapping.js +0 -1
  216. package/dist/planner/semantics/lifecycle/classification.d.ts +0 -7
  217. package/dist/planner/semantics/lifecycle/classification.js +0 -1
  218. package/dist/planner/semantics/lifecycle/index.d.ts +0 -3
  219. package/dist/planner/semantics/lifecycle/query-policy.d.ts +0 -3
  220. package/dist/planner/semantics/lifecycle/query-policy.js +0 -1
  221. package/dist/planner/semantics/lifecycle/rule.d.ts +0 -2
  222. package/dist/planner/semantics/lifecycle/rule.js +0 -1
  223. package/dist/planner/semantics/observation/classification.js +0 -1
  224. package/dist/planner/semantics/observation/index.d.ts +0 -4
  225. package/dist/planner/semantics/observation/operator-policy.js +0 -1
  226. package/dist/planner/semantics/observation/rule.js +0 -1
  227. package/dist/planner/semantics/observation/types.d.ts +0 -3
  228. package/dist/planner/semantics/registry-defaults.js +0 -1
  229. package/dist/planner/semantics/registry.js +0 -1
  230. package/dist/planner/types.js +0 -1
  231. package/dist/plugins/hierarchy/compatibility.js +0 -1
  232. package/dist/plugins/hierarchy/entity-identity.js +0 -1
  233. package/dist/plugins/hierarchy/index.js +0 -1
  234. package/dist/plugins/hierarchy/operator.js +0 -1
  235. package/dist/plugins/hierarchy/resolve-schema.js +0 -1
  236. package/dist/plugins/index.js +0 -1
  237. package/dist/schema/entity-identity.js +0 -1
  238. package/dist/schema/resolve-property-path.js +0 -1
  239. package/dist/schema/schema-registry.js +0 -1
  240. package/dist/schema-mappings/freshness.js +0 -1
  241. package/dist/schema-mappings/registry.js +0 -1
  242. package/dist/semantic-types/builtins/boolean.js +0 -1
  243. package/dist/semantic-types/builtins/category.js +0 -1
  244. package/dist/semantic-types/builtins/currency.js +0 -1
  245. package/dist/semantic-types/builtins/date.js +0 -1
  246. package/dist/semantic-types/builtins/duration.js +0 -1
  247. package/dist/semantic-types/builtins/end-date.d.ts +0 -2
  248. package/dist/semantic-types/builtins/end-date.js +0 -1
  249. package/dist/semantic-types/builtins/entity.js +0 -1
  250. package/dist/semantic-types/builtins/file.js +0 -1
  251. package/dist/semantic-types/builtins/human-name.js +0 -1
  252. package/dist/semantic-types/builtins/id.js +0 -1
  253. package/dist/semantic-types/builtins/image.js +0 -1
  254. package/dist/semantic-types/builtins/index.js +0 -1
  255. package/dist/semantic-types/builtins/int.js +0 -1
  256. package/dist/semantic-types/builtins/name.js +0 -1
  257. package/dist/semantic-types/builtins/number.js +0 -1
  258. package/dist/semantic-types/builtins/object.js +0 -1
  259. package/dist/semantic-types/builtins/order.js +0 -1
  260. package/dist/semantic-types/builtins/percentage.js +0 -1
  261. package/dist/semantic-types/builtins/start-date.d.ts +0 -2
  262. package/dist/semantic-types/builtins/start-date.js +0 -1
  263. package/dist/semantic-types/builtins/string.js +0 -1
  264. package/dist/semantic-types/builtins/timestamp.js +0 -1
  265. package/dist/semantic-types/index.js +0 -1
  266. package/dist/semantic-types/primal-types/date.js +0 -1
  267. package/dist/semantic-types/primal-types/index.js +0 -1
  268. package/dist/semantic-types/registry.js +0 -1
  269. package/dist/semantic-types/resolve-schema.js +0 -1
  270. package/dist/semantic-types/validate-resolved-schema.js +0 -1
  271. package/dist/utils/clone.js +0 -1
  272. /package/dist/operators/builtins/{period-boundary.d.ts → period-boundary-expression.d.ts} +0 -0
@@ -1,2 +1,2 @@
1
- /** Conservatively remove unused aliased columns from nested SELECT projections. */
1
+ /** Conservatively simplify nested SELECT projections and pass-through views. */
2
2
  export declare const shortenSQL: (sql: string) => string;
package/dist/errors.d.ts CHANGED
@@ -1,5 +1,8 @@
1
+ import { type LocaleRegistry } from './i18n/index';
1
2
  export declare class SemanticDBError extends Error {
2
3
  readonly code: string;
3
4
  readonly details?: Readonly<Record<string, unknown>> | undefined;
4
5
  constructor(code: string, message: string, details?: Readonly<Record<string, unknown>> | undefined);
6
+ /** Return the user-facing message for an execution locale. */
7
+ localizedMessage(locale?: string, locales?: LocaleRegistry): string;
5
8
  }
@@ -1,6 +1,19 @@
1
1
  import type { SemanticSchemaDraft } from '../semantic-types/index';
2
2
  import type { SemanticDBPlugin } from '../plugins/index';
3
+ import type { SchemaMappingDefinition } from '../schema-mappings/index';
3
4
  export { normalizeLegacyLogicform } from '../compatibility/logicform';
4
5
  /** Converts legacy Schema/Property identifiers without mutating caller data. */
5
6
  export declare const normalizeSchemas: (input: Readonly<Record<string, SemanticSchemaDraft>>, externalPlugins?: readonly SemanticDBPlugin[], legacy?: boolean) => Readonly<Record<string, SemanticSchemaDraft>>;
7
+ declare const legacyEmptySource: unique symbol;
8
+ type LegacyEmptyMapping = SchemaMappingDefinition & {
9
+ readonly [legacyEmptySource]: true;
10
+ };
11
+ export declare const isLegacyEmptyMapping: (mapping: SchemaMappingDefinition | undefined) => mapping is LegacyEmptyMapping;
12
+ /**
13
+ * Adds an execution-local mapping for legacy Schemas without an explicit v2
14
+ * mapping. `from` SQL wins over the Schema-id table fallback when `db` exists.
15
+ * Only a Schema without either `from` or `db` gets an empty mapping so the
16
+ * planner can still produce the result shape. Existing mappings always win.
17
+ */
18
+ export declare const normalizeLegacySchemaMappings: (schemas: Readonly<Record<string, SemanticSchemaDraft>>, mappings: readonly SchemaMappingDefinition[], defaultConnectionId?: string, requiredSchemaIds?: readonly string[], emptyConnectionIds?: readonly string[]) => readonly SchemaMappingDefinition[];
6
19
  export { normalizeLegacyLogicform as normalizeLogicform } from '../compatibility/logicform';
@@ -1,9 +1,14 @@
1
1
  import type { LogicformType } from '../logicform-types';
2
- import type { OperatorExecutionComponent, OperatorRegistry } from '../operators/index';
2
+ import type { OperatorComponentCalculation, OperatorJavaScriptCalculation, OperatorQueryComponent, OperatorRegistry } from '../operators/index';
3
3
  import type { DataRow } from '../physical/index';
4
4
  import type { LogicalPlan } from '../planner/index';
5
5
  import type { ResolvedSemanticSchema } from '../semantic-types/index';
6
- export type ExecutionUnit = OperatorExecutionComponent;
7
- export declare const createExecutionUnits: (logicform: LogicformType, plan: LogicalPlan, schema: ResolvedSemanticSchema, operators: OperatorRegistry, resolveSchema: (schemaId: string) => ResolvedSemanticSchema, sourceLogicform?: LogicformType) => readonly ExecutionUnit[] | undefined;
6
+ import { type LocaleTranslate } from '../i18n/index';
7
+ export type ExecutionUnit = OperatorQueryComponent | (OperatorComponentCalculation & {
8
+ readonly outputName: string;
9
+ }) | (OperatorJavaScriptCalculation & {
10
+ readonly outputName: string;
11
+ });
12
+ export declare const createExecutionUnits: (logicform: LogicformType, plan: LogicalPlan, schema: ResolvedSemanticSchema, operators: OperatorRegistry, resolveSchema: (schemaId: string) => ResolvedSemanticSchema, sourceLogicform?: LogicformType, locale?: string, t?: LocaleTranslate) => readonly ExecutionUnit[] | undefined;
8
13
  export declare const mergeComponentRows: (results: readonly (readonly DataRow[])[], groupNames: readonly string[]) => DataRow[];
9
14
  export declare const mergeExecutionResults: (results: readonly (readonly DataRow[])[], plan: LogicalPlan) => DataRow[];
@@ -1,12 +1 @@
1
- import type { CoreComputeProvider, DatabaseConnection } from '../physical/index';
2
- type ProviderFactory = (connection: DatabaseConnection) => CoreComputeProvider;
3
- export declare class ConnectionRegistry {
4
- #private;
5
- private readonly create;
6
- constructor(create?: ProviderFactory);
7
- get(connection: DatabaseConnection): CoreComputeProvider;
8
- close(): Promise<void>;
9
- }
10
- export declare const getConnectionProvider: (connection: DatabaseConnection) => CoreComputeProvider;
11
- export declare const closeConnections: () => Promise<void>;
12
- export {};
1
+ export { ConnectionRegistry, getConnectionProvider, closeConnections } from '../physical/index';
@@ -1,13 +1,19 @@
1
1
  import type { CompiledQuery } from '../compiler/index';
2
2
  import type { DataRow } from '../physical/index';
3
3
  import type { LogicalPlan } from '../planner/index';
4
- import type { InternalExecuteOptions } from './types';
4
+ import type { SchemaMappingDefinition, SchemaMappingRegistry } from '../schema-mappings/index';
5
+ import type { InternalExecuteOptions, SqlExecutionSource } from './types';
6
+ export type SqlExecutionSourceReporter = (source: SqlExecutionSource) => void;
5
7
  export interface PhysicalQuerySource {
6
8
  readonly schemaId: string;
7
9
  readonly source: string;
10
+ readonly connectionId?: string;
11
+ /** Base mapping source that owns an enrichment source. */
12
+ readonly mappingSource?: string;
8
13
  }
14
+ export declare const resolvePhysicalSourceMapping: (source: PhysicalQuerySource, mappings: SchemaMappingRegistry) => SchemaMappingDefinition | undefined;
9
15
  export declare const collectPlanSources: (plan: LogicalPlan) => readonly PhysicalQuerySource[];
10
16
  export declare const mergePhysicalSources: (groups: readonly (readonly PhysicalQuerySource[])[]) => readonly PhysicalQuerySource[];
11
- export declare const executeCompiledQuery: (compiled: CompiledQuery, sources: readonly PhysicalQuerySource[], options: Pick<InternalExecuteOptions, "cache" | "provider" | "schemaMappings" | "signal">) => Promise<DataRow[]>;
17
+ export declare const executeCompiledQuery: (compiled: CompiledQuery, sources: readonly PhysicalQuerySource[], options: Pick<InternalExecuteOptions, "cache" | "provider" | "schemaMappings" | "signal" | "connectionId">, reportExecutionSource?: SqlExecutionSourceReporter) => Promise<DataRow[]>;
12
18
  /** Apply final SQL shaping after all plans, views, and derived sources are compiled. */
13
19
  export declare const shortenCompiledQuery: (compiled: CompiledQuery) => CompiledQuery;
@@ -0,0 +1,38 @@
1
+ import type { CompiledQuery } from '../compiler/index';
2
+ import type { LogicformType } from '../logicform-types';
3
+ import type { OperatorRegistry } from '../operators/index';
4
+ import type { CoreComputeProvider, DataRow } from '../physical/index';
5
+ import type { LogicalPlan } from '../planner/index';
6
+ import type { SchemaMappingRegistry } from '../schema-mappings/index';
7
+ import type { SqlExecutionSourceReporter } from './execute-query';
8
+ import type { InternalExecuteOptions } from './types';
9
+ export declare const coordinatorConnectionId = "__semanticdb_coordinator__";
10
+ export interface FederatedCompiledQuery {
11
+ readonly compiled: CompiledQuery;
12
+ readonly connectionId: string;
13
+ readonly provider: CoreComputeProvider;
14
+ readonly type: 'computation' | 'total';
15
+ readonly logicform: LogicformType;
16
+ }
17
+ interface FederatedExecutionOptions {
18
+ readonly logicform: LogicformType;
19
+ readonly operators: OperatorRegistry;
20
+ readonly schemaMappings: SchemaMappingRegistry;
21
+ readonly providerForConnection: (connectionId: string) => CoreComputeProvider;
22
+ readonly cache?: InternalExecuteOptions['cache'];
23
+ readonly signal?: AbortSignal;
24
+ readonly maxMaterializedRows: number;
25
+ readonly onCompiled: (query: FederatedCompiledQuery) => SqlExecutionSourceReporter;
26
+ }
27
+ export interface FederatedExecutionResult {
28
+ readonly rows: DataRow[];
29
+ readonly total: number;
30
+ readonly connections: readonly {
31
+ readonly connectionId: string;
32
+ readonly provider: CoreComputeProvider['kind'];
33
+ }[];
34
+ }
35
+ export declare const planConnectionIds: (plan: LogicalPlan, schemaMappings: SchemaMappingRegistry) => readonly string[];
36
+ export declare const isFederatedComposition: (plan: LogicalPlan, schemaMappings: SchemaMappingRegistry) => boolean;
37
+ export declare const executeFederatedComposition: (plan: LogicalPlan, options: FederatedExecutionOptions) => Promise<FederatedExecutionResult>;
38
+ export {};
@@ -1,3 +1,4 @@
1
+ import type { LogicformType } from '../logicform-types';
1
2
  import type { OperatorRegistry } from '../operators/index';
2
3
  import type { DataRow } from '../physical/index';
3
4
  import type { SchemaMappingRegistry } from '../schema-mappings/index';
@@ -8,19 +9,24 @@ import type { Permissions } from '../permissions/index';
8
9
  import type { ResolvedSemanticSchema, SemanticTypeRegistry } from '../semantic-types/index';
9
10
  import type { EntityFetchRequest } from './result-hydrator/index';
10
11
  import type { SemanticDBPlugin } from '../plugins/index';
12
+ import type { SqlExecutionSourceReporter } from './execute-query';
13
+ import type { LocaleRegistry } from '../i18n/index';
11
14
  interface FetchEntityOptions {
12
15
  readonly version: string;
13
16
  readonly operators: OperatorRegistry;
14
17
  readonly locale?: string;
18
+ readonly localeRegistry?: LocaleRegistry;
15
19
  readonly schemaMappings: SchemaMappingRegistry;
16
20
  readonly semanticTypes: SemanticTypeRegistry;
17
21
  readonly plugins?: readonly SemanticDBPlugin[];
18
22
  readonly resolveSchema: (schemaId: string) => ResolvedSemanticSchema;
19
23
  readonly permissions?: Permissions;
20
24
  readonly provider: CoreComputeProvider;
25
+ readonly providerForConnection?: (connectionId: string) => CoreComputeProvider;
26
+ readonly preferredConnectionId?: string;
21
27
  readonly cache?: QueryCacheExecutionOptions;
22
28
  readonly signal?: AbortSignal;
23
- readonly onCompiled?: (compiled: CompiledQuery) => void;
29
+ readonly onCompiled?: (compiled: CompiledQuery, logicform: LogicformType, provider: CoreComputeProvider, connectionId?: string) => SqlExecutionSourceReporter | undefined;
24
30
  }
25
31
  export declare const fetchEntities: (request: EntityFetchRequest, options: FetchEntityOptions) => Promise<DataRow[]>;
26
32
  export {};
@@ -1,3 +1,3 @@
1
1
  export { execute } from './execute';
2
2
  export { closeConnections } from './connection-registry';
3
- export type { ExecuteOptions, ExecuteFailureResult, ExecuteProgressEvent, ExecuteResult, ExecuteSuccessResult, ExecutedSql, ExecutedSqlType, PartialExecuteResult, ProgressCallback, } from './types';
3
+ export type { ExecuteOptions, ExecuteFailureResult, ExecuteProgressEvent, ExecuteResult, ExecuteSuccessResult, ExecutedSql, ExecutedSqlType, SqlExecutionSource, PartialExecuteResult, ProgressCallback, } from './types';
@@ -1,6 +1,7 @@
1
1
  import type { ResultProperty } from '../../operators/index';
2
2
  import type { DataRow } from '../../physical/index';
3
3
  import type { ResolvedSemanticProperty, ResolvedSemanticSchema, SemanticTypeRegistry } from '../../semantic-types/index';
4
+ import type { SemanticDBPlugin } from '../../plugins/index';
4
5
  export type HydrationProperty = Pick<ResultProperty, 'isArray' | 'name' | 'primal_type' | 'ref' | 'type'> | ResolvedSemanticProperty;
5
6
  export interface EntityFetchRequest {
6
7
  readonly schema: ResolvedSemanticSchema;
@@ -11,4 +12,5 @@ export interface ResultHydratorOptions {
11
12
  readonly semanticTypes: SemanticTypeRegistry;
12
13
  readonly resolveSchema: (schemaId: string) => ResolvedSemanticSchema;
13
14
  readonly fetchEntities: (request: EntityFetchRequest) => Promise<readonly DataRow[]>;
15
+ readonly plugins?: readonly SemanticDBPlugin[];
14
16
  }
@@ -1,4 +1,5 @@
1
1
  import type { DataRow } from '../physical/index';
2
2
  import type { RowIdentityPlan } from '../planner/index';
3
- export declare const groupRowIdentity: (row: DataRow, names: readonly string[]) => string;
3
+ export declare const identityPart: (value: unknown) => string;
4
+ export declare const groupRowIdentity: (row: DataRow, names: readonly string[], separator?: string, nullLabel?: string) => string;
4
5
  export declare const addRowIdentities: (rows: readonly DataRow[], identity: RowIdentityPlan) => DataRow[];
@@ -0,0 +1,11 @@
1
+ import type { CompiledQuery } from '../compiler/index';
2
+ import type { CoreComputeProvider, DataRow } from '../physical/index';
3
+ import type { LogicalPlan } from '../planner/index';
4
+ import type { LogicformType } from '../logicform-types';
5
+ /** Remove global result paging while retaining HAVING and per-group limitBy semantics. */
6
+ export declare const withoutGlobalPagination: (plan: LogicalPlan) => LogicalPlan;
7
+ /** Describe the total SQL with the same unpaged global result as its plan. */
8
+ export declare const withoutGlobalPaginationLogicform: (logicform: LogicformType) => LogicformType;
9
+ /** Count the rows produced by a complete unpaginated logical result. */
10
+ export declare const compileTotalQuery: (unpaged: CompiledQuery, provider: CoreComputeProvider) => CompiledQuery;
11
+ export declare const readTotal: (rows: readonly DataRow[]) => number;
@@ -1,14 +1,14 @@
1
- import type { OperatorRegistry } from '../operators/index';
2
- import type { CoreComputeProvider, DataRow, SqlParameters } from '../physical/index';
1
+ import type { OperatorDefinition, OperatorExecutionContext, OperatorRegistry } from '../operators/index';
2
+ import type { CoreComputeProvider, DataRow, ProviderRegistry, SqlParameters } from '../physical/index';
3
3
  import type { DatabaseConnection } from '../physical/index';
4
4
  import type { LogicalPlan, QueryLineage } from '../planner/index';
5
- import type { SchemaMappingRegistry } from '../schema-mappings/index';
6
- import type { ResolvedSemanticSchema, SemanticSchemaDraft, SemanticTypeRegistry } from '../semantic-types/index';
7
- import type { LogicformType } from '../logicform-types';
8
- import type { QueryCacheExecutionOptions } from '../cache/index';
5
+ import type { SchemaMappingDefinition, SchemaMappingRegistry, SchemaMappingSelection } from '../schema-mappings/index';
6
+ import type { ResolvedSemanticSchema, SemanticSchemaDraft, SemanticTypeRegistry, TimeWatermarkPolicy } from '../semantic-types/index';
7
+ import type { LogicformType, PublicLogicformType } from '../logicform-types';
8
+ import type { QueryCacheConfiguration, QueryCacheExecutionOptions } from '../cache/index';
9
9
  import type { Permissions } from '../permissions/index';
10
- import type { CustomFunctions } from '../custom-functions/index';
11
10
  import type { SemanticDBPlugin } from '../plugins/index';
11
+ import type { LocaleInput, LocaleRegistry } from '../i18n/index';
12
12
  export type ExecuteProgressEvent = {
13
13
  readonly stage: 'started';
14
14
  readonly logicform: LogicformType;
@@ -36,6 +36,7 @@ export type ExecuteProgressEvent = {
36
36
  } | {
37
37
  readonly stage: 'executing';
38
38
  readonly provider: CoreComputeProvider['kind'];
39
+ readonly connectionId?: string;
39
40
  readonly partialResult: PartialExecuteResult;
40
41
  } | {
41
42
  readonly stage: 'hydrating';
@@ -56,63 +57,107 @@ export type ExecuteProgressEvent = {
56
57
  export type ProgressCallback = (event: ExecuteProgressEvent) => void | Promise<void>;
57
58
  interface ExecuteBaseOptions {
58
59
  readonly schemas: Readonly<Record<string, SemanticSchemaDraft>>;
59
- readonly schemaMappings: SchemaMappingRegistry;
60
+ /** Caller-owned Registry; plugin SemanticTypes are copied into the execution Registry. */
60
61
  readonly semanticTypes?: SemanticTypeRegistry;
61
- readonly operators?: OperatorRegistry;
62
+ /** Caller-defined Operators; explicit definitions override same-name built-ins or plugin Operators. */
63
+ readonly operators?: OperatorDefinition | readonly OperatorDefinition[];
62
64
  /** Caller-owned capability plugins appended to the built-in plugin set for this execution. */
63
65
  readonly plugins?: readonly SemanticDBPlugin[];
64
66
  /** Locale for generated human-readable PredItem names. Defaults to zh-CN. */
65
67
  readonly locale?: string;
68
+ /** Additional or overriding locale files used by generated names and messages. */
69
+ readonly locales?: LocaleInput;
66
70
  /** Table, row, and column permissions for this execution. */
67
71
  readonly permissions?: Permissions;
68
- /** Legacy-compatible dynamically supplied composite metric definitions. */
69
- readonly customFunctions?: CustomFunctions;
70
- /** Third argument passed to mergeComponents/genMergeSQL callbacks. */
71
- readonly customFunctionConfig?: Readonly<Record<string, unknown>>;
72
- /** Optional caller-owned cache shared across executions. */
73
- readonly cache?: QueryCacheExecutionOptions;
74
72
  readonly onProgress?: ProgressCallback;
75
73
  readonly signal?: AbortSignal;
74
+ /** Default time watermark policy; Schema and Property policies override it. */
75
+ readonly timeWatermark?: TimeWatermarkPolicy;
76
+ /** Resource limits for in-process combination of separate physical connections. */
77
+ readonly federation?: {
78
+ /** Defaults to 100,000 rows across all materialized aggregate branches. */
79
+ readonly maxMaterializedRows?: number;
80
+ };
76
81
  }
77
82
  export interface ExecuteOptions extends ExecuteBaseOptions {
83
+ /** Physical mappings supplied as JSON definitions. */
84
+ readonly schemaMappings: readonly SchemaMappingDefinition[];
78
85
  /** Database connections addressable by SchemaMappingDefinition.connectionId. */
79
86
  readonly connections: readonly DatabaseConnection[];
87
+ /** Provider factories used for built-in or application-defined connection kinds. */
88
+ readonly providerRegistry?: ProviderRegistry;
89
+ /** JSON configuration for an internally owned and reused query-cache connection. */
90
+ readonly cache?: QueryCacheConfiguration;
80
91
  }
81
92
  /** Internal execution seam used by executor tests after a provider has been resolved. */
82
- export interface InternalExecuteOptions extends ExecuteBaseOptions {
93
+ export interface InternalExecuteOptions extends Omit<ExecuteBaseOptions, 'operators'> {
94
+ readonly operators?: OperatorRegistry;
95
+ /** The public execution boundary has already merged built-in, plugin, and explicit Operators. */
96
+ readonly operatorsResolved?: boolean;
97
+ /** Present for nested executions to reuse or intentionally suppress calendar preloading. */
98
+ readonly executionContext?: OperatorExecutionContext;
99
+ /** The public execution boundary has already merged plugin SemanticTypes. */
100
+ readonly semanticTypesResolved?: boolean;
101
+ readonly localeRegistry?: LocaleRegistry;
83
102
  readonly provider: CoreComputeProvider;
103
+ /** Resolve providers for additional physical connections in a federated execution. */
104
+ readonly providerForConnection?: (connectionId: string) => CoreComputeProvider;
105
+ readonly schemaMappings: SchemaMappingRegistry;
106
+ /** Cache connection already resolved at the public execution boundary. */
107
+ readonly cache?: QueryCacheExecutionOptions;
84
108
  /** Selected connection for public execution; omitted only by internal provider tests. */
85
109
  readonly connectionId?: string;
86
110
  }
87
111
  export interface ExecuteSuccessResult {
88
112
  readonly result: DataRow[];
113
+ /** Result rows or grouped rows before global limit/page pagination. */
114
+ readonly total: number;
89
115
  /** Schema describing the computed result rows. */
90
116
  readonly schema: ResolvedSemanticSchema;
91
- readonly normedLogicform: LogicformType;
117
+ readonly normedLogicform: PublicLogicformType;
92
118
  readonly sqls: readonly ExecutedSql[];
93
119
  readonly lineage: QueryLineage;
94
120
  readonly provider: CoreComputeProvider['kind'];
121
+ /** Physical connections that contributed rows to this result. */
122
+ readonly providers: readonly {
123
+ readonly connectionId: string;
124
+ readonly provider: CoreComputeProvider['kind'];
125
+ }[];
126
+ /** Physical mapping decisions, including why every non-selected candidate lost. */
127
+ readonly schemaMappingSelections: readonly SchemaMappingSelection[];
128
+ /** Plugin-owned materialization for a custom LogicForm output type. */
129
+ readonly output?: unknown;
95
130
  }
96
131
  export interface ExecuteFailureResult {
97
132
  readonly errorCode: '100';
98
133
  readonly error: string;
99
134
  readonly result: readonly [];
100
135
  readonly schema?: ResolvedSemanticSchema;
101
- readonly normedLogicform: LogicformType;
136
+ readonly normedLogicform: PublicLogicformType;
102
137
  readonly sqls: readonly ExecutedSql[];
103
138
  readonly provider?: CoreComputeProvider['kind'];
104
139
  readonly lineage?: QueryLineage;
105
140
  }
106
141
  export type ExecuteResult = ExecuteSuccessResult | ExecuteFailureResult;
107
- export type ExecutedSqlType = 'computation' | 'semantic-resolution';
142
+ export type ExecutedSqlType = 'computation' | 'semantic-resolution' | 'total';
143
+ export type SqlExecutionSource = 'cache' | 'database';
108
144
  export interface ExecutedSql {
109
145
  /** Why this SQL participates in the LogicForm execution. */
110
146
  readonly type: ExecutedSqlType;
147
+ /** Physical connection that executed this SQL, or the in-process coordinator id. */
148
+ readonly connectionId?: string;
149
+ readonly provider?: CoreComputeProvider['kind'];
150
+ /** Human-readable, localized explanation of why this SQL is executed. */
151
+ readonly explain: string;
152
+ /** Normalized LogicForm represented by this SQL statement. */
153
+ readonly logicform: PublicLogicformType;
111
154
  /** Parameterized SQL used for provider execution and cache identity. */
112
155
  readonly sql: string;
113
156
  readonly parameters: SqlParameters;
114
157
  /** Dialect-formatted diagnostic SQL. SemanticDB never executes this string. */
115
158
  readonly displaySql: string;
159
+ /** Actual row source. Absent only before execution, such as in the compiled progress event. */
160
+ readonly executionSource?: SqlExecutionSource;
116
161
  }
117
162
  export type PartialExecuteResult = Partial<ExecuteSuccessResult>;
118
163
  export {};
@@ -0,0 +1,4 @@
1
+ export { createLocaleRegistry, defaultLocaleRegistry, LocaleRegistry } from './registry';
2
+ export type { LocaleDefinition, LocaleInput, LocaleTranslate } from './types';
3
+ export { enUS } from './locales/en-US';
4
+ export { zhCN } from './locales/zh-CN';
@@ -0,0 +1,2 @@
1
+ import type { LocaleDefinition } from '../types';
2
+ export declare const enUS: LocaleDefinition;
@@ -0,0 +1,2 @@
1
+ import type { LocaleDefinition } from '../types';
2
+ export declare const zhCN: LocaleDefinition;
@@ -0,0 +1,13 @@
1
+ import type { LocaleDefinition, LocaleInput, LocaleTranslate } from './types';
2
+ export declare class LocaleRegistry {
3
+ private readonly definitions;
4
+ private readonly i18n;
5
+ constructor(locales?: LocaleInput);
6
+ register(locales: LocaleInput | undefined): this;
7
+ resolve(locale?: string): LocaleDefinition;
8
+ has(locale: string): boolean;
9
+ translate(locale: string, key: string, fallback?: string, values?: Readonly<Record<string, unknown>>): string;
10
+ translator(locale?: string): LocaleTranslate;
11
+ }
12
+ export declare const createLocaleRegistry: (locales?: LocaleInput) => LocaleRegistry;
13
+ export declare const defaultLocaleRegistry: LocaleRegistry;
@@ -0,0 +1,9 @@
1
+ /** A locale file consumed by SemanticDB's naming and error messages. */
2
+ export interface LocaleDefinition {
3
+ /** BCP-47 locale tag, for example `zh-CN` or `en-US`. */
4
+ readonly locale: string;
5
+ /** Translation messages keyed by a stable SemanticDB message key. */
6
+ readonly messages: Readonly<Record<string, string>>;
7
+ }
8
+ export type LocaleInput = LocaleDefinition | readonly LocaleDefinition[];
9
+ export type LocaleTranslate = (key: string, fallback?: string, values?: Readonly<Record<string, unknown>>) => string;
package/dist/index.d.ts CHANGED
@@ -1,26 +1,26 @@
1
+ export { createLocaleRegistry, defaultLocaleRegistry, LocaleRegistry, enUS, zhCN, } from './i18n/index';
2
+ export type { LocaleDefinition, LocaleInput, LocaleTranslate } from './i18n/index';
1
3
  export declare const Logicform: Readonly<{
2
4
  execute: (inputLogicform: import("./logicform-types").LogicformType, inputOptions: import(".").ExecuteOptions) => Promise<import(".").ExecuteResult>;
3
5
  close: () => Promise<void>;
4
- genComponents: (pred: import("./logicform-types").PredItemType, options: import(".").GenMetricComponentsOptions) => import(".").MetricComponentNode;
5
6
  }>;
6
7
  export { SemanticDBError } from './errors';
7
8
  export { builtinSemanticTypes, createSemanticTypeRegistry, resolveSchema, SemanticTypeRegistry, validateResolvedSchema, } from './semantic-types/index';
8
- export { builtinOperators, createOperatorRegistry, OperatorRegistry, } from './operators/index';
9
- export type { LegacySchemaPluginContext, SchemaMetadataPlugin, SemanticDBPlugin, } from './plugins/index';
10
- export { SchemaMappingRegistry, } from './schema-mappings/index';
11
- export type { AbsoluteDateValue, CompareOperator, CalendarDateValue, DateTimeValue, DateValue, ExpressionItemType, LogicformType, PeriodShiftTime, PredItemType, QueryLogicalOperand, RecursiveQueryType, RelationQueryType, QueryType, QueryValueType, QueryValueTypeWithCompareOperator, RelativeDateValue, RepresentationType, } from './logicform-types';
12
- export { CALENDAR_DATES_TABLE, CALENDAR_RELATIONS_TABLE, CALENDAR_SYSTEM_SCHEMA_IDS, calendarSystemSchemas, ProviderCalendarRelationStore, resolveCalendarPeriod, resolveCalendarPeriodFromStore, selectCalendarDates, } from './calendar/index';
13
- export type { CalendarAlignment, CalendarComparison, CalendarDateRow, CalendarRelation, CalendarRelationRow, ResolvedCalendarPeriod, } from './calendar/index';
14
- export type { CalendarRelationStore } from './calendar/index';
15
- export type { PrimalType, PropertySqlDefinition, ResolvedSemanticProperty, ResolvedSemanticSchema, SemanticTypeNormalizeContext, SemanticPropertyDraft, SemanticSchemaDraft, SemanticTypeDefinition, SemanticTypeResultContext, SemanticTypeResultProperty, TemporalSemantics, TimeGranularity, } from './semantic-types/index';
16
- export type { HierarchyDefinition, HierarchyLevelDefinition, ResolvedHierarchyDefinition, } from './plugins/hierarchy/index';
17
- export type { DataRow, SqlParameters, DatabaseConnection, } from './physical/index';
18
- export type { OperatorDefinition, OperatorDefaultNameContext, OperatorComponentContext, OperatorCteCalculation, OperatorCteComponent, OperatorCteSqlContext, OperatorExecutionComponent, OperatorPlanInputContext, OperatorPlannedInput, OperatorGroupKeyShift, OperatorJavaScriptCalculation, OperatorQueryComponent, OperatorEvaluateContext, OperatorOutputPropertyContext, OperatorSqlCapabilities, OperatorSqlContext, ResultProperty, ResultPropertyTemporalMetadata, } from './operators/index';
19
- export type { SchemaMappingDefinition, SchemaMappingPredDefinition, SchemaMappingPredMatch, SourceFreshnessPolicy, } from './schema-mappings/index';
20
- export type { QueryCache, QueryCacheExecutionOptions, QueryCacheIdentity, QueryCacheWriteOptions, } from './cache/index';
21
- export type { ExecuteOptions, ExecuteFailureResult, ExecuteProgressEvent, ExecuteResult, ExecuteSuccessResult, ExecutedSql, ExecutedSqlType, PartialExecuteResult, ProgressCallback, } from './executor/index';
9
+ export { builtinOperators, createOperatorRegistry, OperatorRegistry, resolveOperator, } from './operators/index';
10
+ export type { LegacySchemaPluginContext, MappingGranularityContext, MappingGranularityPlugin, OutputHandlerContext, OutputHandlerDefinition, IntervalSemanticProperties, IntervalSemanticsDefinition, PlannerPeriodDefinition, PlannerPeriodEvaluation, RelationSemanticsDefinition, RelationTemporalPlan, TimeWatermarkLogicformContext, PropertyMetadataPlugin, QueryOperatorCompileContext, QueryOperatorAuthorizeContext, QueryOperatorDefinition, QueryOperatorNormalizeContext, QueryOperatorPhysicalSource, QueryOperatorPlanContext, QueryOperatorPlanResult, SchemaMetadataPlugin, SchemaMappingPlugin, SemanticDBPlugin, } from './plugins/index';
11
+ export { SchemaMappingRegistry, fromYiAskSchemaMapping, } from './schema-mappings/index';
12
+ export type { AbsoluteDateValue, CompareOperator, DatePartQueryComparison, DatePartQueryOperand, DateTimeValue, DateValue, EntityIdType, ExpressionItemType, LogicformType, NumericQueryComparison, NumericQueryOperand, PublicLogicformType, PeriodShiftTime, PredItemType, QueryLogicalOperand, QueryExpressionType, RelationQueryType, QueryType, QueryValueType, QueryValueTypeWithCompareOperator, RelativeDateValue, RepresentationType, } from './logicform-types';
13
+ export type { RecursiveQueryType } from './plugins/index';
14
+ export type { PrimalType, PropertyHierarchyDefinition, PropertySqlDefinition, ResolvedSemanticProperty, ResolvedSemanticSchema, SemanticTypeNormalizeContext, SemanticPropertyDraft, SemanticSchemaDraft, SemanticTypeDefinition, SemanticTypeResultContext, SemanticTypeResultProperty, TimeGranularity, TimeWatermarkPolicy, } from './semantic-types/index';
15
+ export type { DataRow, SqlParameters, BuiltinDatabaseConnection, DatabaseConnection, DatabaseConnectionBase, DatabaseConnectionExtensions, ProviderDefinition, ProviderKind, ProviderKindExtensions, } from './physical/index';
16
+ export { DBConnector, ProviderRegistry } from './physical/index';
17
+ export type { DBConnectorOptions, RunSQLOptions, GetTableListOptions, DescribeTableOptions, DescribeTableRequest, DatabaseColumn, TableDescription, DatabaseTable, SQLResult, TableListRequest, } from './physical/index';
18
+ export type { OperatorDefinition, OperatorDefaultNameContext, OperatorExecutionContext, OperatorComponentContext, OperatorComponentCalculation, OperatorComponentQuery, OperatorExecutionComponent, OperatorPlanInputContext, OperatorPlannedInput, OperatorGroupKeyShift, OperatorJavaScriptCalculation, OperatorQueryComponent, OperatorEvaluateContext, OperatorOutputPropertyContext, OperatorSqlCapabilities, OperatorSqlContext, ResultProperty, ResultPropertyTemporalMetadata, ResultPropertyTemporalMetadataExtensions, } from './operators/index';
19
+ export type { SchemaMappingDefinition, SchemaMappingEnrichmentDefinition, SchemaMappingEnrichmentKey, SchemaMappingItem, SchemaMappingGranularity, SchemaMappingGranularityExtensions, SchemaMappingPointTemporalDefinition, SchemaMappingPredDefinition, SchemaMappingPredMatch, SchemaMappingSelection, RejectedSchemaMapping, SourceFreshnessPolicy, YiAskSchemaMappingItem, YiAskSchemaMappingRecord, } from './schema-mappings/index';
20
+ export { QueryCacheManager } from './cache/index';
21
+ export type { InvalidateQueryCacheSourceOptions, QueryCacheConfiguration, } from './cache/index';
22
+ export type { ExecuteOptions, ExecuteFailureResult, ExecuteProgressEvent, ExecuteResult, ExecuteSuccessResult, ExecutedSql, ExecutedSqlType, SqlExecutionSource, PartialExecuteResult, ProgressCallback, } from './executor/index';
22
23
  export type { ColumnPermissions, Permissions, SchemaPermissions, } from './permissions/index';
23
- export type { CustomFunctionColumnProperty, CustomFunctionDefinition, CustomFunctionHelpers, CustomFunctionSqlContext, CustomFunctions, GenComponents, GenComponentsContext, GenMergeSQL, GenMetricComponentsOptions, MergeComponents, MetricComponentNode, } from './custom-functions/index';
24
24
  export type { CreateLogicalPlanOptions, LogicalPlan, QueryLineage, } from './planner/index';
25
25
  export { PlannerSemanticRegistry, createPlannerSemanticRegistry, } from './planner/index';
26
26
  export type { PlannerSemanticResolution, PlannerSemanticQueryContext, PlannerSemanticRule, PlannerSemanticRuleContext, } from './planner/index';
@@ -19,29 +19,15 @@ export interface AbsoluteDateValue {
19
19
  readonly second?: number;
20
20
  readonly period?: 'am' | 'pm';
21
21
  }
22
- /** A business-calendar period resolved to natural days before planning. */
23
- export interface CalendarDateValue {
24
- readonly calendar: string;
25
- readonly key?: string;
26
- readonly year?: number;
27
- readonly quarter?: number;
28
- readonly month?: number;
29
- readonly week?: number;
30
- readonly day?: number;
31
- readonly relativeDay?: number | readonly number[];
32
- }
33
22
  /** Period reference used by operators such as `$periodShift`. */
34
23
  export type PeriodShiftTime = RelativeDateValue | AbsoluteDateValue;
35
24
  /** A date value before semantic-type normalization. */
36
- export type DateValue = string | RelativeDateValue | AbsoluteDateValue | CalendarDateValue;
37
- export type CompareOperator = '$eq' | '$gt' | '$gte' | '$lt' | '$lte' | '$ne' | '$in' | '$nin' | '$exists' | '$regex' | '$contains' | '$recursive' | '$and' | '$or';
38
- export interface RecursiveQueryType {
39
- readonly schema?: string;
40
- readonly root?: QueryValueType;
41
- readonly roots?: QueryValueType[];
42
- readonly includeSelf?: boolean;
43
- readonly idProperty?: string;
44
- readonly parentProperty?: string;
25
+ export type DateValue = string | RelativeDateValue | AbsoluteDateValue;
26
+ /** Stable entity identity. Numeric IDs must be safe integers. */
27
+ export type EntityIdType = string | number;
28
+ export type CompareOperator = '$eq' | '$gt' | '$gte' | '$lt' | '$lte' | '$ne' | '$in' | '$nin' | '$exists' | '$regex' | '$contains' | '$startsWith' | '$length' | '$and' | '$or' | '$second' | '$minute' | '$hour' | '$weekday' | '$day' | '$week' | '$month' | '$quarter' | '$year' | Extract<keyof QueryOperatorExtensions, string>;
29
+ /** Module-augmentation seam for plugin-owned field Query Operators. */
30
+ export interface QueryOperatorExtensions {
45
31
  }
46
32
  export type QueryValueType = null | string | number | boolean | DateValue | RelationQueryType | LogicformType | string[] | number[] | boolean[] | DateValue[] | RelationQueryType[] | LogicformType[];
47
33
  /** A query scoped through an object relation. Version is inherited from the parent LogicForm. */
@@ -50,9 +36,29 @@ export interface RelationQueryType {
50
36
  readonly schema: string;
51
37
  readonly query: QueryType;
52
38
  /** Stable entity identity. `placeholder` preserves context without adding an ID filter. */
53
- readonly entity_id?: string;
39
+ readonly entity_id?: EntityIdType;
54
40
  }
55
41
  export type QueryLogicalOperand = QueryValueType | QueryValueTypeWithCompareOperator;
42
+ /** Apply a scalar pred expression, then test its result against a condition. */
43
+ export interface QueryExpressionType {
44
+ readonly pred: PredItemType;
45
+ readonly condition: QueryLogicalOperand;
46
+ }
47
+ export type NumericQueryOperand = number | number[] | NumericQueryComparison;
48
+ export type NumericQueryComparison = Partial<{
49
+ $eq: number;
50
+ $gt: number;
51
+ $gte: number;
52
+ $lt: number;
53
+ $lte: number;
54
+ $ne: number;
55
+ $in: number[];
56
+ $nin: number[];
57
+ $and: NumericQueryOperand[];
58
+ $or: NumericQueryOperand[];
59
+ }>;
60
+ export type DatePartQueryOperand = NumericQueryOperand;
61
+ export type DatePartQueryComparison = NumericQueryComparison;
56
62
  export type QueryValueTypeWithCompareOperator = Partial<{
57
63
  $eq: QueryValueType;
58
64
  $gt: QueryValueType;
@@ -65,34 +71,49 @@ export type QueryValueTypeWithCompareOperator = Partial<{
65
71
  $exists: QueryValueType;
66
72
  $regex: QueryValueType;
67
73
  $contains: QueryValueType;
74
+ $startsWith: string;
75
+ $length: NumericQueryOperand;
76
+ $second: DatePartQueryOperand;
77
+ $minute: DatePartQueryOperand;
78
+ $hour: DatePartQueryOperand;
79
+ /** ISO weekday: Monday=1 through Sunday=7. */
80
+ $weekday: DatePartQueryOperand;
81
+ /** Day of month. */
82
+ $day: DatePartQueryOperand;
83
+ /** ISO week of year. */
84
+ $week: DatePartQueryOperand;
85
+ $month: DatePartQueryOperand;
86
+ $quarter: DatePartQueryOperand;
87
+ $year: DatePartQueryOperand;
68
88
  args?: {
69
89
  readonly options?: string;
70
90
  };
71
- $recursive: QueryValueType | RecursiveQueryType;
72
91
  $and: QueryLogicalOperand[];
73
92
  $or: QueryLogicalOperand[];
74
- }> & {
93
+ }> & Partial<QueryOperatorExtensions> & {
75
94
  readonly schema?: never;
76
95
  };
77
- export type QueryType = Record<string, QueryValueType | QueryValueTypeWithCompareOperator | QueryType[] | undefined> & {
96
+ export type QueryType = Record<string, QueryValueType | QueryValueTypeWithCompareOperator | QueryExpressionType | QueryType[] | undefined> & {
78
97
  readonly $and?: QueryType[];
79
98
  readonly $or?: QueryType[];
99
+ readonly $expr?: QueryExpressionType;
80
100
  };
81
101
  export interface ExpressionItemType {
82
102
  operator?: string;
83
- pred?: string | ExpressionItemType;
84
- /** Structural operands for multi-input operators. Operator options remain in `args`. */
85
- components?: ExpressionItemType[];
103
+ /** Operator input. Arrays represent ordered multi-input predicates. */
104
+ pred?: string | ExpressionItemType | (string | ExpressionItemType)[];
86
105
  name?: string;
87
106
  schema?: string;
88
107
  args?: Record<string, unknown>;
89
108
  }
90
109
  export interface PredItemType extends ExpressionItemType {
91
- pred?: string | PredItemType;
92
- components?: PredItemType[];
110
+ pred?: string | PredItemType | (string | PredItemType)[];
93
111
  query?: QueryType;
94
112
  }
95
- export type LogicformOutputTypeValue = 'url' | 'data' | 'export' | 'sql' | 'sqlComponents';
113
+ /** Module-augmentation seam for plugin-owned output types. */
114
+ export interface LogicformOutputExtensions {
115
+ }
116
+ export type LogicformOutputTypeValue = 'url' | 'data' | 'export' | 'sql' | 'sqlComponents' | Extract<keyof LogicformOutputExtensions, string>;
96
117
  export interface LogicformOutputType {
97
118
  type: LogicformOutputTypeValue;
98
119
  filename?: string;
@@ -102,10 +123,10 @@ export interface LogicformType {
102
123
  version: string;
103
124
  /** Required for a physical leaf. Derived and composed nodes inherit their field space. */
104
125
  schema?: string;
105
- /** Complete child LogicForms whose result columns are combined by their shared row identity. */
106
- logicforms?: LogicformType[];
107
126
  query?: QueryType;
108
127
  preds?: PredItemType[];
128
+ /** Output/reference aliases for properties contributed by another Schema. */
129
+ propertyResolve?: Readonly<Record<string, Readonly<Record<string, string>>>>;
109
130
  groupby?: PredItemType[];
110
131
  sort?: Record<string, 1 | -1>;
111
132
  having?: QueryType;
@@ -115,11 +136,10 @@ export interface LogicformType {
115
136
  page?: number;
116
137
  representation?: RepresentationType;
117
138
  /** Stable entity identity. `placeholder` preserves context without adding an ID filter. */
118
- entity_id?: string;
139
+ entity_id?: EntityIdType;
119
140
  from?: LogicformType;
120
141
  currency?: string;
121
142
  }
143
+ /** Public normalized shape; composition is represented by Planner subplans. */
144
+ export type PublicLogicformType = LogicformType;
122
145
  export declare const isLogicform: (value: unknown) => value is LogicformType;
123
- export declare const isComposedLogicform: (value: LogicformType) => value is LogicformType & {
124
- readonly logicforms: LogicformType[];
125
- };