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.
- 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/execute.d.ts +1 -1
- package/dist/executor/federated-execution.d.ts +39 -0
- package/dist/executor/fetch-entities.d.ts +7 -1
- package/dist/executor/index.d.ts +1 -1
- package/dist/executor/partition.d.ts +17 -0
- 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 +70 -21
- 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 +18 -16
- package/dist/logicform/dimensions.d.ts +16 -0
- package/dist/logicform/index.d.ts +2 -0
- package/dist/logicform-types.d.ts +56 -36
- package/dist/normalizer/core.d.ts +17 -3
- 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 +110 -50
- 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/build-mapping-source-plan.d.ts +6 -0
- package/dist/planner/create-logical-plan.d.ts +11 -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 +19 -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 +106 -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 +5 -1
- package/dist/schema-mappings/registry.d.ts +7 -3
- package/dist/schema-mappings/supported-dimensions.d.ts +10 -0
- package/dist/schema-mappings/types.d.ts +59 -9
- package/dist/schema-mappings/yiask.d.ts +27 -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 +51 -11
- 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
package/dist/planner/types.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
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';
|
|
5
|
+
import type { QueryOperatorDefinition } from '../plugins/index';
|
|
4
6
|
export interface FieldReferencePlan {
|
|
5
7
|
readonly schemaId: string;
|
|
6
8
|
readonly property: string;
|
|
@@ -10,31 +12,44 @@ export interface FieldReferencePlan {
|
|
|
10
12
|
readonly qualifier: string;
|
|
11
13
|
readonly sql?: string;
|
|
12
14
|
readonly timestampColumn?: string;
|
|
15
|
+
/** Source alias that supplies $TS when it differs from the Property's Schema. */
|
|
16
|
+
readonly timestampQualifier?: string;
|
|
13
17
|
readonly isArray?: boolean;
|
|
18
|
+
/** Accept native text arrays and JSON/scalar representations of string arrays. */
|
|
19
|
+
readonly normalizeStringArray?: boolean;
|
|
14
20
|
readonly comparable?: ComparableCategoryDefinition;
|
|
15
21
|
}
|
|
16
22
|
export interface LogicalQuerySubquery {
|
|
17
23
|
readonly kind: 'logicform-subquery';
|
|
18
24
|
readonly plan: LogicalPlan;
|
|
19
25
|
}
|
|
20
|
-
export interface
|
|
21
|
-
readonly kind: '
|
|
22
|
-
readonly
|
|
23
|
-
readonly
|
|
24
|
-
readonly
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
export interface LogicalQueryOperator {
|
|
27
|
+
readonly kind: 'query-operator';
|
|
28
|
+
readonly operator: string;
|
|
29
|
+
readonly value: unknown;
|
|
30
|
+
readonly sources?: readonly {
|
|
31
|
+
readonly schemaId: string;
|
|
32
|
+
readonly source: string;
|
|
33
|
+
readonly connectionId?: string;
|
|
34
|
+
}[];
|
|
35
|
+
/** Capability selected during planning; omitted only by manually constructed plans. */
|
|
36
|
+
readonly definition?: QueryOperatorDefinition;
|
|
29
37
|
}
|
|
30
38
|
export interface LogicalOrdinalQuery {
|
|
31
39
|
readonly kind: 'ordinal-query';
|
|
32
40
|
readonly comparable: ComparableCategoryDefinition;
|
|
33
41
|
readonly condition: unknown;
|
|
34
42
|
}
|
|
43
|
+
export interface LogicalExpressionQuery {
|
|
44
|
+
readonly kind: 'expression-query';
|
|
45
|
+
readonly expression: Expression;
|
|
46
|
+
readonly condition: unknown;
|
|
47
|
+
readonly properties: readonly string[];
|
|
48
|
+
}
|
|
35
49
|
export declare const isLogicalQuerySubquery: (value: unknown) => value is LogicalQuerySubquery;
|
|
36
|
-
export declare const
|
|
50
|
+
export declare const isLogicalQueryOperator: (value: unknown) => value is LogicalQueryOperator;
|
|
37
51
|
export declare const isLogicalOrdinalQuery: (value: unknown) => value is LogicalOrdinalQuery;
|
|
52
|
+
export declare const isLogicalExpressionQuery: (value: unknown) => value is LogicalExpressionQuery;
|
|
38
53
|
export type Expression = {
|
|
39
54
|
readonly kind: 'array-element';
|
|
40
55
|
readonly schemaId: string;
|
|
@@ -55,6 +70,7 @@ export type Expression = {
|
|
|
55
70
|
readonly sql: string;
|
|
56
71
|
readonly qualifier?: string;
|
|
57
72
|
readonly timestampColumn?: string;
|
|
73
|
+
readonly timestampQualifier?: string;
|
|
58
74
|
} | {
|
|
59
75
|
readonly kind: 'operator';
|
|
60
76
|
readonly operator: string;
|
|
@@ -63,7 +79,7 @@ export type Expression = {
|
|
|
63
79
|
readonly qualifier?: string;
|
|
64
80
|
readonly schemaId?: string;
|
|
65
81
|
readonly input?: Expression;
|
|
66
|
-
readonly
|
|
82
|
+
readonly inputs?: readonly Expression[];
|
|
67
83
|
readonly args: Readonly<Record<string, unknown>>;
|
|
68
84
|
readonly query?: Readonly<Record<string, unknown>>;
|
|
69
85
|
} | {
|
|
@@ -107,17 +123,47 @@ export interface JoinPlan {
|
|
|
107
123
|
readonly sourceColumn: string;
|
|
108
124
|
readonly sourceSql?: string;
|
|
109
125
|
readonly sourceTimestampColumn?: string;
|
|
110
|
-
readonly sourceTimestampGranularity?: TimeGranularity;
|
|
111
126
|
readonly targetSchemaId: string;
|
|
127
|
+
/** Physical connection selected for the target Schema mapping. */
|
|
128
|
+
readonly targetConnectionId?: string;
|
|
112
129
|
readonly targetSource: string;
|
|
113
130
|
readonly targetSourceSql?: string;
|
|
131
|
+
/** Two projection layers for the target Schema Mapping and its UDFs. */
|
|
132
|
+
readonly targetMappingSourcePlan?: LogicalPlan;
|
|
114
133
|
readonly targetAlias: string;
|
|
115
134
|
readonly targetColumn: string;
|
|
116
135
|
readonly targetSql?: string;
|
|
117
136
|
readonly targetTimestampColumn?: string;
|
|
118
|
-
readonly
|
|
137
|
+
readonly temporalCondition?: TemporalJoinConditionPlan;
|
|
119
138
|
readonly sourceArrayExpansionPath?: string;
|
|
120
139
|
}
|
|
140
|
+
export type TemporalJoinConditionPlan = {
|
|
141
|
+
readonly kind: 'date-bucket-equal';
|
|
142
|
+
readonly sourceColumn: string;
|
|
143
|
+
readonly targetColumn: string;
|
|
144
|
+
readonly sourceGranularity: TimeGranularity;
|
|
145
|
+
readonly targetGranularity: TimeGranularity;
|
|
146
|
+
} | {
|
|
147
|
+
readonly kind: 'point-in-interval';
|
|
148
|
+
readonly pointSide: 'source' | 'target';
|
|
149
|
+
readonly pointColumn: string;
|
|
150
|
+
readonly intervalSide: 'source' | 'target';
|
|
151
|
+
readonly startColumn: string;
|
|
152
|
+
readonly endColumn: string;
|
|
153
|
+
};
|
|
154
|
+
export interface EnrichmentJoinPlan {
|
|
155
|
+
readonly kind: 'enrichment-left';
|
|
156
|
+
readonly id: string;
|
|
157
|
+
readonly source: string;
|
|
158
|
+
readonly sourceSql?: string;
|
|
159
|
+
readonly alias: string;
|
|
160
|
+
readonly baseAlias: string;
|
|
161
|
+
readonly keys: readonly {
|
|
162
|
+
readonly baseColumn: string;
|
|
163
|
+
readonly targetColumn: string;
|
|
164
|
+
}[];
|
|
165
|
+
readonly temporalCondition?: TemporalJoinConditionPlan;
|
|
166
|
+
}
|
|
121
167
|
export interface ArrayExpansionPlan {
|
|
122
168
|
readonly path: string;
|
|
123
169
|
readonly sourceAlias: string;
|
|
@@ -125,6 +171,8 @@ export interface ArrayExpansionPlan {
|
|
|
125
171
|
readonly sourceSql?: string;
|
|
126
172
|
readonly sourceTimestampColumn?: string;
|
|
127
173
|
readonly alias: string;
|
|
174
|
+
readonly normalizeStringArray?: boolean;
|
|
175
|
+
readonly elementType?: 'string';
|
|
128
176
|
}
|
|
129
177
|
export type PaginationPlan = {
|
|
130
178
|
readonly kind: 'rows';
|
|
@@ -140,9 +188,30 @@ export interface GroupLimitPlan {
|
|
|
140
188
|
readonly partitionBy: readonly string[];
|
|
141
189
|
readonly orderBy: readonly OrderPlan[];
|
|
142
190
|
}
|
|
191
|
+
export interface PeriodSourcePlan {
|
|
192
|
+
readonly alias: string;
|
|
193
|
+
readonly labelColumn: string;
|
|
194
|
+
readonly asOfColumn: string;
|
|
195
|
+
readonly sourceAlias: string;
|
|
196
|
+
readonly periods: readonly {
|
|
197
|
+
readonly label: string;
|
|
198
|
+
readonly asOf: string;
|
|
199
|
+
}[];
|
|
200
|
+
readonly match: {
|
|
201
|
+
readonly kind: 'interval';
|
|
202
|
+
readonly startColumn: string;
|
|
203
|
+
readonly endColumn: string;
|
|
204
|
+
} | {
|
|
205
|
+
readonly kind: 'latest';
|
|
206
|
+
readonly lookupAlias: string;
|
|
207
|
+
readonly timestampColumn: string;
|
|
208
|
+
};
|
|
209
|
+
}
|
|
143
210
|
export type RowIdentityPlan = {
|
|
144
211
|
readonly kind: 'group';
|
|
145
212
|
readonly names: readonly string[];
|
|
213
|
+
readonly separator: string;
|
|
214
|
+
readonly nullLabel: string;
|
|
146
215
|
} | {
|
|
147
216
|
readonly kind: 'property';
|
|
148
217
|
readonly column: string;
|
|
@@ -155,19 +224,37 @@ export type RowIdentityPlan = {
|
|
|
155
224
|
export interface LogicalPlan {
|
|
156
225
|
readonly schemaId: string;
|
|
157
226
|
readonly source: string;
|
|
227
|
+
/** Physical connection selected for this plan's source mapping. */
|
|
228
|
+
readonly connectionId?: string;
|
|
158
229
|
/** Trusted derived-table SQL supplied by the selected physical mapping. */
|
|
159
230
|
readonly sourceSql?: string;
|
|
231
|
+
/** Two projection layers for the physical Mapping and Schema UDFs. */
|
|
232
|
+
readonly mappingSourcePlan?: LogicalPlan;
|
|
160
233
|
/** Physical mapping selected by the Planner for this logical Schema. */
|
|
161
234
|
readonly mappingId?: string;
|
|
162
235
|
/** Child relations combined by their compatible group identity. */
|
|
163
|
-
readonly
|
|
236
|
+
readonly subplans?: readonly LogicalPlan[];
|
|
237
|
+
/** Vertically combine disjoint aggregate shards by summing matching output groups. */
|
|
238
|
+
readonly sumPartition?: true;
|
|
239
|
+
/** Enumerated group values corresponding to subplans, combined vertically. */
|
|
240
|
+
readonly splitGroup?: {
|
|
241
|
+
readonly name: string;
|
|
242
|
+
readonly values: readonly string[];
|
|
243
|
+
readonly groupNames: readonly string[];
|
|
244
|
+
};
|
|
164
245
|
/** Optional query plan compiled as the derived-table source of this plan. */
|
|
165
246
|
readonly sourcePlan?: LogicalPlan;
|
|
247
|
+
/** Normalized LogicForm corresponding to sourcePlan when generated rewrites need execution. */
|
|
248
|
+
readonly sourceLogicform?: LogicformType;
|
|
166
249
|
readonly sourceAlias?: string;
|
|
167
250
|
readonly fields: Readonly<Record<string, string>>;
|
|
168
251
|
readonly fieldReferences?: Readonly<Record<string, FieldReferencePlan>>;
|
|
169
252
|
readonly joins?: readonly JoinPlan[];
|
|
253
|
+
/** Physical extensions of this mapping, added only when a mapped property uses them. */
|
|
254
|
+
readonly enrichmentJoins?: readonly EnrichmentJoinPlan[];
|
|
170
255
|
readonly arrayExpansions?: readonly ArrayExpansionPlan[];
|
|
256
|
+
/** Generated period rows matched to a source by a plugin-selected generic strategy. */
|
|
257
|
+
readonly periodSource?: PeriodSourcePlan;
|
|
171
258
|
readonly projections: readonly ProjectionPlan[];
|
|
172
259
|
readonly columnProperties?: readonly ResultProperty[];
|
|
173
260
|
readonly groupBy: readonly ProjectionPlan[];
|
|
@@ -196,6 +283,11 @@ export interface QueryLineage {
|
|
|
196
283
|
readonly schemaName: string;
|
|
197
284
|
readonly physicalTable: string;
|
|
198
285
|
readonly provider: CoreComputeProvider['kind'];
|
|
286
|
+
readonly connectionId?: string;
|
|
287
|
+
readonly connections?: readonly {
|
|
288
|
+
readonly connectionId: string;
|
|
289
|
+
readonly provider: CoreComputeProvider['kind'];
|
|
290
|
+
}[];
|
|
199
291
|
};
|
|
200
292
|
readonly outputs: readonly LineageOutput[];
|
|
201
293
|
readonly filters: readonly LineageColumnSource[];
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { SemanticDBPlugin } from '../types';
|
|
2
|
-
export type { HierarchyDefinition, HierarchyLevelDefinition, ResolvedHierarchyDefinition, } from './types';
|
|
2
|
+
export type { HierarchyDefinition, HierarchyLevelDefinition, ResolvedHierarchyDefinition, SchemaMappingHierarchyGranularity, } from './types';
|
|
3
3
|
export declare const hierarchyPlugin: SemanticDBPlugin;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { MappingGranularityPlugin } from '../types';
|
|
2
|
+
import type { SchemaMappingHierarchyGranularity } from './types';
|
|
3
|
+
export declare const isMappingHierarchyGranularity: (value: unknown) => value is SchemaMappingHierarchyGranularity;
|
|
4
|
+
export declare const hierarchyMappingGranularity: MappingGranularityPlugin;
|
|
@@ -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;
|