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

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 (46) hide show
  1. package/README.md +26 -10
  2. package/dist/cache/redis-query-cache.esm.js +1 -0
  3. package/dist/cache/redis-query-cache.js +1 -1
  4. package/dist/compiler/compile-cte.d.ts +1 -1
  5. package/dist/errors.d.ts +2 -1
  6. package/dist/executor/components.d.ts +8 -3
  7. package/dist/executor/fetch-entities.d.ts +2 -0
  8. package/dist/executor/types.d.ts +9 -3
  9. package/dist/i18n/index.d.ts +4 -0
  10. package/dist/i18n/locales/en-US.d.ts +2 -0
  11. package/dist/i18n/locales/zh-CN.d.ts +2 -0
  12. package/dist/i18n/registry.d.ts +13 -0
  13. package/dist/i18n/types.d.ts +9 -0
  14. package/dist/index.d.ts +4 -2
  15. package/dist/normalizer/core.d.ts +5 -0
  16. package/dist/normalizer/default-pred-name.d.ts +2 -0
  17. package/dist/normalizer/index.d.ts +1 -0
  18. package/dist/normalizer/property-resolve.d.ts +1 -0
  19. package/dist/operators/builtins/period-name.d.ts +2 -1
  20. package/dist/operators/index.d.ts +1 -0
  21. package/dist/operators/registry.d.ts +1 -1
  22. package/dist/operators/resolve.d.ts +3 -0
  23. package/dist/operators/types.d.ts +17 -8
  24. package/dist/physical/clickhouse-provider.d.ts +8 -0
  25. package/dist/physical/provider.d.ts +4 -0
  26. package/dist/planner/index.d.ts +1 -1
  27. package/dist/planner/semantics/annual-periods.d.ts +11 -0
  28. package/dist/planner/semantics/index.d.ts +1 -0
  29. package/dist/planner/semantics/lifecycle/classification.d.ts +5 -7
  30. package/dist/planner/semantics/lifecycle/query-policy.d.ts +2 -3
  31. package/dist/planner/semantics/lifecycle/rule.d.ts +2 -2
  32. package/dist/planner/semantics/observation/index.d.ts +2 -0
  33. package/dist/planner/semantics/observation/periods.d.ts +19 -0
  34. package/dist/planner/semantics/validity/classification.d.ts +14 -0
  35. package/dist/planner/semantics/validity/index.d.ts +6 -0
  36. package/dist/planner/semantics/validity/periods.d.ts +16 -0
  37. package/dist/planner/semantics/validity/query-policy.d.ts +4 -0
  38. package/dist/planner/semantics/validity/rule.d.ts +2 -0
  39. package/dist/planner/types.d.ts +31 -0
  40. package/dist/schema/dependent-projection.d.ts +8 -0
  41. package/dist/schema/index.d.ts +1 -0
  42. package/dist/semantic-types/index.d.ts +1 -1
  43. package/dist/semantic-types/types.d.ts +8 -1
  44. package/dist/semanticdb.esm.js +3 -0
  45. package/dist/semanticdb.js +3 -3
  46. package/package.json +2 -12
@@ -120,6 +120,9 @@ export interface JoinPlan {
120
120
  readonly targetSql?: string;
121
121
  readonly targetTimestampColumn?: string;
122
122
  readonly targetTimestampGranularity?: TimeGranularity;
123
+ /** Half-open validity interval columns on a versioned entity target. */
124
+ readonly targetValidityStartColumn?: string;
125
+ readonly targetValidityEndColumn?: string;
123
126
  readonly sourceArrayExpansionPath?: string;
124
127
  }
125
128
  export interface ArrayExpansionPlan {
@@ -144,6 +147,30 @@ export interface GroupLimitPlan {
144
147
  readonly partitionBy: readonly string[];
145
148
  readonly orderBy: readonly OrderPlan[];
146
149
  }
150
+ export interface ValidityPeriodPlan {
151
+ readonly alias: string;
152
+ readonly labelColumn: string;
153
+ readonly asOfColumn: string;
154
+ readonly sourceAlias: string;
155
+ readonly startColumn: string;
156
+ readonly endColumn: string;
157
+ readonly periods: readonly {
158
+ readonly label: string;
159
+ readonly asOf: string;
160
+ }[];
161
+ }
162
+ export interface ObservationPeriodPlan {
163
+ readonly alias: string;
164
+ readonly labelColumn: string;
165
+ readonly asOfColumn: string;
166
+ readonly sourceAlias: string;
167
+ readonly lookupAlias: string;
168
+ readonly timestampColumn: string;
169
+ readonly periods: readonly {
170
+ readonly label: string;
171
+ readonly asOf: string;
172
+ }[];
173
+ }
147
174
  export type RowIdentityPlan = {
148
175
  readonly kind: 'group';
149
176
  readonly names: readonly string[];
@@ -176,6 +203,10 @@ export interface LogicalPlan {
176
203
  readonly fieldReferences?: Readonly<Record<string, FieldReferencePlan>>;
177
204
  readonly joins?: readonly JoinPlan[];
178
205
  readonly arrayExpansions?: readonly ArrayExpansionPlan[];
206
+ /** Period spine used to evaluate a valid-time entity once per requested period. */
207
+ readonly validityPeriods?: ValidityPeriodPlan;
208
+ /** Period spine used to select the latest snapshot at each requested boundary. */
209
+ readonly observationPeriods?: ObservationPeriodPlan;
179
210
  readonly projections: readonly ProjectionPlan[];
180
211
  readonly columnProperties?: readonly ResultProperty[];
181
212
  readonly groupBy: readonly ProjectionPlan[];
@@ -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,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,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, TimeWatermarkPolicy, } from './types';
7
+ export type { ComparableCategoryDefinition, PropertyHierarchyDefinition, 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;
@@ -17,6 +17,11 @@ export interface ComparableCategoryDefinition {
17
17
  readonly values: readonly string[];
18
18
  readonly direction: 1 | -1;
19
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
+ }
20
25
  /** Extension point for plugin-owned Schema draft metadata. */
21
26
  export interface SemanticSchemaMetadata {
22
27
  }
@@ -26,7 +31,7 @@ export interface ResolvedSemanticSchemaMetadata {
26
31
  /** Extension point for legacy plugin metadata removed from the canonical Schema shape. */
27
32
  export interface LegacySemanticSchemaMetadata {
28
33
  }
29
- 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'> {
34
+ 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'> {
30
35
  readonly id?: string;
31
36
  readonly type: string;
32
37
  readonly primal_type?: PrimalType;
@@ -39,6 +44,8 @@ export interface SemanticPropertyDraft extends Omit<PropertyTypeDraft, '_id' | '
39
44
  readonly udf?: PropertySqlDefinition;
40
45
  readonly comparable?: ComparableCategoryDefinition;
41
46
  readonly timeWatermark?: TimeWatermarkPolicy;
47
+ /** Same-Schema drill relationship. `up` identifies the single-valued parent Property. */
48
+ readonly hierarchy?: PropertyHierarchyDefinition;
42
49
  }
43
50
  export interface ResolvedSemanticProperty extends Omit<SemanticPropertyDraft, 'id' | 'primal_type' | 'isArray' | 'is_dynamic'> {
44
51
  readonly id: string;