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

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 (180) hide show
  1. package/README.md +24 -17
  2. package/dist/cache/redis-query-cache.js +1 -1
  3. package/dist/calendar/constants.d.ts +2 -2
  4. package/dist/compatibility/index.d.ts +1 -1
  5. package/dist/compatibility/logicform.d.ts +1 -7
  6. package/dist/compiler/compile-cte.d.ts +17 -2
  7. package/dist/compiler/index.d.ts +2 -1
  8. package/dist/compiler/shorten-sql.d.ts +1 -1
  9. package/dist/errors.d.ts +2 -0
  10. package/dist/executor/fetch-entities.d.ts +2 -1
  11. package/dist/executor/row-identity.d.ts +2 -1
  12. package/dist/executor/types.d.ts +14 -11
  13. package/dist/index.d.ts +5 -7
  14. package/dist/logicform-types.d.ts +11 -12
  15. package/dist/normalizer/core.d.ts +2 -2
  16. package/dist/normalizer/property-resolve.d.ts +5 -0
  17. package/dist/operators/builtins/constant.d.ts +2 -0
  18. package/dist/operators/builtins/period-value.d.ts +2 -0
  19. package/dist/operators/builtins/scalar-extremum.d.ts +3 -0
  20. package/dist/operators/index.d.ts +1 -1
  21. package/dist/operators/types.d.ts +25 -21
  22. package/dist/physical/clickhouse-provider.d.ts +1 -0
  23. package/dist/physical/mysql-protocol-provider.d.ts +2 -0
  24. package/dist/physical/oracle-provider.d.ts +1 -0
  25. package/dist/physical/postgresql-provider.d.ts +1 -0
  26. package/dist/physical/provider.d.ts +2 -0
  27. package/dist/physical/snowflake-provider.d.ts +1 -0
  28. package/dist/planner/semantics/observation/operator-policy.d.ts +1 -1
  29. package/dist/planner/semantics/observation/types.d.ts +1 -1
  30. package/dist/planner/types.d.ts +10 -2
  31. package/dist/plugins/hierarchy/types.d.ts +3 -2
  32. package/dist/schema/entity-identity.d.ts +1 -1
  33. package/dist/schema-mappings/index.d.ts +3 -1
  34. package/dist/schema-mappings/types.d.ts +9 -8
  35. package/dist/schema-mappings/yiask.d.ts +22 -0
  36. package/dist/semantic-types/index.d.ts +1 -1
  37. package/dist/semantic-types/types.d.ts +14 -2
  38. package/dist/semanticdb.js +3 -0
  39. package/package.json +4 -3
  40. package/dist/cache/expiry.js +0 -1
  41. package/dist/cache/identity.js +0 -1
  42. package/dist/cache/serialization.js +0 -1
  43. package/dist/calendar/constants.js +0 -1
  44. package/dist/calendar/provider-relation-store.js +0 -1
  45. package/dist/calendar/resolver.js +0 -1
  46. package/dist/calendar/system-schemas.js +0 -1
  47. package/dist/compatibility/logicform.js +0 -1
  48. package/dist/compiler/compile-cte.js +0 -1
  49. package/dist/compiler/compile-plan.js +0 -1
  50. package/dist/compiler/shorten-sql.js +0 -2
  51. package/dist/custom-functions/custom-functions.d.ts +0 -6
  52. package/dist/custom-functions/custom-functions.js +0 -1
  53. package/dist/custom-functions/index.d.ts +0 -3
  54. package/dist/custom-functions/operator-adapter.d.ts +0 -12
  55. package/dist/custom-functions/operator-adapter.js +0 -1
  56. package/dist/custom-functions/types.d.ts +0 -62
  57. package/dist/errors.js +0 -1
  58. package/dist/executor/compatibility.js +0 -1
  59. package/dist/executor/components.js +0 -1
  60. package/dist/executor/connection-registry.js +0 -1
  61. package/dist/executor/evaluate.js +0 -1
  62. package/dist/executor/execute-query.js +0 -1
  63. package/dist/executor/execute.js +0 -1
  64. package/dist/executor/fetch-entities.js +0 -1
  65. package/dist/executor/result-hydrator/entity-loader.js +0 -1
  66. package/dist/executor/result-hydrator/format-values.js +0 -1
  67. package/dist/executor/result-hydrator/hydrate-result.js +0 -1
  68. package/dist/executor/result-hydrator/missing-entity.js +0 -1
  69. package/dist/executor/result-hydrator/populate-entities.js +0 -1
  70. package/dist/executor/row-identity.js +0 -1
  71. package/dist/index.js +0 -1
  72. package/dist/logicform-types.js +0 -1
  73. package/dist/normalizer/core.js +0 -1
  74. package/dist/normalizer/default-pred-name.js +0 -1
  75. package/dist/normalizer/entity-id.js +0 -1
  76. package/dist/normalizer/groupby.js +0 -1
  77. package/dist/normalizer/normalize-logicform.js +0 -1
  78. package/dist/normalizer/pagination.js +0 -1
  79. package/dist/normalizer/pred-query-name.js +0 -1
  80. package/dist/normalizer/preds.js +0 -1
  81. package/dist/normalizer/query.js +0 -1
  82. package/dist/normalizer/version.js +0 -1
  83. package/dist/operators/builtins/abs.js +0 -1
  84. package/dist/operators/builtins/accumulate.js +0 -1
  85. package/dist/operators/builtins/add.js +0 -1
  86. package/dist/operators/builtins/arithmetic.js +0 -1
  87. package/dist/operators/builtins/average-per-period.js +0 -1
  88. package/dist/operators/builtins/avg.js +0 -1
  89. package/dist/operators/builtins/case.js +0 -1
  90. package/dist/operators/builtins/concat.js +0 -1
  91. package/dist/operators/builtins/count-distinct.js +0 -1
  92. package/dist/operators/builtins/count.js +0 -1
  93. package/dist/operators/builtins/date-bucket.js +0 -1
  94. package/dist/operators/builtins/divide.js +0 -1
  95. package/dist/operators/builtins/index.js +0 -1
  96. package/dist/operators/builtins/max.js +0 -1
  97. package/dist/operators/builtins/min.js +0 -1
  98. package/dist/operators/builtins/multiply.js +0 -1
  99. package/dist/operators/builtins/newly.js +0 -1
  100. package/dist/operators/builtins/period-boundary.js +0 -1
  101. package/dist/operators/builtins/period-difference.js +0 -1
  102. package/dist/operators/builtins/period-growth.js +0 -1
  103. package/dist/operators/builtins/period-name.js +0 -1
  104. package/dist/operators/builtins/period-shift.js +0 -1
  105. package/dist/operators/builtins/rank.js +0 -1
  106. package/dist/operators/builtins/row-number.js +0 -1
  107. package/dist/operators/builtins/share-of-total.js +0 -1
  108. package/dist/operators/builtins/sql.js +0 -1
  109. package/dist/operators/builtins/substring.js +0 -1
  110. package/dist/operators/builtins/subtract.js +0 -1
  111. package/dist/operators/builtins/sum.js +0 -1
  112. package/dist/operators/builtins/time-range.js +0 -1
  113. package/dist/operators/groupby.js +0 -1
  114. package/dist/operators/index.js +0 -1
  115. package/dist/operators/registry.js +0 -1
  116. package/dist/operators/sql-expression.js +0 -1
  117. package/dist/permissions/permissions.js +0 -1
  118. package/dist/physical/clickhouse-provider.js +0 -1
  119. package/dist/physical/connection.js +0 -1
  120. package/dist/physical/display-query.js +0 -1
  121. package/dist/physical/doris-provider.js +0 -1
  122. package/dist/physical/mysql-compatible-sql.js +0 -1
  123. package/dist/physical/mysql-protocol-provider.js +0 -1
  124. package/dist/physical/mysql-provider.js +0 -1
  125. package/dist/physical/oracle-provider.js +0 -1
  126. package/dist/physical/postgresql-provider.js +0 -1
  127. package/dist/physical/snowflake-provider.js +0 -1
  128. package/dist/physical/starrocks-provider.js +0 -1
  129. package/dist/planner/build-lineage.js +0 -1
  130. package/dist/planner/create-logical-plan.js +0 -1
  131. package/dist/planner/select-schema-mapping.js +0 -1
  132. package/dist/planner/semantics/lifecycle/classification.js +0 -1
  133. package/dist/planner/semantics/lifecycle/query-policy.js +0 -1
  134. package/dist/planner/semantics/lifecycle/rule.js +0 -1
  135. package/dist/planner/semantics/observation/classification.js +0 -1
  136. package/dist/planner/semantics/observation/operator-policy.js +0 -1
  137. package/dist/planner/semantics/observation/rule.js +0 -1
  138. package/dist/planner/semantics/registry-defaults.js +0 -1
  139. package/dist/planner/semantics/registry.js +0 -1
  140. package/dist/planner/types.js +0 -1
  141. package/dist/plugins/hierarchy/compatibility.js +0 -1
  142. package/dist/plugins/hierarchy/entity-identity.js +0 -1
  143. package/dist/plugins/hierarchy/index.js +0 -1
  144. package/dist/plugins/hierarchy/operator.js +0 -1
  145. package/dist/plugins/hierarchy/resolve-schema.js +0 -1
  146. package/dist/plugins/index.js +0 -1
  147. package/dist/schema/entity-identity.js +0 -1
  148. package/dist/schema/resolve-property-path.js +0 -1
  149. package/dist/schema/schema-registry.js +0 -1
  150. package/dist/schema-mappings/freshness.js +0 -1
  151. package/dist/schema-mappings/registry.js +0 -1
  152. package/dist/semantic-types/builtins/boolean.js +0 -1
  153. package/dist/semantic-types/builtins/category.js +0 -1
  154. package/dist/semantic-types/builtins/currency.js +0 -1
  155. package/dist/semantic-types/builtins/date.js +0 -1
  156. package/dist/semantic-types/builtins/duration.js +0 -1
  157. package/dist/semantic-types/builtins/end-date.js +0 -1
  158. package/dist/semantic-types/builtins/entity.js +0 -1
  159. package/dist/semantic-types/builtins/file.js +0 -1
  160. package/dist/semantic-types/builtins/human-name.js +0 -1
  161. package/dist/semantic-types/builtins/id.js +0 -1
  162. package/dist/semantic-types/builtins/image.js +0 -1
  163. package/dist/semantic-types/builtins/index.js +0 -1
  164. package/dist/semantic-types/builtins/int.js +0 -1
  165. package/dist/semantic-types/builtins/name.js +0 -1
  166. package/dist/semantic-types/builtins/number.js +0 -1
  167. package/dist/semantic-types/builtins/object.js +0 -1
  168. package/dist/semantic-types/builtins/order.js +0 -1
  169. package/dist/semantic-types/builtins/percentage.js +0 -1
  170. package/dist/semantic-types/builtins/start-date.js +0 -1
  171. package/dist/semantic-types/builtins/string.js +0 -1
  172. package/dist/semantic-types/builtins/timestamp.js +0 -1
  173. package/dist/semantic-types/index.js +0 -1
  174. package/dist/semantic-types/primal-types/date.js +0 -1
  175. package/dist/semantic-types/primal-types/index.js +0 -1
  176. package/dist/semantic-types/registry.js +0 -1
  177. package/dist/semantic-types/resolve-schema.js +0 -1
  178. package/dist/semantic-types/validate-resolved-schema.js +0 -1
  179. package/dist/utils/clone.js +0 -1
  180. /package/dist/operators/builtins/{period-boundary.d.ts → period-boundary-expression.d.ts} +0 -0
@@ -39,6 +39,7 @@ export declare class OracleProvider implements CoreComputeProvider {
39
39
  dateBucket(expression: string, level: string): string;
40
40
  dateShift(expression: string, granularity: string, offset: number): string;
41
41
  aggregateFunction(name: string, expression?: string): string;
42
+ stringify(expression: string): string;
42
43
  concat(expressions: readonly string[]): string;
43
44
  substring(expression: string, start: number, length: number): string;
44
45
  regex(expression: string, pattern: string, options?: string): string;
@@ -24,6 +24,7 @@ export declare class PostgreSQLProvider implements CoreComputeProvider {
24
24
  dateBucket(expression: string, level: string): string;
25
25
  dateShift(expression: string, granularity: string, offset: number): string;
26
26
  aggregateFunction(name: string, expression?: string): string;
27
+ stringify(expression: string): string;
27
28
  concat(expressions: readonly string[]): string;
28
29
  substring(expression: string, start: number, length: number): string;
29
30
  regex(expression: string, pattern: string, options?: string): string;
@@ -13,7 +13,9 @@ export interface SqlRenderCapabilities {
13
13
  paginate(sql: string, pageSize: number, offset: number): string;
14
14
  dateBucket(expression: string, level: string): string;
15
15
  dateShift(expression: string, granularity: string, offset: number): string;
16
+ datePeriodBoundary?(expression: string, granularity: string, boundary: 'start' | 'end'): string;
16
17
  aggregateFunction(name: string, expression?: string): string;
18
+ stringify(expression: string): string;
17
19
  concat(expressions: readonly string[]): string;
18
20
  substring(expression: string, start: number, length: number): string;
19
21
  regex(expression: string, pattern: string, options?: string): string;
@@ -31,6 +31,7 @@ export declare class SnowflakeProvider implements CoreComputeProvider {
31
31
  dateBucket(expression: string, level: string): string;
32
32
  dateShift(expression: string, granularity: string, offset: number): string;
33
33
  aggregateFunction(name: string, expression?: string): string;
34
+ stringify(expression: string): string;
34
35
  concat(expressions: readonly string[]): string;
35
36
  substring(expression: string, start: number, length: number): string;
36
37
  regex(expression: string, pattern: string, options?: string): string;
@@ -1,6 +1,6 @@
1
1
  import type { PredItemType } from '../../../logicform-types';
2
2
  import type { OperatorDefinition } from '../../../operators/index';
3
- declare const periodBoundaryOperator = "$periodBoundary";
3
+ declare const periodBoundaryOperator = "$periodValue";
4
4
  export interface ObservationOperatorPolicy {
5
5
  readonly operator: typeof periodBoundaryOperator;
6
6
  readonly boundary: 'start' | 'end';
@@ -1,3 +1,3 @@
1
1
  import type { ResultPropertyTemporalMetadata } from '../../../operators/index';
2
2
  export type ObservationTemporalMetadata = ResultPropertyTemporalMetadata;
3
- export type ObservationOperator = '$periodBoundary';
3
+ export type ObservationOperator = '$periodValue';
@@ -1,4 +1,5 @@
1
1
  import type { CoreComputeProvider } from '../physical/index';
2
+ import type { LogicformType } from '../logicform-types';
2
3
  import type { ResultProperty } from '../operators/index';
3
4
  import type { ComparableCategoryDefinition, TimeGranularity } from '../semantic-types/index';
4
5
  export interface FieldReferencePlan {
@@ -10,6 +11,8 @@ export interface FieldReferencePlan {
10
11
  readonly qualifier: string;
11
12
  readonly sql?: string;
12
13
  readonly timestampColumn?: string;
14
+ /** Source alias that supplies $TS when it differs from the Property's Schema. */
15
+ readonly timestampQualifier?: string;
13
16
  readonly isArray?: boolean;
14
17
  readonly comparable?: ComparableCategoryDefinition;
15
18
  }
@@ -55,6 +58,7 @@ export type Expression = {
55
58
  readonly sql: string;
56
59
  readonly qualifier?: string;
57
60
  readonly timestampColumn?: string;
61
+ readonly timestampQualifier?: string;
58
62
  } | {
59
63
  readonly kind: 'operator';
60
64
  readonly operator: string;
@@ -63,7 +67,7 @@ export type Expression = {
63
67
  readonly qualifier?: string;
64
68
  readonly schemaId?: string;
65
69
  readonly input?: Expression;
66
- readonly components?: readonly Expression[];
70
+ readonly inputs?: readonly Expression[];
67
71
  readonly args: Readonly<Record<string, unknown>>;
68
72
  readonly query?: Readonly<Record<string, unknown>>;
69
73
  } | {
@@ -143,6 +147,8 @@ export interface GroupLimitPlan {
143
147
  export type RowIdentityPlan = {
144
148
  readonly kind: 'group';
145
149
  readonly names: readonly string[];
150
+ readonly separator: string;
151
+ readonly nullLabel: string;
146
152
  } | {
147
153
  readonly kind: 'property';
148
154
  readonly column: string;
@@ -160,9 +166,11 @@ export interface LogicalPlan {
160
166
  /** Physical mapping selected by the Planner for this logical Schema. */
161
167
  readonly mappingId?: string;
162
168
  /** Child relations combined by their compatible group identity. */
163
- readonly composition?: readonly LogicalPlan[];
169
+ readonly subplans?: readonly LogicalPlan[];
164
170
  /** Optional query plan compiled as the derived-table source of this plan. */
165
171
  readonly sourcePlan?: LogicalPlan;
172
+ /** Normalized LogicForm corresponding to sourcePlan when generated rewrites need execution. */
173
+ readonly sourceLogicform?: LogicformType;
166
174
  readonly sourceAlias?: string;
167
175
  readonly fields: Readonly<Record<string, string>>;
168
176
  readonly fieldReferences?: Readonly<Record<string, FieldReferencePlan>>;
@@ -1,11 +1,12 @@
1
1
  export interface HierarchyLevelDefinition {
2
2
  readonly name: string;
3
- readonly synonyms?: readonly string[];
3
+ readonly syno?: readonly string[];
4
4
  readonly codeLength: number;
5
5
  }
6
6
  export interface HierarchyDefinition {
7
7
  /** Property that physically stores the complete hierarchy code. */
8
- readonly property: string;
8
+ /** Property storing the complete hierarchy code. Defaults to the Schema's only ID Property. */
9
+ readonly property?: string;
9
10
  /** Compact codes stop at their level; zero-padded codes fill remaining segments with zeroes. */
10
11
  readonly storage?: 'compact' | 'zero-padded';
11
12
  readonly levels: readonly HierarchyLevelDefinition[];
@@ -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,6 @@
1
1
  export { SchemaMappingRegistry } from './registry';
2
2
  export { parseDailyExpireAt } from './freshness';
3
- export type { SchemaMappingDefinition, SourceFreshnessPolicy } from './types';
3
+ export type { SchemaMappingDefinition, SchemaMappingItem, SourceFreshnessPolicy } from './types';
4
4
  export type { SchemaMappingPredDefinition, SchemaMappingPredMatch, } from './types';
5
+ export { fromYiAskSchemaMapping } from './yiask';
6
+ export type { YiAskSchemaMappingItem, YiAskSchemaMappingRecord } from './yiask';
@@ -1,4 +1,4 @@
1
- import type { QueryType } from '../logicform-types';
1
+ import type { PredItemType, QueryType } from '../logicform-types';
2
2
  export type SourceFreshnessPolicy = {
3
3
  readonly mode: 'ttl';
4
4
  readonly ttlSeconds: number;
@@ -22,6 +22,12 @@ export interface SchemaMappingPredDefinition {
22
22
  /** Physical column used as the matched PredItem's operator input. */
23
23
  readonly column: string;
24
24
  }
25
+ export interface SchemaMappingItem {
26
+ readonly sourceColumn?: string;
27
+ readonly mappingType?: 'property' | 'predItem' | 'ignored';
28
+ readonly propertyTarget?: readonly string[];
29
+ readonly predItem?: PredItemType;
30
+ }
25
31
  export interface SchemaMappingDefinition {
26
32
  /** Stable identity when a Schema has multiple physical mappings. */
27
33
  readonly id?: string;
@@ -32,13 +38,8 @@ export interface SchemaMappingDefinition {
32
38
  readonly source: string;
33
39
  /** Optional trusted query compiled as a derived-table source instead of reading source directly. */
34
40
  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[];
41
+ /** Unified logical-to-physical mappings for properties and conditional PredItems. */
42
+ readonly mappings?: readonly SchemaMappingItem[];
42
43
  /** Higher values win when multiple candidates cover the same LogicForm. */
43
44
  readonly priority?: number;
44
45
  /** Missing means queries depending on this physical source are not cached. */
@@ -0,0 +1,22 @@
1
+ import type { PredItemType } from '../logicform-types';
2
+ import type { SchemaMappingDefinition } from './types';
3
+ export interface YiAskSchemaMappingItem {
4
+ readonly sourceColumn?: string;
5
+ readonly mappingType?: 'property' | 'predItem' | 'ignored';
6
+ readonly propertyTarget?: readonly string[];
7
+ readonly predItem?: PredItemType;
8
+ }
9
+ export interface YiAskSchemaMappingRecord {
10
+ readonly id: string | number;
11
+ readonly schemaSid: string;
12
+ readonly datasourceSid: string;
13
+ readonly sourceMode?: 'table' | 'demo';
14
+ readonly tablePath?: string;
15
+ readonly sourceSql?: string;
16
+ readonly physicalDatabase?: string;
17
+ readonly physicalSchema?: string;
18
+ readonly physicalTable?: string;
19
+ readonly mappings: readonly YiAskSchemaMappingItem[];
20
+ readonly enabled?: boolean;
21
+ }
22
+ export declare const fromYiAskSchemaMapping: (record: YiAskSchemaMappingRecord) => SchemaMappingDefinition;
@@ -4,6 +4,6 @@ export { SemanticTypeRegistry } from './registry';
4
4
  export { resolveSchema } from './resolve-schema';
5
5
  export { validateResolvedSchema } from './validate-resolved-schema';
6
6
  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';
7
+ export type { ComparableCategoryDefinition, PropertySqlDefinition, PrimalType, ResolvedSemanticProperty, ResolvedSemanticSchema, LegacySemanticSchemaMetadata, ResolvedSemanticSchemaMetadata, SemanticSchemaMetadata, SemanticTypeNormalizeContext, SemanticPeriodEvaluationContext, SemanticTypeResultContext, SemanticTypeResultProperty, SemanticPropertyDraft, SemanticSchemaDraft, SemanticTypeDefinition, TimeGranularity, TemporalSemantics, TimeWatermarkPolicy, } from './types';
8
8
  export type { HierarchyDefinition, HierarchyLevelDefinition, ResolvedHierarchyDefinition, } from '../plugins/hierarchy/index';
9
9
  export declare const createSemanticTypeRegistry: () => SemanticTypeRegistry;
@@ -1,8 +1,15 @@
1
1
  import type { PropertyTypeDraft, SchemaTypeDraft } from 'semanticdb-core';
2
2
  import type { LogicformType, PredItemType } from '../logicform-types';
3
- export type PrimalType = 'string' | 'number' | 'boolean' | 'date' | 'object';
3
+ /** Canonical primitive types use `entity`; `object` remains a legacy input alias. */
4
+ export type PrimalType = 'string' | 'number' | 'boolean' | 'date' | 'entity' | 'object';
4
5
  export type TimeGranularity = 'second' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'quarter' | 'year';
5
6
  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
  }
@@ -25,10 +32,13 @@ export interface SemanticPropertyDraft extends Omit<PropertyTypeDraft, '_id' | '
25
32
  readonly primal_type?: PrimalType;
26
33
  readonly isArray?: boolean;
27
34
  readonly granularity?: TimeGranularity;
35
+ /** Default hierarchy level when this Property references a hierarchy Entity. */
36
+ readonly level?: string;
28
37
  /** Derived during schema resolution from whether the property has udf.sql. */
29
38
  readonly is_dynamic?: boolean;
30
39
  readonly udf?: PropertySqlDefinition;
31
40
  readonly comparable?: ComparableCategoryDefinition;
41
+ readonly timeWatermark?: TimeWatermarkPolicy;
32
42
  }
33
43
  export interface ResolvedSemanticProperty extends Omit<SemanticPropertyDraft, 'id' | 'primal_type' | 'isArray' | 'is_dynamic'> {
34
44
  readonly id: string;
@@ -41,6 +51,7 @@ export interface SemanticSchemaDraft extends Omit<SchemaTypeDraft, '_id' | 'id'
41
51
  readonly id: string;
42
52
  readonly properties: readonly SemanticPropertyDraft[];
43
53
  readonly temporalSemantics?: TemporalSemantics;
54
+ readonly timeWatermark?: TimeWatermarkPolicy;
44
55
  /** Property that stores the parent node id for recursive tree queries. */
45
56
  readonly parentProperty?: string;
46
57
  }
@@ -49,6 +60,7 @@ export interface ResolvedSemanticSchema extends Omit<SchemaTypeDraft, '_id' | 'i
49
60
  readonly id: string;
50
61
  readonly properties: readonly ResolvedSemanticProperty[];
51
62
  readonly temporalSemantics?: TemporalSemantics;
63
+ readonly timeWatermark?: TimeWatermarkPolicy;
52
64
  /** Canonical logical name of the parent Property used by recursive tree queries. */
53
65
  readonly parentProperty?: string;
54
66
  }
@@ -56,7 +68,7 @@ export interface SemanticTypeNormalizeContext {
56
68
  readonly schema: ResolvedSemanticSchema;
57
69
  readonly property: ResolvedSemanticProperty;
58
70
  readonly now: Date;
59
- readonly requestLatestDataDate: () => Promise<Date | undefined>;
71
+ readonly requestTimeWatermark: (requestedUpperBound: Date) => Promise<Date | undefined>;
60
72
  }
61
73
  /** Context used when deciding whether a value must be evaluated per time period. */
62
74
  export interface SemanticPeriodEvaluationContext {