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.
- package/README.md +346 -46
- package/dist/cache/index.d.ts +2 -1
- package/dist/cache/manager.d.ts +5 -0
- package/dist/cache/registry.d.ts +14 -0
- package/dist/cache/types.d.ts +17 -0
- package/dist/close.d.ts +1 -0
- package/dist/compatibility/index.d.ts +2 -2
- package/dist/compatibility/logicform.d.ts +1 -7
- package/dist/compiler/compile-cte.d.ts +17 -2
- package/dist/compiler/index.d.ts +2 -1
- package/dist/compiler/shorten-sql.d.ts +1 -1
- package/dist/errors.d.ts +3 -0
- package/dist/executor/compatibility.d.ts +13 -0
- package/dist/executor/components.d.ts +8 -3
- package/dist/executor/connection-registry.d.ts +1 -12
- package/dist/executor/execute-query.d.ts +8 -2
- package/dist/executor/federated-execution.d.ts +38 -0
- package/dist/executor/fetch-entities.d.ts +7 -1
- package/dist/executor/index.d.ts +1 -1
- package/dist/executor/result-hydrator/types.d.ts +2 -0
- package/dist/executor/row-identity.d.ts +2 -1
- package/dist/executor/total.d.ts +11 -0
- package/dist/executor/types.d.ts +64 -19
- package/dist/i18n/index.d.ts +4 -0
- package/dist/i18n/locales/en-US.d.ts +2 -0
- package/dist/i18n/locales/zh-CN.d.ts +2 -0
- package/dist/i18n/registry.d.ts +13 -0
- package/dist/i18n/types.d.ts +9 -0
- package/dist/index.d.ts +16 -16
- package/dist/logicform-types.d.ts +56 -36
- package/dist/normalizer/core.d.ts +16 -2
- package/dist/normalizer/default-pred-name.d.ts +2 -0
- package/dist/normalizer/index.d.ts +1 -0
- package/dist/normalizer/pred-expression.d.ts +6 -0
- package/dist/normalizer/property-resolve.d.ts +6 -0
- package/dist/operators/builtins/constant.d.ts +2 -0
- package/dist/operators/builtins/period-name.d.ts +2 -1
- package/dist/operators/builtins/period-value.d.ts +2 -0
- package/dist/operators/builtins/query-expression.d.ts +3 -0
- package/dist/operators/builtins/scalar-extremum.d.ts +3 -0
- package/dist/operators/index.d.ts +2 -1
- package/dist/operators/registry.d.ts +5 -3
- package/dist/operators/resolve.d.ts +3 -0
- package/dist/operators/types.d.ts +102 -49
- package/dist/physical/clickhouse-provider.d.ts +29 -2
- package/dist/physical/connection-registry.d.ts +13 -0
- package/dist/physical/connection.d.ts +57 -15
- package/dist/physical/dameng-provider.d.ts +66 -0
- package/dist/physical/databricks-provider.d.ts +88 -0
- package/dist/physical/db-connector.d.ts +23 -0
- package/dist/physical/display-query.d.ts +3 -0
- package/dist/physical/doris-provider.d.ts +7 -1
- package/dist/physical/duckdb-coordinator-provider.d.ts +37 -0
- package/dist/physical/gbase-provider.d.ts +11 -0
- package/dist/physical/index.d.ts +24 -9
- package/dist/physical/load-driver.d.ts +1 -0
- package/dist/physical/maxcompute-provider.d.ts +44 -0
- package/dist/physical/mysql-protocol-provider.d.ts +27 -7
- package/dist/physical/mysql-provider.d.ts +2 -1
- package/dist/physical/oracle-provider.d.ts +21 -4
- package/dist/physical/postgresql-provider.d.ts +25 -4
- package/dist/physical/provider.d.ts +66 -2
- package/dist/physical/snowflake-provider.d.ts +20 -3
- package/dist/physical/sqlserver-provider.d.ts +69 -0
- package/dist/physical/starrocks-provider.d.ts +7 -1
- package/dist/physical/table-description.d.ts +5 -0
- package/dist/physical/table-discovery.d.ts +10 -0
- package/dist/planner/build-lineage.d.ts +1 -1
- package/dist/planner/create-logical-plan.d.ts +7 -0
- package/dist/planner/index.d.ts +4 -2
- package/dist/planner/mapping-granularity.d.ts +7 -0
- package/dist/planner/rewrite-nested-components.d.ts +8 -0
- package/dist/planner/select-schema-mapping.d.ts +16 -2
- package/dist/planner/semantics/index.d.ts +0 -3
- package/dist/planner/semantics/periods.d.ts +13 -0
- package/dist/planner/semantics/registry-defaults.d.ts +2 -1
- package/dist/planner/semantics/registry.d.ts +2 -1
- package/dist/planner/types.d.ts +94 -14
- package/dist/plugins/hierarchy/index.d.ts +1 -1
- package/dist/plugins/hierarchy/mapping-granularity.d.ts +4 -0
- package/dist/plugins/hierarchy/types.d.ts +20 -2
- package/dist/plugins/index.d.ts +10 -1
- package/dist/{planner/semantics → plugins}/observation/classification.d.ts +1 -1
- package/dist/plugins/observation/index.d.ts +17 -0
- package/dist/{planner/semantics → plugins}/observation/operator-policy.d.ts +4 -5
- package/dist/plugins/observation/periods.d.ts +18 -0
- package/dist/{planner/semantics → plugins}/observation/rule.d.ts +1 -1
- package/dist/plugins/observation/types.d.ts +3 -0
- package/dist/plugins/property-hierarchy/index.d.ts +11 -0
- package/dist/plugins/recursive/index.d.ts +26 -0
- package/dist/plugins/temporal/index.d.ts +13 -0
- package/dist/plugins/types.d.ts +165 -1
- package/dist/plugins/validity/classification.d.ts +5 -0
- package/dist/plugins/validity/index.d.ts +15 -0
- package/dist/plugins/validity/periods.d.ts +15 -0
- package/dist/plugins/validity/query-policy.d.ts +3 -0
- package/dist/plugins/validity/rule.d.ts +2 -0
- package/dist/plugins/validity/semantic-types.d.ts +3 -0
- package/dist/schema/dependent-projection.d.ts +8 -0
- package/dist/schema/entity-identity.d.ts +1 -1
- package/dist/schema/index.d.ts +1 -0
- package/dist/schema-mappings/freshness.d.ts +1 -1
- package/dist/schema-mappings/granularity.d.ts +5 -0
- package/dist/schema-mappings/index.d.ts +4 -1
- package/dist/schema-mappings/registry.d.ts +6 -3
- package/dist/schema-mappings/types.d.ts +52 -8
- package/dist/schema-mappings/yiask.d.ts +26 -0
- package/dist/semantic-types/builtins/tag.d.ts +2 -0
- package/dist/semantic-types/index.d.ts +5 -3
- package/dist/semantic-types/registry.d.ts +2 -0
- package/dist/semantic-types/resolve-schema.d.ts +1 -1
- package/dist/semantic-types/types.d.ts +22 -10
- package/dist/semantic-types/validate-resolved-schema.d.ts +2 -5
- package/dist/semanticdb.esm.js +5 -0
- package/dist/semanticdb.js +5 -0
- package/package.json +49 -17
- package/dist/cache/expiry.js +0 -1
- package/dist/cache/identity.js +0 -1
- package/dist/cache/redis-query-cache.js +0 -1
- package/dist/cache/serialization.js +0 -1
- package/dist/calendar/constants.d.ts +0 -7
- package/dist/calendar/constants.js +0 -1
- package/dist/calendar/index.d.ts +0 -6
- package/dist/calendar/provider-relation-store.d.ts +0 -9
- package/dist/calendar/provider-relation-store.js +0 -1
- package/dist/calendar/resolver.d.ts +0 -10
- package/dist/calendar/resolver.js +0 -1
- package/dist/calendar/system-schemas.d.ts +0 -3
- package/dist/calendar/system-schemas.js +0 -1
- package/dist/calendar/types.d.ts +0 -31
- package/dist/compatibility/logicform.js +0 -1
- package/dist/compiler/compile-cte.js +0 -1
- package/dist/compiler/compile-plan.js +0 -1
- package/dist/compiler/shorten-sql.js +0 -2
- package/dist/custom-functions/custom-functions.d.ts +0 -6
- package/dist/custom-functions/custom-functions.js +0 -1
- package/dist/custom-functions/index.d.ts +0 -3
- package/dist/custom-functions/operator-adapter.d.ts +0 -12
- package/dist/custom-functions/operator-adapter.js +0 -1
- package/dist/custom-functions/types.d.ts +0 -62
- package/dist/errors.js +0 -1
- package/dist/executor/compatibility.js +0 -1
- package/dist/executor/components.js +0 -1
- package/dist/executor/connection-registry.js +0 -1
- package/dist/executor/evaluate.js +0 -1
- package/dist/executor/execute-query.js +0 -1
- package/dist/executor/execute.js +0 -1
- package/dist/executor/fetch-entities.js +0 -1
- package/dist/executor/result-hydrator/entity-loader.js +0 -1
- package/dist/executor/result-hydrator/format-values.js +0 -1
- package/dist/executor/result-hydrator/hydrate-result.js +0 -1
- package/dist/executor/result-hydrator/missing-entity.js +0 -1
- package/dist/executor/result-hydrator/populate-entities.js +0 -1
- package/dist/executor/row-identity.js +0 -1
- package/dist/index.js +0 -1
- package/dist/logicform-types.js +0 -1
- package/dist/normalizer/core.js +0 -1
- package/dist/normalizer/default-pred-name.js +0 -1
- package/dist/normalizer/entity-id.js +0 -1
- package/dist/normalizer/groupby.js +0 -1
- package/dist/normalizer/normalize-logicform.js +0 -1
- package/dist/normalizer/pagination.js +0 -1
- package/dist/normalizer/pred-query-name.js +0 -1
- package/dist/normalizer/preds.js +0 -1
- package/dist/normalizer/query.js +0 -1
- package/dist/normalizer/version.js +0 -1
- package/dist/operators/builtins/abs.js +0 -1
- package/dist/operators/builtins/accumulate.js +0 -1
- package/dist/operators/builtins/add.js +0 -1
- package/dist/operators/builtins/arithmetic.js +0 -1
- package/dist/operators/builtins/average-per-period.js +0 -1
- package/dist/operators/builtins/avg.js +0 -1
- package/dist/operators/builtins/case.js +0 -1
- package/dist/operators/builtins/concat.js +0 -1
- package/dist/operators/builtins/count-distinct.js +0 -1
- package/dist/operators/builtins/count.js +0 -1
- package/dist/operators/builtins/date-bucket.js +0 -1
- package/dist/operators/builtins/divide.js +0 -1
- package/dist/operators/builtins/index.js +0 -1
- package/dist/operators/builtins/max.js +0 -1
- package/dist/operators/builtins/min.js +0 -1
- package/dist/operators/builtins/multiply.js +0 -1
- package/dist/operators/builtins/newly.js +0 -1
- package/dist/operators/builtins/period-boundary.js +0 -1
- package/dist/operators/builtins/period-difference.js +0 -1
- package/dist/operators/builtins/period-growth.js +0 -1
- package/dist/operators/builtins/period-name.js +0 -1
- package/dist/operators/builtins/period-shift.js +0 -1
- package/dist/operators/builtins/rank.js +0 -1
- package/dist/operators/builtins/row-number.js +0 -1
- package/dist/operators/builtins/share-of-total.js +0 -1
- package/dist/operators/builtins/sql.js +0 -1
- package/dist/operators/builtins/substring.js +0 -1
- package/dist/operators/builtins/subtract.js +0 -1
- package/dist/operators/builtins/sum.js +0 -1
- package/dist/operators/builtins/time-range.js +0 -1
- package/dist/operators/groupby.js +0 -1
- package/dist/operators/index.js +0 -1
- package/dist/operators/registry.js +0 -1
- package/dist/operators/sql-expression.js +0 -1
- package/dist/permissions/permissions.js +0 -1
- package/dist/physical/clickhouse-provider.js +0 -1
- package/dist/physical/connection.js +0 -1
- package/dist/physical/display-query.js +0 -1
- package/dist/physical/doris-provider.js +0 -1
- package/dist/physical/mysql-compatible-sql.js +0 -1
- package/dist/physical/mysql-protocol-provider.js +0 -1
- package/dist/physical/mysql-provider.js +0 -1
- package/dist/physical/oracle-provider.js +0 -1
- package/dist/physical/postgresql-provider.js +0 -1
- package/dist/physical/snowflake-provider.js +0 -1
- package/dist/physical/starrocks-provider.js +0 -1
- package/dist/planner/build-lineage.js +0 -1
- package/dist/planner/create-logical-plan.js +0 -1
- package/dist/planner/select-schema-mapping.js +0 -1
- package/dist/planner/semantics/lifecycle/classification.d.ts +0 -7
- package/dist/planner/semantics/lifecycle/classification.js +0 -1
- package/dist/planner/semantics/lifecycle/index.d.ts +0 -3
- package/dist/planner/semantics/lifecycle/query-policy.d.ts +0 -3
- package/dist/planner/semantics/lifecycle/query-policy.js +0 -1
- package/dist/planner/semantics/lifecycle/rule.d.ts +0 -2
- package/dist/planner/semantics/lifecycle/rule.js +0 -1
- package/dist/planner/semantics/observation/classification.js +0 -1
- package/dist/planner/semantics/observation/index.d.ts +0 -4
- package/dist/planner/semantics/observation/operator-policy.js +0 -1
- package/dist/planner/semantics/observation/rule.js +0 -1
- package/dist/planner/semantics/observation/types.d.ts +0 -3
- package/dist/planner/semantics/registry-defaults.js +0 -1
- package/dist/planner/semantics/registry.js +0 -1
- package/dist/planner/types.js +0 -1
- package/dist/plugins/hierarchy/compatibility.js +0 -1
- package/dist/plugins/hierarchy/entity-identity.js +0 -1
- package/dist/plugins/hierarchy/index.js +0 -1
- package/dist/plugins/hierarchy/operator.js +0 -1
- package/dist/plugins/hierarchy/resolve-schema.js +0 -1
- package/dist/plugins/index.js +0 -1
- package/dist/schema/entity-identity.js +0 -1
- package/dist/schema/resolve-property-path.js +0 -1
- package/dist/schema/schema-registry.js +0 -1
- package/dist/schema-mappings/freshness.js +0 -1
- package/dist/schema-mappings/registry.js +0 -1
- package/dist/semantic-types/builtins/boolean.js +0 -1
- package/dist/semantic-types/builtins/category.js +0 -1
- package/dist/semantic-types/builtins/currency.js +0 -1
- package/dist/semantic-types/builtins/date.js +0 -1
- package/dist/semantic-types/builtins/duration.js +0 -1
- package/dist/semantic-types/builtins/end-date.d.ts +0 -2
- package/dist/semantic-types/builtins/end-date.js +0 -1
- package/dist/semantic-types/builtins/entity.js +0 -1
- package/dist/semantic-types/builtins/file.js +0 -1
- package/dist/semantic-types/builtins/human-name.js +0 -1
- package/dist/semantic-types/builtins/id.js +0 -1
- package/dist/semantic-types/builtins/image.js +0 -1
- package/dist/semantic-types/builtins/index.js +0 -1
- package/dist/semantic-types/builtins/int.js +0 -1
- package/dist/semantic-types/builtins/name.js +0 -1
- package/dist/semantic-types/builtins/number.js +0 -1
- package/dist/semantic-types/builtins/object.js +0 -1
- package/dist/semantic-types/builtins/order.js +0 -1
- package/dist/semantic-types/builtins/percentage.js +0 -1
- package/dist/semantic-types/builtins/start-date.d.ts +0 -2
- package/dist/semantic-types/builtins/start-date.js +0 -1
- package/dist/semantic-types/builtins/string.js +0 -1
- package/dist/semantic-types/builtins/timestamp.js +0 -1
- package/dist/semantic-types/index.js +0 -1
- package/dist/semantic-types/primal-types/date.js +0 -1
- package/dist/semantic-types/primal-types/index.js +0 -1
- package/dist/semantic-types/registry.js +0 -1
- package/dist/semantic-types/resolve-schema.js +0 -1
- package/dist/semantic-types/validate-resolved-schema.js +0 -1
- package/dist/utils/clone.js +0 -1
- /package/dist/operators/builtins/{period-boundary.d.ts → period-boundary-expression.d.ts} +0 -0
|
@@ -1,11 +1,22 @@
|
|
|
1
|
+
export interface SchemaMappingHierarchyGranularity {
|
|
2
|
+
readonly kind: 'hierarchy';
|
|
3
|
+
/** Physical level name or synonym declared by the referenced hierarchy Schema. */
|
|
4
|
+
readonly level: string;
|
|
5
|
+
}
|
|
6
|
+
declare module '../../schema-mappings/types' {
|
|
7
|
+
interface SchemaMappingGranularityExtensions {
|
|
8
|
+
readonly hierarchy: SchemaMappingHierarchyGranularity;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
1
11
|
export interface HierarchyLevelDefinition {
|
|
2
12
|
readonly name: string;
|
|
3
|
-
readonly
|
|
13
|
+
readonly syno?: readonly string[];
|
|
4
14
|
readonly codeLength: number;
|
|
5
15
|
}
|
|
6
16
|
export interface HierarchyDefinition {
|
|
7
17
|
/** Property that physically stores the complete hierarchy code. */
|
|
8
|
-
|
|
18
|
+
/** Property storing the complete hierarchy code. Defaults to the Schema's only ID Property. */
|
|
19
|
+
readonly property?: string;
|
|
9
20
|
/** Compact codes stop at their level; zero-padded codes fill remaining segments with zeroes. */
|
|
10
21
|
readonly storage?: 'compact' | 'zero-padded';
|
|
11
22
|
readonly levels: readonly HierarchyLevelDefinition[];
|
|
@@ -16,6 +27,13 @@ export interface ResolvedHierarchyDefinition extends Omit<HierarchyDefinition, '
|
|
|
16
27
|
readonly storage: 'compact' | 'zero-padded';
|
|
17
28
|
}
|
|
18
29
|
declare module '../../semantic-types/types' {
|
|
30
|
+
interface SemanticPropertyDraft {
|
|
31
|
+
/** Default hierarchy level for an Entity relation. */
|
|
32
|
+
readonly level?: string;
|
|
33
|
+
}
|
|
34
|
+
interface ResolvedSemanticProperty {
|
|
35
|
+
readonly level?: string;
|
|
36
|
+
}
|
|
19
37
|
interface SemanticSchemaMetadata {
|
|
20
38
|
readonly hierarchy?: HierarchyDefinition;
|
|
21
39
|
}
|
package/dist/plugins/index.d.ts
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
import type { SemanticDBPlugin } from './types';
|
|
2
|
-
|
|
2
|
+
import type { LogicformType } from '../logicform-types';
|
|
3
|
+
import type { ResolvedSemanticSchema } from '../semantic-types/index';
|
|
4
|
+
export type { LegacySchemaPluginContext, MappingGranularityContext, MappingGranularityPlugin, QueryOperatorAuthorizeContext, QueryOperatorCompileContext, QueryOperatorDefinition, QueryOperatorNormalizeContext, QueryOperatorPhysicalSource, QueryOperatorPlanContext, QueryOperatorPlanResult, PropertyMetadataPlugin, SchemaMetadataPlugin, SemanticDBPlugin, OutputHandlerContext, OutputHandlerDefinition, IntervalSemanticProperties, IntervalSemanticsDefinition, PlannerPeriodDefinition, PlannerPeriodEvaluation, RelationSemanticsDefinition, RelationTemporalPlan, TimeWatermarkLogicformContext, SchemaMappingPlugin, } from './types';
|
|
5
|
+
export type { SchemaMappingHierarchyGranularity } from './hierarchy/index';
|
|
6
|
+
export type { RecursiveQueryType } from './recursive/index';
|
|
3
7
|
/** Built-in capabilities are composed here; feature implementations live in their own folders. */
|
|
4
8
|
export declare const builtinPlugins: readonly SemanticDBPlugin[];
|
|
5
9
|
export declare const resolvePlugins: (plugins?: readonly SemanticDBPlugin[]) => readonly SemanticDBPlugin[];
|
|
10
|
+
export declare const findQueryOperator: (name: string, plugins?: readonly SemanticDBPlugin[]) => import("./types").QueryOperatorDefinition | undefined;
|
|
11
|
+
export declare const findOutputHandler: (type: string, plugins?: readonly SemanticDBPlugin[]) => import("./types").OutputHandlerDefinition | undefined;
|
|
12
|
+
export declare const resolveIntervalSemanticProperties: (schema: ResolvedSemanticSchema, plugins?: readonly SemanticDBPlugin[]) => import("./types").IntervalSemanticProperties | undefined;
|
|
13
|
+
export declare const resolveRelationTemporalPlan: (sourceSchema: ResolvedSemanticSchema, targetSchema: ResolvedSemanticSchema, plugins?: readonly SemanticDBPlugin[]) => import("./types").RelationTemporalPlan | undefined;
|
|
14
|
+
export declare const resolvePlannerPeriodEvaluation: (logicform: LogicformType, schema: ResolvedSemanticSchema, plugins?: readonly SemanticDBPlugin[]) => import("./types").PlannerPeriodEvaluation | undefined;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { ResolvedSemanticProperty, ResolvedSemanticSchema } from '
|
|
1
|
+
import type { ResolvedSemanticProperty, ResolvedSemanticSchema } from '../../semantic-types/index';
|
|
2
2
|
export declare const isObservationProperty: (property: ResolvedSemanticProperty | undefined, schema?: Pick<ResolvedSemanticSchema, "temporalSemantics">) => boolean;
|
|
3
3
|
export declare const observationProperties: (schema: Pick<ResolvedSemanticSchema, "properties" | "temporalSemantics">) => readonly ResolvedSemanticProperty[];
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { SemanticDBPlugin } from '../types';
|
|
2
|
+
type SchemaTemporalSemantics = 'normal' | 'snapshot';
|
|
3
|
+
export { isObservationProperty, observationProperties } from './classification';
|
|
4
|
+
export { resolveObservationOperatorPolicy, type ObservationOperatorPolicy, } from './operator-policy';
|
|
5
|
+
export { removeObservationTimeCondition, resolveObservationPeriodSpec, } from './periods';
|
|
6
|
+
export type { ObservationPeriodMetric, ObservationPeriodSpec } from './periods';
|
|
7
|
+
export { observationSemanticRule } from './rule';
|
|
8
|
+
export type { ObservationOperator, ObservationTemporalMetadata } from './types';
|
|
9
|
+
declare module '../../semantic-types/types' {
|
|
10
|
+
interface SemanticSchemaMetadata {
|
|
11
|
+
readonly temporalSemantics?: SchemaTemporalSemantics;
|
|
12
|
+
}
|
|
13
|
+
interface ResolvedSemanticSchemaMetadata {
|
|
14
|
+
readonly temporalSemantics?: SchemaTemporalSemantics;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
export declare const observationPlugin: SemanticDBPlugin;
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import type { PredItemType } from '
|
|
2
|
-
import type { OperatorDefinition } from '
|
|
3
|
-
declare const periodBoundaryOperator = "$
|
|
1
|
+
import type { PredItemType } from '../../logicform-types';
|
|
2
|
+
import type { OperatorDefinition, OperatorExecutionContext } from '../../operators/index';
|
|
3
|
+
declare const periodBoundaryOperator = "$periodValue";
|
|
4
4
|
export interface ObservationOperatorPolicy {
|
|
5
5
|
readonly operator: typeof periodBoundaryOperator;
|
|
6
6
|
readonly boundary: 'start' | 'end';
|
|
7
7
|
readonly implicit: boolean;
|
|
8
8
|
}
|
|
9
|
-
|
|
10
|
-
export declare const resolveObservationOperatorPolicy: (pred: Pick<PredItemType, "operator" | "args">, operator?: OperatorDefinition) => ObservationOperatorPolicy;
|
|
9
|
+
export declare const resolveObservationOperatorPolicy: (pred: Pick<PredItemType, "operator" | "args">, operator?: OperatorDefinition, executionContext?: OperatorExecutionContext) => ObservationOperatorPolicy;
|
|
11
10
|
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { LogicformType, PredItemType, QueryType } from '../../logicform-types';
|
|
2
|
+
import type { ResolvedSemanticProperty, ResolvedSemanticSchema } from '../../semantic-types/index';
|
|
3
|
+
export interface ObservationPeriodMetric {
|
|
4
|
+
readonly pred: PredItemType;
|
|
5
|
+
readonly effectivePred: PredItemType;
|
|
6
|
+
}
|
|
7
|
+
export interface ObservationPeriodSpec {
|
|
8
|
+
readonly group: PredItemType;
|
|
9
|
+
readonly timestamp: ResolvedSemanticProperty;
|
|
10
|
+
readonly boundary: 'start' | 'end';
|
|
11
|
+
readonly metrics: readonly ObservationPeriodMetric[];
|
|
12
|
+
readonly periods: readonly {
|
|
13
|
+
readonly label: string;
|
|
14
|
+
readonly asOf: string;
|
|
15
|
+
}[];
|
|
16
|
+
}
|
|
17
|
+
export declare const removeObservationTimeCondition: (query: QueryType | undefined, timestamp: ResolvedSemanticProperty) => QueryType | undefined;
|
|
18
|
+
export declare const resolveObservationPeriodSpec: (logicform: LogicformType, schema: ResolvedSemanticSchema) => ObservationPeriodSpec | undefined;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { PlannerSemanticRule } from '
|
|
1
|
+
import type { PlannerSemanticRule } from '../../planner/index';
|
|
2
2
|
export declare const observationSemanticRule: PlannerSemanticRule;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { PropertyHierarchyDefinition } from '../../semantic-types/index';
|
|
2
|
+
import type { SemanticDBPlugin } from '../types';
|
|
3
|
+
type PropertyHierarchyMetadata = PropertyHierarchyDefinition;
|
|
4
|
+
declare module '../../semantic-types/types' {
|
|
5
|
+
interface SemanticPropertyDraft {
|
|
6
|
+
/** Same-Schema drill relationship. `up` identifies the single-valued parent Property. */
|
|
7
|
+
readonly hierarchy?: PropertyHierarchyMetadata;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
export declare const propertyHierarchyPlugin: SemanticDBPlugin;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { SemanticDBPlugin } from '../types';
|
|
2
|
+
import type { QueryValueType } from '../../logicform-types';
|
|
3
|
+
export interface RecursiveQueryType {
|
|
4
|
+
readonly schema?: string;
|
|
5
|
+
readonly root?: QueryValueType;
|
|
6
|
+
readonly roots?: QueryValueType[];
|
|
7
|
+
readonly includeSelf?: boolean;
|
|
8
|
+
readonly idProperty?: string;
|
|
9
|
+
readonly parentProperty?: string;
|
|
10
|
+
}
|
|
11
|
+
declare module '../../logicform-types' {
|
|
12
|
+
interface QueryOperatorExtensions {
|
|
13
|
+
readonly $recursive?: QueryValueType | RecursiveQueryType;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
declare module '../../semantic-types/types' {
|
|
17
|
+
interface SemanticSchemaMetadata {
|
|
18
|
+
/** Property that stores a tree node's parent id. */
|
|
19
|
+
readonly parentProperty?: string;
|
|
20
|
+
}
|
|
21
|
+
interface ResolvedSemanticSchemaMetadata {
|
|
22
|
+
/** Canonical logical name of the Property that stores a tree node's parent id. */
|
|
23
|
+
readonly parentProperty?: string;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
export declare const recursivePlugin: SemanticDBPlugin;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { SemanticDBPlugin } from '../types';
|
|
2
|
+
declare module '../../semantic-types/types' {
|
|
3
|
+
interface SemanticPropertyDraft {
|
|
4
|
+
readonly timeWatermark?: TimeWatermarkPolicy;
|
|
5
|
+
}
|
|
6
|
+
interface SemanticSchemaMetadata {
|
|
7
|
+
readonly timeWatermark?: TimeWatermarkPolicy;
|
|
8
|
+
}
|
|
9
|
+
interface ResolvedSemanticSchemaMetadata {
|
|
10
|
+
readonly timeWatermark?: TimeWatermarkPolicy;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
export declare const temporalPlugin: SemanticDBPlugin;
|
package/dist/plugins/types.d.ts
CHANGED
|
@@ -1,20 +1,184 @@
|
|
|
1
1
|
import type { OperatorDefinition } from '../operators/types';
|
|
2
|
-
import type {
|
|
2
|
+
import type { LocaleDefinition } from '../i18n/types';
|
|
3
|
+
import type { PlannerSemanticRule } from '../planner/semantics/registry';
|
|
4
|
+
import type { CoreComputeProvider, DataRow } from '../physical/provider';
|
|
5
|
+
import type { LogicformType, PredItemType, QueryType } from '../logicform-types';
|
|
6
|
+
import type { SchemaMappingDefinition, SchemaMappingItem } from '../schema-mappings/types';
|
|
7
|
+
import type { ResolvedSemanticProperty, ResolvedSemanticSchema, SemanticSchemaDraft, SemanticTypeDefinition, TimeWatermarkPolicy } from '../semantic-types/types';
|
|
3
8
|
export interface SchemaMetadataPlugin {
|
|
4
9
|
readonly keys: readonly string[];
|
|
5
10
|
readonly resolve: (schema: SemanticSchemaDraft, properties: readonly ResolvedSemanticProperty[]) => Readonly<Record<string, unknown>>;
|
|
6
11
|
}
|
|
12
|
+
export interface PropertyMetadataPlugin {
|
|
13
|
+
readonly keys: readonly string[];
|
|
14
|
+
readonly resolve: (property: SemanticSchemaDraft['properties'][number], resolved: ResolvedSemanticProperty, schema: SemanticSchemaDraft) => Readonly<Record<string, unknown>>;
|
|
15
|
+
readonly resolveAll?: (properties: readonly ResolvedSemanticProperty[], drafts: readonly SemanticSchemaDraft['properties'][number][], schema: SemanticSchemaDraft) => readonly ResolvedSemanticProperty[];
|
|
16
|
+
}
|
|
7
17
|
export interface LegacySchemaPluginContext {
|
|
8
18
|
readonly source: Readonly<Record<string, unknown>>;
|
|
9
19
|
readonly properties: readonly SemanticSchemaDraft['properties'][number][];
|
|
10
20
|
}
|
|
21
|
+
export interface MappingGranularityContext {
|
|
22
|
+
readonly schema: ResolvedSemanticSchema;
|
|
23
|
+
readonly mapping: SchemaMappingDefinition;
|
|
24
|
+
readonly resolveSchema?: (schemaId: string) => ResolvedSemanticSchema;
|
|
25
|
+
}
|
|
26
|
+
export interface MappingGranularityPlugin {
|
|
27
|
+
/** Object-grain discriminator; one plugin owns each kind. */
|
|
28
|
+
readonly kind: string;
|
|
29
|
+
readonly isGranularity: (value: unknown) => boolean;
|
|
30
|
+
readonly validateItem?: (item: SchemaMappingItem, context: MappingGranularityContext) => string | undefined;
|
|
31
|
+
/** Reject a grouped source when it cannot preserve a requested dimension or filter. */
|
|
32
|
+
readonly candidateReason?: (logicform: LogicformType, context: MappingGranularityContext) => string | undefined;
|
|
33
|
+
/** True only for a computed grouping this plugin can verify in candidateReason. */
|
|
34
|
+
readonly supportsGroupby?: (group: PredItemType) => boolean;
|
|
35
|
+
}
|
|
36
|
+
export interface SchemaMappingPlugin {
|
|
37
|
+
readonly validate?: (mapping: SchemaMappingDefinition) => string | undefined;
|
|
38
|
+
readonly candidateReason?: (logicform: LogicformType, context: MappingGranularityContext) => string | undefined;
|
|
39
|
+
}
|
|
40
|
+
export interface QueryOperatorNormalizeContext {
|
|
41
|
+
readonly schema: ResolvedSemanticSchema;
|
|
42
|
+
readonly property: ResolvedSemanticProperty;
|
|
43
|
+
readonly resolveSchema?: (schemaId: string) => ResolvedSemanticSchema;
|
|
44
|
+
readonly normalizeValue: (value: unknown, schema: ResolvedSemanticSchema, property: ResolvedSemanticProperty) => Promise<unknown>;
|
|
45
|
+
}
|
|
46
|
+
export interface QueryOperatorPlanContext {
|
|
47
|
+
readonly schema: ResolvedSemanticSchema;
|
|
48
|
+
readonly property: ResolvedSemanticProperty;
|
|
49
|
+
readonly connectionId: string;
|
|
50
|
+
readonly resolveSchema?: (schemaId: string) => ResolvedSemanticSchema;
|
|
51
|
+
readonly resolveMapping: (schemaId: string, preferredConnectionId?: string) => SchemaMappingDefinition;
|
|
52
|
+
}
|
|
53
|
+
export interface QueryOperatorCompileContext {
|
|
54
|
+
readonly field: string;
|
|
55
|
+
readonly provider: CoreComputeProvider;
|
|
56
|
+
readonly bind: (value: unknown) => string;
|
|
57
|
+
readonly renderSource: (source: string, sourceSql?: string) => string;
|
|
58
|
+
}
|
|
59
|
+
export interface QueryOperatorAuthorizeContext {
|
|
60
|
+
readonly schema: ResolvedSemanticSchema;
|
|
61
|
+
readonly property: ResolvedSemanticProperty;
|
|
62
|
+
readonly resolveSchema: (schemaId: string) => ResolvedSemanticSchema;
|
|
63
|
+
readonly assertSchemaAllowed: (schemaId: string) => void;
|
|
64
|
+
readonly assertPropertyAllowed: (schema: ResolvedSemanticSchema, property: ResolvedSemanticProperty) => void;
|
|
65
|
+
readonly hasRowPermissions: (schemaId: string) => boolean;
|
|
66
|
+
}
|
|
67
|
+
export interface QueryOperatorPhysicalSource {
|
|
68
|
+
readonly schemaId: string;
|
|
69
|
+
readonly source: string;
|
|
70
|
+
readonly connectionId?: string;
|
|
71
|
+
}
|
|
72
|
+
export interface QueryOperatorPlanResult {
|
|
73
|
+
readonly value: unknown;
|
|
74
|
+
readonly sources?: readonly QueryOperatorPhysicalSource[];
|
|
75
|
+
}
|
|
76
|
+
export interface OutputHandlerContext {
|
|
77
|
+
readonly rows: readonly DataRow[];
|
|
78
|
+
readonly logicform: LogicformType;
|
|
79
|
+
readonly schema: ResolvedSemanticSchema;
|
|
80
|
+
}
|
|
81
|
+
export interface OutputHandlerDefinition {
|
|
82
|
+
readonly type: string;
|
|
83
|
+
readonly handle: (context: OutputHandlerContext) => unknown;
|
|
84
|
+
}
|
|
85
|
+
export interface TimeWatermarkLogicformContext {
|
|
86
|
+
readonly logicform: LogicformType;
|
|
87
|
+
readonly rootSchema: ResolvedSemanticSchema;
|
|
88
|
+
readonly rootProperty: ResolvedSemanticProperty;
|
|
89
|
+
readonly requestedUpperBound: Date;
|
|
90
|
+
readonly now: Date;
|
|
91
|
+
readonly defaultPolicy?: TimeWatermarkPolicy;
|
|
92
|
+
readonly resolveSchema: (schemaId: string) => ResolvedSemanticSchema;
|
|
93
|
+
readonly inferPropertyPath: (sourceSchema: ResolvedSemanticSchema, sourceProperty: string, targetSchema: ResolvedSemanticSchema) => string | undefined;
|
|
94
|
+
}
|
|
95
|
+
/** Stable interval roles used by generic point-in-interval planning. */
|
|
96
|
+
export interface IntervalSemanticProperties {
|
|
97
|
+
readonly id: ResolvedSemanticProperty;
|
|
98
|
+
readonly timestamp: ResolvedSemanticProperty;
|
|
99
|
+
readonly start: ResolvedSemanticProperty;
|
|
100
|
+
readonly end: ResolvedSemanticProperty;
|
|
101
|
+
}
|
|
102
|
+
export interface IntervalSemanticsDefinition {
|
|
103
|
+
readonly resolve: (schema: ResolvedSemanticSchema) => IntervalSemanticProperties | undefined;
|
|
104
|
+
}
|
|
105
|
+
export type RelationTemporalPlan = {
|
|
106
|
+
readonly kind: 'date-bucket-equal';
|
|
107
|
+
readonly sourceTimestamp: ResolvedSemanticProperty;
|
|
108
|
+
readonly targetTimestamp: ResolvedSemanticProperty;
|
|
109
|
+
} | {
|
|
110
|
+
readonly kind: 'point-in-interval';
|
|
111
|
+
readonly point: ResolvedSemanticProperty;
|
|
112
|
+
readonly start: ResolvedSemanticProperty;
|
|
113
|
+
readonly end: ResolvedSemanticProperty;
|
|
114
|
+
};
|
|
115
|
+
export interface RelationSemanticsDefinition {
|
|
116
|
+
readonly plan: (context: {
|
|
117
|
+
readonly sourceSchema: ResolvedSemanticSchema;
|
|
118
|
+
readonly targetSchema: ResolvedSemanticSchema;
|
|
119
|
+
}) => RelationTemporalPlan | undefined;
|
|
120
|
+
}
|
|
121
|
+
export interface PlannerPeriodEvaluation {
|
|
122
|
+
readonly group: PredItemType;
|
|
123
|
+
readonly property: ResolvedSemanticProperty;
|
|
124
|
+
readonly periods: readonly {
|
|
125
|
+
readonly label: string;
|
|
126
|
+
readonly asOf: string;
|
|
127
|
+
}[];
|
|
128
|
+
readonly source: {
|
|
129
|
+
readonly kind: 'interval';
|
|
130
|
+
readonly start: ResolvedSemanticProperty;
|
|
131
|
+
readonly end: ResolvedSemanticProperty;
|
|
132
|
+
} | {
|
|
133
|
+
readonly kind: 'latest';
|
|
134
|
+
readonly timestamp: ResolvedSemanticProperty;
|
|
135
|
+
};
|
|
136
|
+
readonly rewriteQuery?: (query: QueryType | undefined) => QueryType | undefined;
|
|
137
|
+
readonly rewritePred?: (pred: PredItemType) => PredItemType;
|
|
138
|
+
}
|
|
139
|
+
export interface PlannerPeriodDefinition {
|
|
140
|
+
readonly resolve: (logicform: LogicformType, schema: ResolvedSemanticSchema) => PlannerPeriodEvaluation | undefined;
|
|
141
|
+
}
|
|
142
|
+
/** A field-level query Operator spanning normalization, planning, and SQL compilation. */
|
|
143
|
+
export interface QueryOperatorDefinition {
|
|
144
|
+
readonly name: string;
|
|
145
|
+
/** Validate the full field condition before this exclusive Operator is normalized. */
|
|
146
|
+
readonly validateCondition?: (condition: Readonly<Record<string, unknown>>) => void;
|
|
147
|
+
readonly normalize: (value: unknown, context: QueryOperatorNormalizeContext) => unknown;
|
|
148
|
+
readonly authorize?: (value: unknown, context: QueryOperatorAuthorizeContext) => void;
|
|
149
|
+
readonly plan: (value: unknown, context: QueryOperatorPlanContext) => QueryOperatorPlanResult;
|
|
150
|
+
readonly compile: (value: unknown, context: QueryOperatorCompileContext) => string;
|
|
151
|
+
}
|
|
11
152
|
export interface SemanticDBPlugin {
|
|
12
153
|
/** Stable name used for diagnostics and duplicate detection. */
|
|
13
154
|
readonly name: string;
|
|
14
155
|
readonly schemaMetadata?: SchemaMetadataPlugin;
|
|
156
|
+
readonly propertyMetadata?: PropertyMetadataPlugin;
|
|
157
|
+
/** Prepare canonical v2 Schema metadata before Properties are resolved. */
|
|
158
|
+
readonly prepareSchema?: (schema: SemanticSchemaDraft) => SemanticSchemaDraft;
|
|
159
|
+
/** Validate invariants that require the complete resolved Schema. */
|
|
160
|
+
readonly validateResolvedSchema?: (schema: ResolvedSemanticSchema) => void;
|
|
15
161
|
/** Legacy-only Schema fields removed after normalizeLegacySchema runs. */
|
|
16
162
|
readonly legacySchemaKeys?: readonly string[];
|
|
17
163
|
readonly normalizeLegacySchema?: (context: LegacySchemaPluginContext) => Readonly<Record<string, unknown>>;
|
|
18
164
|
readonly resolveEntityFilterProperty?: (schema: ResolvedSemanticSchema) => ResolvedSemanticProperty | undefined;
|
|
19
165
|
readonly operators?: readonly OperatorDefinition[];
|
|
166
|
+
readonly semanticTypes?: readonly SemanticTypeDefinition[];
|
|
167
|
+
/** Planner-level semantic rewrites contributed by this capability. */
|
|
168
|
+
readonly plannerSemantics?: readonly PlannerSemanticRule[];
|
|
169
|
+
readonly queryOperators?: readonly QueryOperatorDefinition[];
|
|
170
|
+
/** Translations owned by this capability. Explicit execution locales override these. */
|
|
171
|
+
readonly locales?: readonly LocaleDefinition[];
|
|
172
|
+
readonly outputHandlers?: readonly OutputHandlerDefinition[];
|
|
173
|
+
/** Build the internal query used to resolve a shared temporal data watermark. */
|
|
174
|
+
readonly createTimeWatermarkLogicform?: (context: TimeWatermarkLogicformContext) => LogicformType;
|
|
175
|
+
readonly mappingGranularity?: MappingGranularityPlugin;
|
|
176
|
+
/** Extend physical mapping validation and candidate selection beyond granularity. */
|
|
177
|
+
readonly schemaMapping?: SchemaMappingPlugin;
|
|
178
|
+
/** Recognize a Schema whose rows own half-open validity intervals. */
|
|
179
|
+
readonly intervalSemantics?: IntervalSemanticsDefinition;
|
|
180
|
+
/** Add temporal conditions to a logical relation without coupling the core to a model. */
|
|
181
|
+
readonly relationSemantics?: RelationSemanticsDefinition;
|
|
182
|
+
/** Turn a bounded time group into a generic generated-period source. */
|
|
183
|
+
readonly plannerPeriod?: PlannerPeriodDefinition;
|
|
20
184
|
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { ResolvedSemanticSchema } from '../../semantic-types/index';
|
|
2
|
+
import type { IntervalSemanticProperties } from '../types';
|
|
3
|
+
export type ValidityProperties = IntervalSemanticProperties;
|
|
4
|
+
/** Recognize a stable entity whose physical rows are valid over half-open intervals. */
|
|
5
|
+
export declare const resolveValidityProperties: (schema: ResolvedSemanticSchema) => ValidityProperties | undefined;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { SemanticDBPlugin } from '../types';
|
|
2
|
+
declare module '../../operators/types' {
|
|
3
|
+
interface ResultPropertyTemporalMetadataExtensions {
|
|
4
|
+
readonly validity: {
|
|
5
|
+
readonly kind: 'validity';
|
|
6
|
+
};
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
export { resolveValidityProperties } from './classification';
|
|
10
|
+
export type { ValidityProperties } from './classification';
|
|
11
|
+
export { applyValidityQuery } from './query-policy';
|
|
12
|
+
export { hasValidityTimeGroup, removeValidityTimeCondition, resolveValidityPeriodSpec, } from './periods';
|
|
13
|
+
export type { ValidityPeriod, ValidityPeriodSpec } from './periods';
|
|
14
|
+
export { validitySemanticRule } from './rule';
|
|
15
|
+
export declare const validityPlugin: SemanticDBPlugin;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { LogicformType, PredItemType, QueryType } from '../../logicform-types';
|
|
2
|
+
import type { TimeGranularity } from '../../semantic-types/index';
|
|
3
|
+
import type { ValidityProperties } from './classification';
|
|
4
|
+
export interface ValidityPeriod {
|
|
5
|
+
readonly label: string;
|
|
6
|
+
readonly asOf: string;
|
|
7
|
+
}
|
|
8
|
+
export interface ValidityPeriodSpec {
|
|
9
|
+
readonly group: PredItemType;
|
|
10
|
+
readonly granularity: TimeGranularity;
|
|
11
|
+
readonly periods: readonly ValidityPeriod[];
|
|
12
|
+
}
|
|
13
|
+
export declare const hasValidityTimeGroup: (logicform: LogicformType, properties: ValidityProperties) => boolean;
|
|
14
|
+
export declare const removeValidityTimeCondition: (query: QueryType | undefined, properties: ValidityProperties) => QueryType | undefined;
|
|
15
|
+
export declare const resolveValidityPeriodSpec: (logicform: LogicformType, properties: ValidityProperties) => ValidityPeriodSpec | undefined;
|
|
@@ -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;
|
package/dist/schema/index.d.ts
CHANGED
|
@@ -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,7 @@
|
|
|
1
1
|
export { SchemaMappingRegistry } from './registry';
|
|
2
2
|
export { parseDailyExpireAt } from './freshness';
|
|
3
|
-
export
|
|
3
|
+
export { isMappingTimeGranularity, isSchemaMappingGranularity, } from './granularity';
|
|
4
|
+
export type { SchemaMappingDefinition, SchemaMappingEnrichmentDefinition, SchemaMappingEnrichmentKey, SchemaMappingItem, SchemaMappingGranularity, SchemaMappingGranularityExtensions, SchemaMappingPointTemporalDefinition, SchemaMappingSelection, RejectedSchemaMapping, SourceFreshnessPolicy, } from './types';
|
|
4
5
|
export type { SchemaMappingPredDefinition, SchemaMappingPredMatch, } from './types';
|
|
6
|
+
export { fromYiAskSchemaMapping } from './yiask';
|
|
7
|
+
export type { YiAskSchemaMappingItem, YiAskSchemaMappingRecord } from './yiask';
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
+
import type { SemanticDBPlugin } from '../plugins/index';
|
|
1
2
|
import type { SchemaMappingDefinition } from './types';
|
|
2
3
|
export declare class SchemaMappingRegistry {
|
|
3
4
|
#private;
|
|
4
|
-
|
|
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
|
-
|
|
10
|
+
definitions(): readonly SchemaMappingDefinition[];
|
|
11
|
+
findSource(schemaId: string, source: string, connectionId?: string): SchemaMappingDefinition | undefined;
|
|
9
12
|
}
|
|
@@ -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;
|
|
@@ -22,6 +28,37 @@ export interface SchemaMappingPredDefinition {
|
|
|
22
28
|
/** Physical column used as the matched PredItem's operator input. */
|
|
23
29
|
readonly column: string;
|
|
24
30
|
}
|
|
31
|
+
export interface SchemaMappingItem {
|
|
32
|
+
readonly sourceColumn?: string;
|
|
33
|
+
/** Enrichment id that owns sourceColumn. Missing means the mapping's base source. */
|
|
34
|
+
readonly sourceRef?: string;
|
|
35
|
+
readonly mappingType?: 'property' | 'predItem' | 'ignored';
|
|
36
|
+
readonly propertyTarget?: readonly string[];
|
|
37
|
+
readonly predItem?: PredItemType;
|
|
38
|
+
/** Finest physical grain of a mapped Property. */
|
|
39
|
+
readonly granularity?: SchemaMappingGranularity;
|
|
40
|
+
}
|
|
41
|
+
export interface SchemaMappingEnrichmentKey {
|
|
42
|
+
/** Physical column on the mapping's base source. */
|
|
43
|
+
readonly baseColumn: string;
|
|
44
|
+
/** Physical entity-id column on the enrichment source. */
|
|
45
|
+
readonly targetColumn: string;
|
|
46
|
+
}
|
|
47
|
+
export interface SchemaMappingPointTemporalDefinition {
|
|
48
|
+
readonly kind: 'point';
|
|
49
|
+
/** Point whose containing base-source interval owns the feature row. */
|
|
50
|
+
readonly pointColumn: string;
|
|
51
|
+
}
|
|
52
|
+
/** A same-connection physical extension of one logical Schema. */
|
|
53
|
+
export interface SchemaMappingEnrichmentDefinition {
|
|
54
|
+
readonly id: string;
|
|
55
|
+
readonly source: string;
|
|
56
|
+
readonly sourceSql?: string;
|
|
57
|
+
readonly on: readonly SchemaMappingEnrichmentKey[];
|
|
58
|
+
readonly temporal?: SchemaMappingPointTemporalDefinition;
|
|
59
|
+
/** Missing means queries depending on this enrichment are not cached. */
|
|
60
|
+
readonly freshness?: SourceFreshnessPolicy;
|
|
61
|
+
}
|
|
25
62
|
export interface SchemaMappingDefinition {
|
|
26
63
|
/** Stable identity when a Schema has multiple physical mappings. */
|
|
27
64
|
readonly id?: string;
|
|
@@ -32,15 +69,22 @@ export interface SchemaMappingDefinition {
|
|
|
32
69
|
readonly source: string;
|
|
33
70
|
/** Optional trusted query compiled as a derived-table source instead of reading source directly. */
|
|
34
71
|
readonly sourceSql?: string;
|
|
35
|
-
/**
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
readonly properties?: Readonly<Record<string, string>>;
|
|
40
|
-
/** PredItem patterns implemented by physical measure columns in this source. */
|
|
41
|
-
readonly predMappings?: readonly SchemaMappingPredDefinition[];
|
|
72
|
+
/** Optional physical tables that extend base rows without becoming logical Schema relations. */
|
|
73
|
+
readonly enrichments?: readonly SchemaMappingEnrichmentDefinition[];
|
|
74
|
+
/** Unified logical-to-physical mappings for properties and conditional PredItems. */
|
|
75
|
+
readonly mappings?: readonly SchemaMappingItem[];
|
|
42
76
|
/** Higher values win when multiple candidates cover the same LogicForm. */
|
|
43
77
|
readonly priority?: number;
|
|
44
78
|
/** Missing means queries depending on this physical source are not cached. */
|
|
45
79
|
readonly freshness?: SourceFreshnessPolicy;
|
|
46
80
|
}
|
|
81
|
+
export interface RejectedSchemaMapping {
|
|
82
|
+
readonly mappingId: string;
|
|
83
|
+
readonly reason: string;
|
|
84
|
+
}
|
|
85
|
+
/** Planner diagnostics for one physical Schema mapping decision. */
|
|
86
|
+
export interface SchemaMappingSelection {
|
|
87
|
+
readonly schemaId: string;
|
|
88
|
+
readonly selectedMappingId: string;
|
|
89
|
+
readonly rejectedMappings: readonly RejectedSchemaMapping[];
|
|
90
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
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 sourceRef?: string;
|
|
7
|
+
readonly mappingType?: 'property' | 'predItem' | 'ignored';
|
|
8
|
+
readonly propertyTarget?: readonly string[];
|
|
9
|
+
readonly predItem?: PredItemType;
|
|
10
|
+
readonly granularity?: SchemaMappingGranularity;
|
|
11
|
+
}
|
|
12
|
+
export interface YiAskSchemaMappingRecord {
|
|
13
|
+
readonly id: string | number;
|
|
14
|
+
readonly schemaSid: string;
|
|
15
|
+
readonly datasourceSid: string;
|
|
16
|
+
readonly sourceMode?: 'table' | 'demo';
|
|
17
|
+
readonly tablePath?: string;
|
|
18
|
+
readonly sourceSql?: string;
|
|
19
|
+
readonly physicalDatabase?: string;
|
|
20
|
+
readonly physicalSchema?: string;
|
|
21
|
+
readonly physicalTable?: string;
|
|
22
|
+
readonly enrichments?: readonly SchemaMappingEnrichmentDefinition[];
|
|
23
|
+
readonly mappings: readonly YiAskSchemaMappingItem[];
|
|
24
|
+
readonly enabled?: boolean;
|
|
25
|
+
}
|
|
26
|
+
export declare const fromYiAskSchemaMapping: (record: YiAskSchemaMappingRecord, plugins?: readonly SemanticDBPlugin[]) => SchemaMappingDefinition;
|
|
@@ -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,
|
|
8
|
-
export
|
|
9
|
-
|
|
8
|
+
export type { ComparableCategoryDefinition, PropertyHierarchyDefinition, PropertySqlDefinition, 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;
|