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

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 (278) 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/execute.d.ts +1 -1
  18. package/dist/executor/federated-execution.d.ts +39 -0
  19. package/dist/executor/fetch-entities.d.ts +7 -1
  20. package/dist/executor/index.d.ts +1 -1
  21. package/dist/executor/partition.d.ts +17 -0
  22. package/dist/executor/result-hydrator/types.d.ts +2 -0
  23. package/dist/executor/row-identity.d.ts +2 -1
  24. package/dist/executor/total.d.ts +11 -0
  25. package/dist/executor/types.d.ts +70 -21
  26. package/dist/i18n/index.d.ts +4 -0
  27. package/dist/i18n/locales/en-US.d.ts +2 -0
  28. package/dist/i18n/locales/zh-CN.d.ts +2 -0
  29. package/dist/i18n/registry.d.ts +13 -0
  30. package/dist/i18n/types.d.ts +9 -0
  31. package/dist/index.d.ts +18 -16
  32. package/dist/logicform/dimensions.d.ts +16 -0
  33. package/dist/logicform/index.d.ts +2 -0
  34. package/dist/logicform-types.d.ts +56 -36
  35. package/dist/normalizer/core.d.ts +17 -3
  36. package/dist/normalizer/default-pred-name.d.ts +2 -0
  37. package/dist/normalizer/index.d.ts +1 -0
  38. package/dist/normalizer/pred-expression.d.ts +6 -0
  39. package/dist/normalizer/property-resolve.d.ts +6 -0
  40. package/dist/operators/builtins/constant.d.ts +2 -0
  41. package/dist/operators/builtins/period-name.d.ts +2 -1
  42. package/dist/operators/builtins/period-value.d.ts +2 -0
  43. package/dist/operators/builtins/query-expression.d.ts +3 -0
  44. package/dist/operators/builtins/scalar-extremum.d.ts +3 -0
  45. package/dist/operators/index.d.ts +2 -1
  46. package/dist/operators/registry.d.ts +5 -3
  47. package/dist/operators/resolve.d.ts +3 -0
  48. package/dist/operators/types.d.ts +110 -50
  49. package/dist/physical/clickhouse-provider.d.ts +29 -2
  50. package/dist/physical/connection-registry.d.ts +13 -0
  51. package/dist/physical/connection.d.ts +57 -15
  52. package/dist/physical/dameng-provider.d.ts +66 -0
  53. package/dist/physical/databricks-provider.d.ts +88 -0
  54. package/dist/physical/db-connector.d.ts +23 -0
  55. package/dist/physical/display-query.d.ts +3 -0
  56. package/dist/physical/doris-provider.d.ts +7 -1
  57. package/dist/physical/duckdb-coordinator-provider.d.ts +37 -0
  58. package/dist/physical/gbase-provider.d.ts +11 -0
  59. package/dist/physical/index.d.ts +24 -9
  60. package/dist/physical/load-driver.d.ts +1 -0
  61. package/dist/physical/maxcompute-provider.d.ts +44 -0
  62. package/dist/physical/mysql-protocol-provider.d.ts +27 -7
  63. package/dist/physical/mysql-provider.d.ts +2 -1
  64. package/dist/physical/oracle-provider.d.ts +21 -4
  65. package/dist/physical/postgresql-provider.d.ts +25 -4
  66. package/dist/physical/provider.d.ts +66 -2
  67. package/dist/physical/snowflake-provider.d.ts +20 -3
  68. package/dist/physical/sqlserver-provider.d.ts +69 -0
  69. package/dist/physical/starrocks-provider.d.ts +7 -1
  70. package/dist/physical/table-description.d.ts +5 -0
  71. package/dist/physical/table-discovery.d.ts +10 -0
  72. package/dist/planner/build-lineage.d.ts +1 -1
  73. package/dist/planner/build-mapping-source-plan.d.ts +6 -0
  74. package/dist/planner/create-logical-plan.d.ts +11 -0
  75. package/dist/planner/index.d.ts +4 -2
  76. package/dist/planner/mapping-granularity.d.ts +7 -0
  77. package/dist/planner/rewrite-nested-components.d.ts +8 -0
  78. package/dist/planner/select-schema-mapping.d.ts +19 -2
  79. package/dist/planner/semantics/index.d.ts +0 -3
  80. package/dist/planner/semantics/periods.d.ts +13 -0
  81. package/dist/planner/semantics/registry-defaults.d.ts +2 -1
  82. package/dist/planner/semantics/registry.d.ts +2 -1
  83. package/dist/planner/types.d.ts +106 -14
  84. package/dist/plugins/hierarchy/index.d.ts +1 -1
  85. package/dist/plugins/hierarchy/mapping-granularity.d.ts +4 -0
  86. package/dist/plugins/hierarchy/types.d.ts +20 -2
  87. package/dist/plugins/index.d.ts +10 -1
  88. package/dist/{planner/semantics → plugins}/observation/classification.d.ts +1 -1
  89. package/dist/plugins/observation/index.d.ts +17 -0
  90. package/dist/{planner/semantics → plugins}/observation/operator-policy.d.ts +4 -5
  91. package/dist/plugins/observation/periods.d.ts +18 -0
  92. package/dist/{planner/semantics → plugins}/observation/rule.d.ts +1 -1
  93. package/dist/plugins/observation/types.d.ts +3 -0
  94. package/dist/plugins/property-hierarchy/index.d.ts +11 -0
  95. package/dist/plugins/recursive/index.d.ts +26 -0
  96. package/dist/plugins/temporal/index.d.ts +13 -0
  97. package/dist/plugins/types.d.ts +165 -1
  98. package/dist/plugins/validity/classification.d.ts +5 -0
  99. package/dist/plugins/validity/index.d.ts +15 -0
  100. package/dist/plugins/validity/periods.d.ts +15 -0
  101. package/dist/plugins/validity/query-policy.d.ts +3 -0
  102. package/dist/plugins/validity/rule.d.ts +2 -0
  103. package/dist/plugins/validity/semantic-types.d.ts +3 -0
  104. package/dist/schema/dependent-projection.d.ts +8 -0
  105. package/dist/schema/entity-identity.d.ts +1 -1
  106. package/dist/schema/index.d.ts +1 -0
  107. package/dist/schema-mappings/freshness.d.ts +1 -1
  108. package/dist/schema-mappings/granularity.d.ts +5 -0
  109. package/dist/schema-mappings/index.d.ts +5 -1
  110. package/dist/schema-mappings/registry.d.ts +7 -3
  111. package/dist/schema-mappings/supported-dimensions.d.ts +10 -0
  112. package/dist/schema-mappings/types.d.ts +59 -9
  113. package/dist/schema-mappings/yiask.d.ts +27 -0
  114. package/dist/semantic-types/builtins/tag.d.ts +2 -0
  115. package/dist/semantic-types/index.d.ts +5 -3
  116. package/dist/semantic-types/registry.d.ts +2 -0
  117. package/dist/semantic-types/resolve-schema.d.ts +1 -1
  118. package/dist/semantic-types/types.d.ts +51 -11
  119. package/dist/semantic-types/validate-resolved-schema.d.ts +2 -5
  120. package/dist/semanticdb.esm.js +5 -0
  121. package/dist/semanticdb.js +5 -0
  122. package/package.json +49 -17
  123. package/dist/cache/expiry.js +0 -1
  124. package/dist/cache/identity.js +0 -1
  125. package/dist/cache/redis-query-cache.js +0 -1
  126. package/dist/cache/serialization.js +0 -1
  127. package/dist/calendar/constants.d.ts +0 -7
  128. package/dist/calendar/constants.js +0 -1
  129. package/dist/calendar/index.d.ts +0 -6
  130. package/dist/calendar/provider-relation-store.d.ts +0 -9
  131. package/dist/calendar/provider-relation-store.js +0 -1
  132. package/dist/calendar/resolver.d.ts +0 -10
  133. package/dist/calendar/resolver.js +0 -1
  134. package/dist/calendar/system-schemas.d.ts +0 -3
  135. package/dist/calendar/system-schemas.js +0 -1
  136. package/dist/calendar/types.d.ts +0 -31
  137. package/dist/compatibility/logicform.js +0 -1
  138. package/dist/compiler/compile-cte.js +0 -1
  139. package/dist/compiler/compile-plan.js +0 -1
  140. package/dist/compiler/shorten-sql.js +0 -2
  141. package/dist/custom-functions/custom-functions.d.ts +0 -6
  142. package/dist/custom-functions/custom-functions.js +0 -1
  143. package/dist/custom-functions/index.d.ts +0 -3
  144. package/dist/custom-functions/operator-adapter.d.ts +0 -12
  145. package/dist/custom-functions/operator-adapter.js +0 -1
  146. package/dist/custom-functions/types.d.ts +0 -62
  147. package/dist/errors.js +0 -1
  148. package/dist/executor/compatibility.js +0 -1
  149. package/dist/executor/components.js +0 -1
  150. package/dist/executor/connection-registry.js +0 -1
  151. package/dist/executor/evaluate.js +0 -1
  152. package/dist/executor/execute-query.js +0 -1
  153. package/dist/executor/execute.js +0 -1
  154. package/dist/executor/fetch-entities.js +0 -1
  155. package/dist/executor/result-hydrator/entity-loader.js +0 -1
  156. package/dist/executor/result-hydrator/format-values.js +0 -1
  157. package/dist/executor/result-hydrator/hydrate-result.js +0 -1
  158. package/dist/executor/result-hydrator/missing-entity.js +0 -1
  159. package/dist/executor/result-hydrator/populate-entities.js +0 -1
  160. package/dist/executor/row-identity.js +0 -1
  161. package/dist/index.js +0 -1
  162. package/dist/logicform-types.js +0 -1
  163. package/dist/normalizer/core.js +0 -1
  164. package/dist/normalizer/default-pred-name.js +0 -1
  165. package/dist/normalizer/entity-id.js +0 -1
  166. package/dist/normalizer/groupby.js +0 -1
  167. package/dist/normalizer/normalize-logicform.js +0 -1
  168. package/dist/normalizer/pagination.js +0 -1
  169. package/dist/normalizer/pred-query-name.js +0 -1
  170. package/dist/normalizer/preds.js +0 -1
  171. package/dist/normalizer/query.js +0 -1
  172. package/dist/normalizer/version.js +0 -1
  173. package/dist/operators/builtins/abs.js +0 -1
  174. package/dist/operators/builtins/accumulate.js +0 -1
  175. package/dist/operators/builtins/add.js +0 -1
  176. package/dist/operators/builtins/arithmetic.js +0 -1
  177. package/dist/operators/builtins/average-per-period.js +0 -1
  178. package/dist/operators/builtins/avg.js +0 -1
  179. package/dist/operators/builtins/case.js +0 -1
  180. package/dist/operators/builtins/concat.js +0 -1
  181. package/dist/operators/builtins/count-distinct.js +0 -1
  182. package/dist/operators/builtins/count.js +0 -1
  183. package/dist/operators/builtins/date-bucket.js +0 -1
  184. package/dist/operators/builtins/divide.js +0 -1
  185. package/dist/operators/builtins/index.js +0 -1
  186. package/dist/operators/builtins/max.js +0 -1
  187. package/dist/operators/builtins/min.js +0 -1
  188. package/dist/operators/builtins/multiply.js +0 -1
  189. package/dist/operators/builtins/newly.js +0 -1
  190. package/dist/operators/builtins/period-boundary.js +0 -1
  191. package/dist/operators/builtins/period-difference.js +0 -1
  192. package/dist/operators/builtins/period-growth.js +0 -1
  193. package/dist/operators/builtins/period-name.js +0 -1
  194. package/dist/operators/builtins/period-shift.js +0 -1
  195. package/dist/operators/builtins/rank.js +0 -1
  196. package/dist/operators/builtins/row-number.js +0 -1
  197. package/dist/operators/builtins/share-of-total.js +0 -1
  198. package/dist/operators/builtins/sql.js +0 -1
  199. package/dist/operators/builtins/substring.js +0 -1
  200. package/dist/operators/builtins/subtract.js +0 -1
  201. package/dist/operators/builtins/sum.js +0 -1
  202. package/dist/operators/builtins/time-range.js +0 -1
  203. package/dist/operators/groupby.js +0 -1
  204. package/dist/operators/index.js +0 -1
  205. package/dist/operators/registry.js +0 -1
  206. package/dist/operators/sql-expression.js +0 -1
  207. package/dist/permissions/permissions.js +0 -1
  208. package/dist/physical/clickhouse-provider.js +0 -1
  209. package/dist/physical/connection.js +0 -1
  210. package/dist/physical/display-query.js +0 -1
  211. package/dist/physical/doris-provider.js +0 -1
  212. package/dist/physical/mysql-compatible-sql.js +0 -1
  213. package/dist/physical/mysql-protocol-provider.js +0 -1
  214. package/dist/physical/mysql-provider.js +0 -1
  215. package/dist/physical/oracle-provider.js +0 -1
  216. package/dist/physical/postgresql-provider.js +0 -1
  217. package/dist/physical/snowflake-provider.js +0 -1
  218. package/dist/physical/starrocks-provider.js +0 -1
  219. package/dist/planner/build-lineage.js +0 -1
  220. package/dist/planner/create-logical-plan.js +0 -1
  221. package/dist/planner/select-schema-mapping.js +0 -1
  222. package/dist/planner/semantics/lifecycle/classification.d.ts +0 -7
  223. package/dist/planner/semantics/lifecycle/classification.js +0 -1
  224. package/dist/planner/semantics/lifecycle/index.d.ts +0 -3
  225. package/dist/planner/semantics/lifecycle/query-policy.d.ts +0 -3
  226. package/dist/planner/semantics/lifecycle/query-policy.js +0 -1
  227. package/dist/planner/semantics/lifecycle/rule.d.ts +0 -2
  228. package/dist/planner/semantics/lifecycle/rule.js +0 -1
  229. package/dist/planner/semantics/observation/classification.js +0 -1
  230. package/dist/planner/semantics/observation/index.d.ts +0 -4
  231. package/dist/planner/semantics/observation/operator-policy.js +0 -1
  232. package/dist/planner/semantics/observation/rule.js +0 -1
  233. package/dist/planner/semantics/observation/types.d.ts +0 -3
  234. package/dist/planner/semantics/registry-defaults.js +0 -1
  235. package/dist/planner/semantics/registry.js +0 -1
  236. package/dist/planner/types.js +0 -1
  237. package/dist/plugins/hierarchy/compatibility.js +0 -1
  238. package/dist/plugins/hierarchy/entity-identity.js +0 -1
  239. package/dist/plugins/hierarchy/index.js +0 -1
  240. package/dist/plugins/hierarchy/operator.js +0 -1
  241. package/dist/plugins/hierarchy/resolve-schema.js +0 -1
  242. package/dist/plugins/index.js +0 -1
  243. package/dist/schema/entity-identity.js +0 -1
  244. package/dist/schema/resolve-property-path.js +0 -1
  245. package/dist/schema/schema-registry.js +0 -1
  246. package/dist/schema-mappings/freshness.js +0 -1
  247. package/dist/schema-mappings/registry.js +0 -1
  248. package/dist/semantic-types/builtins/boolean.js +0 -1
  249. package/dist/semantic-types/builtins/category.js +0 -1
  250. package/dist/semantic-types/builtins/currency.js +0 -1
  251. package/dist/semantic-types/builtins/date.js +0 -1
  252. package/dist/semantic-types/builtins/duration.js +0 -1
  253. package/dist/semantic-types/builtins/end-date.d.ts +0 -2
  254. package/dist/semantic-types/builtins/end-date.js +0 -1
  255. package/dist/semantic-types/builtins/entity.js +0 -1
  256. package/dist/semantic-types/builtins/file.js +0 -1
  257. package/dist/semantic-types/builtins/human-name.js +0 -1
  258. package/dist/semantic-types/builtins/id.js +0 -1
  259. package/dist/semantic-types/builtins/image.js +0 -1
  260. package/dist/semantic-types/builtins/index.js +0 -1
  261. package/dist/semantic-types/builtins/int.js +0 -1
  262. package/dist/semantic-types/builtins/name.js +0 -1
  263. package/dist/semantic-types/builtins/number.js +0 -1
  264. package/dist/semantic-types/builtins/object.js +0 -1
  265. package/dist/semantic-types/builtins/order.js +0 -1
  266. package/dist/semantic-types/builtins/percentage.js +0 -1
  267. package/dist/semantic-types/builtins/start-date.d.ts +0 -2
  268. package/dist/semantic-types/builtins/start-date.js +0 -1
  269. package/dist/semantic-types/builtins/string.js +0 -1
  270. package/dist/semantic-types/builtins/timestamp.js +0 -1
  271. package/dist/semantic-types/index.js +0 -1
  272. package/dist/semantic-types/primal-types/date.js +0 -1
  273. package/dist/semantic-types/primal-types/index.js +0 -1
  274. package/dist/semantic-types/registry.js +0 -1
  275. package/dist/semantic-types/resolve-schema.js +0 -1
  276. package/dist/semantic-types/validate-resolved-schema.js +0 -1
  277. package/dist/utils/clone.js +0 -1
  278. /package/dist/operators/builtins/{period-boundary.d.ts → period-boundary-expression.d.ts} +0 -0
@@ -0,0 +1,3 @@
1
+ import type { SemanticTypeDefinition } from '../../semantic-types/index';
2
+ export declare const startDateSemanticType: SemanticTypeDefinition;
3
+ export declare const endDateSemanticType: SemanticTypeDefinition;
@@ -0,0 +1,8 @@
1
+ import type { PredItemType } from '../logicform-types';
2
+ import type { ResolvedSemanticSchema } from '../semantic-types/index';
3
+ /**
4
+ * Returns true when a scalar projection is functionally dependent on one of
5
+ * the supplied group keys. Same-Schema hierarchy uses `up`; scalar object
6
+ * relations use the relation key itself.
7
+ */
8
+ export declare const isDependentProjection: (pred: PredItemType, groupby: readonly PredItemType[], schema: ResolvedSemanticSchema, resolveSchema?: (schemaId: string) => ResolvedSemanticSchema) => boolean;
@@ -1,5 +1,5 @@
1
1
  import type { SemanticDBPlugin } from '../plugins/index';
2
2
  import type { ResolvedSemanticProperty, ResolvedSemanticSchema } from '../semantic-types/index';
3
- export declare const isConcreteEntityId: (value: unknown) => value is string;
3
+ export declare const isConcreteEntityId: (value: unknown) => value is string | number;
4
4
  export declare const resolveEntityIdProperty: (schema: ResolvedSemanticSchema) => ResolvedSemanticProperty;
5
5
  export declare const resolveEntityFilterProperty: (schema: ResolvedSemanticSchema, plugins?: readonly SemanticDBPlugin[]) => ResolvedSemanticProperty;
@@ -1,4 +1,5 @@
1
1
  export { buildFieldMap, getProperty, getSchema, } from './schema-registry';
2
2
  export { resolvePropertyPath } from './resolve-property-path';
3
+ export { isDependentProjection } from './dependent-projection';
3
4
  export { isConcreteEntityId, resolveEntityFilterProperty, resolveEntityIdProperty, } from './entity-identity';
4
5
  export type { ResolvedPropertyPath, ResolvedRelationSegment, ResolvedSchemaLookup, } from './resolve-property-path';
@@ -4,4 +4,4 @@ export declare const parseDailyExpireAt: (value: string) => {
4
4
  readonly minute: number;
5
5
  readonly second: number;
6
6
  } | undefined;
7
- export declare const validateSourceFreshness: (definition: SchemaMappingDefinition) => void;
7
+ export declare const validateSourceFreshness: (definition: Pick<SchemaMappingDefinition, "freshness">) => void;
@@ -0,0 +1,5 @@
1
+ import type { SemanticDBPlugin } from '../plugins/types';
2
+ import type { TimeGranularity } from '../semantic-types/index';
3
+ import type { SchemaMappingGranularity } from './types';
4
+ export declare const isMappingTimeGranularity: (value: unknown) => value is TimeGranularity;
5
+ export declare const isSchemaMappingGranularity: (value: unknown, plugins?: readonly SemanticDBPlugin[]) => value is SchemaMappingGranularity;
@@ -1,4 +1,8 @@
1
1
  export { SchemaMappingRegistry } from './registry';
2
+ export { getSupportedDimensions } from './supported-dimensions';
2
3
  export { parseDailyExpireAt } from './freshness';
3
- export type { SchemaMappingDefinition, SourceFreshnessPolicy } from './types';
4
+ export { isMappingTimeGranularity, isSchemaMappingGranularity, } from './granularity';
5
+ export type { SchemaMappingDefinition, SchemaMappingEnrichmentDefinition, SchemaMappingEnrichmentKey, SchemaMappingItem, SchemaMappingGranularity, SchemaMappingGranularityExtensions, SchemaMappingPointTemporalDefinition, SchemaMappingSelection, RejectedSchemaMapping, SourceFreshnessPolicy, } from './types';
4
6
  export type { SchemaMappingPredDefinition, SchemaMappingPredMatch, } from './types';
7
+ export { fromYiAskSchemaMapping } from './yiask';
8
+ export type { YiAskSchemaMappingItem, YiAskSchemaMappingRecord } from './yiask';
@@ -1,9 +1,13 @@
1
+ import type { SemanticDBPlugin } from '../plugins/index';
1
2
  import type { SchemaMappingDefinition } from './types';
2
3
  export declare class SchemaMappingRegistry {
3
4
  #private;
4
- constructor(definitions?: readonly SchemaMappingDefinition[]);
5
+ readonly plugins: readonly SemanticDBPlugin[];
6
+ constructor(definitions?: readonly SchemaMappingDefinition[], plugins?: readonly SemanticDBPlugin[]);
5
7
  register(definition: SchemaMappingDefinition): this;
6
- get(schemaId: string): SchemaMappingDefinition;
8
+ get(schemaId: string, connectionId?: string): SchemaMappingDefinition;
7
9
  list(schemaId: string): readonly SchemaMappingDefinition[];
8
- findSource(schemaId: string, source: string): SchemaMappingDefinition | undefined;
10
+ findById(schemaId: string, mappingId: string): SchemaMappingDefinition | undefined;
11
+ definitions(): readonly SchemaMappingDefinition[];
12
+ findSource(schemaId: string, source: string, connectionId?: string): SchemaMappingDefinition | undefined;
9
13
  }
@@ -0,0 +1,10 @@
1
+ import type { SchemaTypeDraft } from 'semanticdb-core';
2
+ import type { SemanticSchemaDraft } from '../semantic-types/index';
3
+ import type { SchemaMappingRegistry } from './registry';
4
+ /**
5
+ * Dimensions declared by at least one physical Mapping for this Schema.
6
+ * Returns canonical property-name paths. This is a discoverability union:
7
+ * metric coverage, time grain, and combinations of dimensions still require
8
+ * planning a concrete LogicForm.
9
+ */
10
+ export declare const getSupportedDimensions: (schemaId: string, schemas: Readonly<Record<string, SemanticSchemaDraft | SchemaTypeDraft>>, schemaMappings: SchemaMappingRegistry) => readonly string[];
@@ -1,4 +1,10 @@
1
- import type { QueryType } from '../logicform-types';
1
+ import type { PredItemType, QueryType } from '../logicform-types';
2
+ import type { TimeGranularity } from '../semantic-types/index';
3
+ /** Plugin-owned physical grains extend this interface through module augmentation. */
4
+ export interface SchemaMappingGranularityExtensions {
5
+ }
6
+ /** Finest physical grain represented by one mapped Property column. */
7
+ export type SchemaMappingGranularity = TimeGranularity | SchemaMappingGranularityExtensions[keyof SchemaMappingGranularityExtensions];
2
8
  export type SourceFreshnessPolicy = {
3
9
  readonly mode: 'ttl';
4
10
  readonly ttlSeconds: number;
@@ -12,7 +18,8 @@ export type SourceFreshnessPolicy = {
12
18
  export interface SchemaMappingPredMatch {
13
19
  /** Defaults to the owning mapping's Schema. */
14
20
  readonly schema?: string;
15
- readonly operator: string;
21
+ /** Restricts the match to one operator. Missing matches any aggregate operator. */
22
+ readonly operator?: string;
16
23
  readonly pred: string;
17
24
  /** Required conjunctive conditions across the LogicForm and PredItem queries. */
18
25
  readonly query?: QueryType;
@@ -22,6 +29,40 @@ export interface SchemaMappingPredDefinition {
22
29
  /** Physical column used as the matched PredItem's operator input. */
23
30
  readonly column: string;
24
31
  }
32
+ export interface SchemaMappingItem {
33
+ readonly sourceColumn?: string;
34
+ /** Trusted physical SQL expression, evaluated before the Schema Property's udf.sql. */
35
+ readonly propertySql?: string;
36
+ /** Enrichment id that owns sourceColumn. Missing means the mapping's base source. */
37
+ readonly sourceRef?: string;
38
+ readonly mappingType?: 'property' | 'predItem' | 'ignored';
39
+ /** Direct targets for a property item; one property path (ID/name segments) for a predItem. */
40
+ readonly propertyTarget?: readonly string[];
41
+ readonly predItem?: PredItemType;
42
+ /** Finest physical grain of a mapped Property. */
43
+ readonly granularity?: SchemaMappingGranularity;
44
+ }
45
+ export interface SchemaMappingEnrichmentKey {
46
+ /** Physical column on the mapping's base source. */
47
+ readonly baseColumn: string;
48
+ /** Physical entity-id column on the enrichment source. */
49
+ readonly targetColumn: string;
50
+ }
51
+ export interface SchemaMappingPointTemporalDefinition {
52
+ readonly kind: 'point';
53
+ /** Point whose containing base-source interval owns the feature row. */
54
+ readonly pointColumn: string;
55
+ }
56
+ /** A same-connection physical extension of one logical Schema. */
57
+ export interface SchemaMappingEnrichmentDefinition {
58
+ readonly id: string;
59
+ readonly source: string;
60
+ readonly sourceSql?: string;
61
+ readonly on: readonly SchemaMappingEnrichmentKey[];
62
+ readonly temporal?: SchemaMappingPointTemporalDefinition;
63
+ /** Missing means queries depending on this enrichment are not cached. */
64
+ readonly freshness?: SourceFreshnessPolicy;
65
+ }
25
66
  export interface SchemaMappingDefinition {
26
67
  /** Stable identity when a Schema has multiple physical mappings. */
27
68
  readonly id?: string;
@@ -32,15 +73,24 @@ export interface SchemaMappingDefinition {
32
73
  readonly source: string;
33
74
  /** Optional trusted query compiled as a derived-table source instead of reading source directly. */
34
75
  readonly sourceSql?: string;
35
- /**
36
- * Supported logical properties and their physical columns. Missing means all
37
- * Schema properties keep their configured physical IDs.
38
- */
39
- readonly properties?: Readonly<Record<string, string>>;
40
- /** PredItem patterns implemented by physical measure columns in this source. */
41
- readonly predMappings?: readonly SchemaMappingPredDefinition[];
76
+ /** Optional physical tables that extend base rows without becoming logical Schema relations. */
77
+ readonly enrichments?: readonly SchemaMappingEnrichmentDefinition[];
78
+ /** Unified logical-to-physical mappings for properties and conditional PredItems. */
79
+ readonly mappings?: readonly SchemaMappingItem[];
42
80
  /** Higher values win when multiple candidates cover the same LogicForm. */
43
81
  readonly priority?: number;
44
82
  /** Missing means queries depending on this physical source are not cached. */
45
83
  readonly freshness?: SourceFreshnessPolicy;
46
84
  }
85
+ export interface RejectedSchemaMapping {
86
+ readonly mappingId: string;
87
+ readonly reason: string;
88
+ /** Dimension Properties required by the query but unavailable on this Mapping. */
89
+ readonly missingDimensions?: readonly string[];
90
+ }
91
+ /** Planner diagnostics for one physical Schema mapping decision. */
92
+ export interface SchemaMappingSelection {
93
+ readonly schemaId: string;
94
+ readonly selectedMappingId: string;
95
+ readonly rejectedMappings: readonly RejectedSchemaMapping[];
96
+ }
@@ -0,0 +1,27 @@
1
+ import type { SemanticDBPlugin } from '../plugins/index';
2
+ import type { PredItemType } from '../logicform-types';
3
+ import type { SchemaMappingDefinition, SchemaMappingEnrichmentDefinition, SchemaMappingGranularity } from './types';
4
+ export interface YiAskSchemaMappingItem {
5
+ readonly sourceColumn?: string;
6
+ readonly propertySql?: string;
7
+ readonly sourceRef?: string;
8
+ readonly mappingType?: 'property' | 'predItem' | 'ignored';
9
+ readonly propertyTarget?: readonly string[];
10
+ readonly predItem?: PredItemType;
11
+ readonly granularity?: SchemaMappingGranularity;
12
+ }
13
+ export interface YiAskSchemaMappingRecord {
14
+ readonly id: string | number;
15
+ readonly schemaSid: string;
16
+ readonly datasourceSid: string;
17
+ readonly sourceMode?: 'table' | 'demo';
18
+ readonly tablePath?: string;
19
+ readonly sourceSql?: string;
20
+ readonly physicalDatabase?: string;
21
+ readonly physicalSchema?: string;
22
+ readonly physicalTable?: string;
23
+ readonly enrichments?: readonly SchemaMappingEnrichmentDefinition[];
24
+ readonly mappings: readonly YiAskSchemaMappingItem[];
25
+ readonly enabled?: boolean;
26
+ }
27
+ export declare const fromYiAskSchemaMapping: (record: YiAskSchemaMappingRecord, plugins?: readonly SemanticDBPlugin[]) => SchemaMappingDefinition;
@@ -0,0 +1,2 @@
1
+ import type { SemanticTypeDefinition } from '../types';
2
+ export declare const tagSemanticType: SemanticTypeDefinition;
@@ -1,9 +1,11 @@
1
+ import type { SemanticDBPlugin } from '../plugins/index';
1
2
  import { SemanticTypeRegistry } from './registry';
2
3
  export { builtinSemanticTypes } from './builtins/index';
3
4
  export { SemanticTypeRegistry } from './registry';
4
5
  export { resolveSchema } from './resolve-schema';
5
6
  export { validateResolvedSchema } from './validate-resolved-schema';
6
7
  export { normalizePrimalQuery } from './primal-types/index';
7
- export type { ComparableCategoryDefinition, PropertySqlDefinition, PrimalType, ResolvedSemanticProperty, ResolvedSemanticSchema, LegacySemanticSchemaMetadata, ResolvedSemanticSchemaMetadata, SemanticSchemaMetadata, SemanticTypeNormalizeContext, SemanticPeriodEvaluationContext, SemanticTypeResultContext, SemanticTypeResultProperty, SemanticPropertyDraft, SemanticSchemaDraft, SemanticTypeDefinition, TimeGranularity, TemporalSemantics, } from './types';
8
- export type { HierarchyDefinition, HierarchyLevelDefinition, ResolvedHierarchyDefinition, } from '../plugins/hierarchy/index';
9
- export declare const createSemanticTypeRegistry: () => SemanticTypeRegistry;
8
+ export type { ComparableCategoryDefinition, PropertyHierarchyDefinition, PropertySqlDefinition, LogicformPartition, LogicformPartitionContext, LogicformPartitionShard, PrimalType, ResolvedSemanticProperty, ResolvedSemanticSchema, LegacySemanticSchemaMetadata, ResolvedSemanticSchemaMetadata, SemanticSchemaMetadata, SemanticTypeNormalizeContext, SemanticPeriodEvaluationContext, SemanticTypeResultContext, SemanticTypeResultProperty, SemanticPropertyDraft, SemanticSchemaDraft, SemanticTypeDefinition, TimeGranularity, TimeWatermarkPolicy, } from './types';
9
+ export declare const createSemanticTypeRegistry: (plugins?: readonly SemanticDBPlugin[]) => SemanticTypeRegistry;
10
+ /** Copies a caller-owned Registry and appends plugin types without mutating the input. */
11
+ export declare const addPluginSemanticTypes: (registry: SemanticTypeRegistry, plugins: readonly SemanticDBPlugin[]) => SemanticTypeRegistry;
@@ -5,6 +5,8 @@ export declare class SemanticTypeRegistry {
5
5
  constructor(definitions?: readonly SemanticTypeDefinition[]);
6
6
  register(definition: SemanticTypeDefinition): this;
7
7
  get(name: string): SemanticTypeDefinition;
8
+ has(name: string): boolean;
9
+ definitions(): readonly SemanticTypeDefinition[];
8
10
  requiresPerPeriodEvaluation(context: {
9
11
  readonly logicform: LogicformType;
10
12
  readonly pred: PredItemType;
@@ -1,4 +1,4 @@
1
1
  import type { SemanticDBPlugin } from '../plugins/index';
2
2
  import type { SemanticTypeRegistry } from './registry';
3
3
  import type { ResolvedSemanticSchema, SemanticSchemaDraft } from './types';
4
- export declare const resolveSchema: (schema: SemanticSchemaDraft, registry: SemanticTypeRegistry, externalPlugins?: readonly SemanticDBPlugin[]) => ResolvedSemanticSchema;
4
+ export declare const resolveSchema: (inputSchema: SemanticSchemaDraft, registry: SemanticTypeRegistry, externalPlugins?: readonly SemanticDBPlugin[]) => ResolvedSemanticSchema;
@@ -1,8 +1,15 @@
1
1
  import type { PropertyTypeDraft, SchemaTypeDraft } from 'semanticdb-core';
2
- import type { LogicformType, PredItemType } from '../logicform-types';
3
- export type PrimalType = 'string' | 'number' | 'boolean' | 'date' | 'object';
2
+ import type dayjs from 'dayjs';
3
+ import type { LogicformType, PredItemType, QueryType } from '../logicform-types';
4
+ /** Canonical primitive types use `entity`; `object` remains a legacy input alias. */
5
+ export type PrimalType = 'string' | 'number' | 'boolean' | 'date' | 'entity' | 'object';
4
6
  export type TimeGranularity = 'second' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'quarter' | 'year';
5
- export type TemporalSemantics = 'normal' | 'snapshot';
7
+ export type TimeWatermarkPolicy = {
8
+ readonly type: 'database_latest';
9
+ } | {
10
+ readonly type: 'now_offset';
11
+ readonly offset: number;
12
+ };
6
13
  export interface PropertySqlDefinition {
7
14
  readonly sql: string;
8
15
  }
@@ -10,6 +17,36 @@ export interface ComparableCategoryDefinition {
10
17
  readonly values: readonly string[];
11
18
  readonly direction: 1 | -1;
12
19
  }
20
+ /** Same-Schema Property drill metadata. `up` is the single-valued side. */
21
+ export interface PropertyHierarchyDefinition {
22
+ readonly up?: string;
23
+ readonly down?: string;
24
+ }
25
+ /** One additive query slice. Candidates are tried in order and must cover the slice. */
26
+ export interface LogicformPartitionShard {
27
+ readonly query: QueryType;
28
+ readonly mappingCandidates: readonly string[];
29
+ }
30
+ export interface LogicformPartitionContext {
31
+ readonly dayjs: typeof dayjs;
32
+ /** Alias for dayjs; this does not provide the Moment.js API. */
33
+ readonly moment: typeof dayjs;
34
+ readonly schemas: Readonly<Record<string, ResolvedSemanticSchema>>;
35
+ readonly schemaMappings: readonly {
36
+ readonly id?: string;
37
+ readonly schemaId: string;
38
+ readonly priority?: number;
39
+ }[];
40
+ /** Runs within the same execution context. A pinned mapping bypasses its Schema partition hook. */
41
+ readonly execute: (logicform: LogicformType, options?: {
42
+ readonly mappingId?: string;
43
+ }) => Promise<{
44
+ readonly result: readonly Readonly<Record<string, unknown>>[];
45
+ }>;
46
+ }
47
+ export type LogicformPartition = (logicform: LogicformType, context: LogicformPartitionContext) => Promise<{
48
+ readonly shards: readonly LogicformPartitionShard[];
49
+ }>;
13
50
  /** Extension point for plugin-owned Schema draft metadata. */
14
51
  export interface SemanticSchemaMetadata {
15
52
  }
@@ -19,7 +56,7 @@ export interface ResolvedSemanticSchemaMetadata {
19
56
  /** Extension point for legacy plugin metadata removed from the canonical Schema shape. */
20
57
  export interface LegacySemanticSchemaMetadata {
21
58
  }
22
- export interface SemanticPropertyDraft extends Omit<PropertyTypeDraft, '_id' | '_sid' | 'id' | 'sid' | 'type' | 'primal_type' | 'isArray' | 'granularity' | 'is_observation' | 'is_snapshot' | 'temporalSemantics' | 'is_dynamic' | 'udf' | 'is_comparable' | 'comparable_order'> {
59
+ export interface SemanticPropertyDraft extends Omit<PropertyTypeDraft, '_id' | '_sid' | 'id' | 'sid' | 'type' | 'primal_type' | 'isArray' | 'granularity' | 'is_observation' | 'is_snapshot' | 'temporalSemantics' | 'is_dynamic' | 'udf' | 'is_comparable' | 'comparable_order' | 'hierarchy'> {
23
60
  readonly id?: string;
24
61
  readonly type: string;
25
62
  readonly primal_type?: PrimalType;
@@ -39,24 +76,23 @@ export interface ResolvedSemanticProperty extends Omit<SemanticPropertyDraft, 'i
39
76
  export interface SemanticSchemaDraft extends Omit<SchemaTypeDraft, '_id' | 'id' | 'sid' | 'properties' | 'db' | 'from' | 'fromSQL' | 'projections' | keyof SemanticSchemaMetadata | keyof LegacySemanticSchemaMetadata>, SemanticSchemaMetadata {
40
77
  readonly [key: string]: unknown;
41
78
  readonly id: string;
79
+ /** Marks the single Schema whose complete rows are loaded as calendar execution context. */
80
+ readonly is_calendar?: boolean;
81
+ readonly partition?: LogicformPartition;
42
82
  readonly properties: readonly SemanticPropertyDraft[];
43
- readonly temporalSemantics?: TemporalSemantics;
44
- /** Property that stores the parent node id for recursive tree queries. */
45
- readonly parentProperty?: string;
46
83
  }
47
84
  export interface ResolvedSemanticSchema extends Omit<SchemaTypeDraft, '_id' | 'id' | 'sid' | 'properties' | 'db' | 'from' | 'fromSQL' | 'projections' | keyof SemanticSchemaMetadata | keyof LegacySemanticSchemaMetadata>, ResolvedSemanticSchemaMetadata {
48
85
  readonly [key: string]: unknown;
49
86
  readonly id: string;
87
+ readonly is_calendar?: boolean;
88
+ readonly partition?: LogicformPartition;
50
89
  readonly properties: readonly ResolvedSemanticProperty[];
51
- readonly temporalSemantics?: TemporalSemantics;
52
- /** Canonical logical name of the parent Property used by recursive tree queries. */
53
- readonly parentProperty?: string;
54
90
  }
55
91
  export interface SemanticTypeNormalizeContext {
56
92
  readonly schema: ResolvedSemanticSchema;
57
93
  readonly property: ResolvedSemanticProperty;
58
94
  readonly now: Date;
59
- readonly requestLatestDataDate: () => Promise<Date | undefined>;
95
+ readonly requestTimeWatermark: (requestedUpperBound: Date) => Promise<Date | undefined>;
60
96
  }
61
97
  /** Context used when deciding whether a value must be evaluated per time period. */
62
98
  export interface SemanticPeriodEvaluationContext {
@@ -81,6 +117,10 @@ export interface SemanticTypeResultContext {
81
117
  export interface SemanticTypeDefinition {
82
118
  readonly name: string;
83
119
  readonly primalType: PrimalType;
120
+ /** Semantic types with an intrinsic array container, such as tag. */
121
+ readonly isArray?: true;
122
+ /** Normalize a complete physical value before per-element result hydration. */
123
+ readonly normalizeResult?: (value: unknown, context: SemanticTypeResultContext) => unknown;
84
124
  readonly validateProperty?: (property: ResolvedSemanticProperty) => void;
85
125
  /** Whether this semantic property requires one evaluation per time bucket. */
86
126
  readonly requiresPerPeriodEvaluation?: (context: SemanticPeriodEvaluationContext) => boolean;
@@ -1,6 +1,3 @@
1
- import type { ResolvedSemanticProperty, TemporalSemantics } from './types';
1
+ import type { ResolvedSemanticProperty } from './types';
2
2
  /** Validates invariants that require the complete set of resolved Properties. */
3
- export declare const validateResolvedSchema: (properties: readonly ResolvedSemanticProperty[], options?: {
4
- readonly temporalSemantics?: TemporalSemantics;
5
- readonly schemaId?: string;
6
- }) => void;
3
+ export declare const validateResolvedSchema: (properties: readonly ResolvedSemanticProperty[]) => void;