semanticdb-v2 2.0.0-alpha.11 → 2.0.0-alpha.12
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 +39 -15
- package/dist/cache/types.d.ts +2 -1
- package/dist/compiler/compile-computation.d.ts +6 -0
- package/dist/compiler/compile-source.d.ts +5 -0
- package/dist/executor/component-properties.d.ts +22 -0
- package/dist/executor/components.d.ts +7 -3
- package/dist/executor/execute-query.d.ts +1 -0
- package/dist/executor/merge-by-id.d.ts +3 -0
- package/dist/executor/partition.d.ts +1 -0
- package/dist/executor/random-data.d.ts +5 -0
- package/dist/executor/result-hydrator/entity-fetch-conditions.d.ts +4 -0
- package/dist/executor/result-hydrator/index.d.ts +1 -0
- package/dist/executor/result-hydrator/types.d.ts +7 -0
- package/dist/executor/runtime-execution.d.ts +6 -0
- package/dist/executor/sample.d.ts +6 -0
- package/dist/executor/types.d.ts +9 -3
- package/dist/file-import/index.d.ts +2 -0
- package/dist/file-import/read-file.d.ts +2 -0
- package/dist/file-import/types.d.ts +31 -0
- package/dist/index.d.ts +8 -5
- package/dist/logicform-types.d.ts +22 -2
- package/dist/normalizer/core.d.ts +7 -0
- package/dist/normalizer/index.d.ts +1 -0
- package/dist/normalizer/main-time-range.d.ts +9 -0
- package/dist/normalizer/public-logicform.d.ts +14 -0
- package/dist/normalizer/query.d.ts +3 -2
- package/dist/normalizer/random-data.d.ts +2 -0
- package/dist/operators/builtins/period-name.d.ts +3 -0
- package/dist/operators/builtins/time-range.d.ts +2 -2
- package/dist/operators/formula-text.d.ts +10 -0
- package/dist/operators/index.d.ts +2 -1
- package/dist/operators/registry.d.ts +8 -1
- package/dist/operators/types.d.ts +107 -24
- package/dist/permissions/index.d.ts +2 -1
- package/dist/permissions/metric-permissions.d.ts +9 -0
- package/dist/permissions/permissions.d.ts +4 -3
- package/dist/permissions/types.d.ts +5 -0
- package/dist/physical/connection.d.ts +4 -0
- package/dist/physical/db-connector.d.ts +10 -0
- package/dist/physical/duckdb-coordinator-provider.d.ts +3 -23
- package/dist/physical/duckdb-dataset.d.ts +23 -0
- package/dist/physical/duckdb-provider.d.ts +26 -0
- package/dist/physical/duckdb-sql.d.ts +33 -0
- package/dist/physical/import-types.d.ts +23 -0
- package/dist/physical/import-validation.d.ts +14 -0
- package/dist/physical/index.d.ts +4 -0
- package/dist/physical/postgresql-provider.d.ts +1 -0
- package/dist/physical/provider.d.ts +4 -0
- package/dist/planner/build-lineage.d.ts +1 -1
- package/dist/planner/create-logical-plan.d.ts +11 -2
- package/dist/planner/index.d.ts +3 -2
- package/dist/planner/mapping-granularity.d.ts +1 -1
- package/dist/planner/materialize-computations.d.ts +3 -0
- package/dist/planner/select-schema-mapping.d.ts +15 -3
- package/dist/planner/types.d.ts +40 -9
- package/dist/planner/udf-inputs.d.ts +6 -0
- package/dist/plugins/types.d.ts +4 -2
- package/dist/schema/index.d.ts +1 -0
- package/dist/schema/relation-keys.d.ts +11 -0
- package/dist/schema-mappings/computations.d.ts +3 -0
- package/dist/schema-mappings/index.d.ts +4 -1
- package/dist/schema-mappings/source.d.ts +11 -0
- package/dist/schema-mappings/sql-inputs.d.ts +7 -0
- package/dist/schema-mappings/types.d.ts +103 -17
- package/dist/schema-mappings/yiask.d.ts +6 -19
- package/dist/semantic-types/types.d.ts +21 -1
- package/dist/semanticdb.esm.js +6 -5
- package/dist/semanticdb.js +6 -5
- package/dist/utils/format-date.d.ts +3 -0
- package/package.json +5 -3
- package/dist/executor/evaluate.d.ts +0 -4
- package/dist/planner/build-mapping-source-plan.d.ts +0 -6
package/README.md
CHANGED
|
@@ -22,12 +22,13 @@ providers across executions; call `await Logicform.close()` during application s
|
|
|
22
22
|
|
|
23
23
|
```ts
|
|
24
24
|
import { Logicform } from 'semanticdb-v2';
|
|
25
|
+
import type { SchemaMappingDefinition } from 'semanticdb-v2';
|
|
25
26
|
|
|
26
|
-
const schemaMappings = [
|
|
27
|
+
const schemaMappings: SchemaMappingDefinition[] = [
|
|
27
28
|
{
|
|
28
29
|
schemaId: 'sales',
|
|
29
30
|
connectionId: 'analytics',
|
|
30
|
-
source: 'analytics.sales_detail',
|
|
31
|
+
source: { kind: 'table', table: 'analytics.sales_detail' },
|
|
31
32
|
mappings: [],
|
|
32
33
|
freshness: { mode: 'ttl', ttlSeconds: 300 },
|
|
33
34
|
},
|
|
@@ -68,6 +69,10 @@ A successful response always includes `total`, the number of result rows before
|
|
|
68
69
|
`limit`/`page` pagination. For grouped LogicForms this is the number of groups after `having` and
|
|
69
70
|
`limitBy`. Paginated physical queries include a separate `sqls` entry with `type: 'total'` for the
|
|
70
71
|
count query; unpaginated and executor-merged results derive the value without another SQL query.
|
|
72
|
+
For entity sampling, `total` counts distinct eligible entities before sampling. See
|
|
73
|
+
[Entity sampling](docs/entity-sampling.md) for boolean `sample`, top-level `limit`, and sorting rules.
|
|
74
|
+
See [Demo data perturbation](docs/random-data.md) for `randomData`, which applies random multipliers
|
|
75
|
+
to final numeric output values while preserving group keys and identities.
|
|
71
76
|
|
|
72
77
|
The v2 LogicForm contract requires `version` on executable LogicForms, including LogicForm objects
|
|
73
78
|
used as subqueries, and accepts semantic versions greater than or equal to `2.0`. At the public
|
|
@@ -280,7 +285,7 @@ commands that have already reached the database.
|
|
|
280
285
|
|
|
281
286
|
### Permissions
|
|
282
287
|
|
|
283
|
-
Pass table, row, and
|
|
288
|
+
Pass table, row, column, and custom metric permissions through `ExecuteOptions.permissions`:
|
|
284
289
|
|
|
285
290
|
```ts
|
|
286
291
|
import type { Permissions } from 'semanticdb-v2';
|
|
@@ -326,6 +331,15 @@ filters, grouping, operator inputs, and relation paths. A row policy may still u
|
|
|
326
331
|
column as an internal filter. If an ID is not whitelisted, SemanticDB generates the executor-owned
|
|
327
332
|
result-row `_id` instead of exposing the physical ID as that identity.
|
|
328
333
|
|
|
334
|
+
Custom metrics have a separate Schema catalog (`metrics: ['均价']`) and user policy
|
|
335
|
+
(`metricPermissions: { whitelist: ['均价'] }`). Omission preserves unrestricted metric access;
|
|
336
|
+
`[]` denies all custom metrics and `'*'` permits the current Schema's catalog. Metric names never
|
|
337
|
+
belong in `columnPermissions`. Compound metrics require permission for their internal custom
|
|
338
|
+
metrics and underlying properties; generated child queries retain table and row checks.
|
|
339
|
+
Permissions are validated only for Schemas reached by the execution.
|
|
340
|
+
See [the interface and YiAsk migration example](docs/metric-permissions.md) for dependency
|
|
341
|
+
contracts, compatibility behavior, and complete configuration examples.
|
|
342
|
+
|
|
329
343
|
### Component operators
|
|
330
344
|
|
|
331
345
|
Composite metrics are regular `OperatorDefinition` values with `kind: 'component'`. Their
|
|
@@ -341,7 +355,14 @@ names shared by both sides unless an exceptional custom operator explicitly supp
|
|
|
341
355
|
|
|
342
356
|
See [Register an operator](docs/register-operator.md) for the component contract.
|
|
343
357
|
|
|
344
|
-
|
|
358
|
+
DuckDB accepts customer `.duckdb` files (`path`, read-only by default) and managed
|
|
359
|
+
shared upload datasets (`directory`). `DBConnector.importFile()` supports `.xlsx`
|
|
360
|
+
and CSV, fixed column definitions, idempotent batches and batch replacement.
|
|
361
|
+
CSV automatically accepts UTF-8/BOM-marked Unicode; specify `gbk` or `gb18030` for
|
|
362
|
+
legacy Chinese files. See [DuckDB and file imports](docs/file-import.md) for PM2
|
|
363
|
+
sharing, configuration, encoding rules and operational limits.
|
|
364
|
+
|
|
365
|
+
The root entry point accepts a `connections` array of `DatabaseConnection` items. Every item has a unique `id`; set `kind` to `duckdb`, `mysql`,
|
|
345
366
|
`doris`, `starrocks`, `gbase`, `maxcompute`, `clickhouse`, `databricks`, `dameng`, `snowflake`,
|
|
346
367
|
`sqlserver`, `oracle`, or `postgresql`, then add that driver's
|
|
347
368
|
native connection fields directly on the item. Each Schema Mapping selects an item through
|
|
@@ -496,6 +517,13 @@ driver's ordinal parameter binding and are not interpolated into executable SQL.
|
|
|
496
517
|
required: PAT and OAuth fields are mutually exclusive, and authentication is never inferred from
|
|
497
518
|
the presence of credentials.
|
|
498
519
|
|
|
520
|
+
To check a real connection, fill in the Databricks fields in `.env` (see `.env.example`) and run
|
|
521
|
+
`npm run test:databricks`. Set `DATABRICKS_AUTH_TYPE=databricks-oauth` with
|
|
522
|
+
`DATABRICKS_CLIENT_ID` and `DATABRICKS_CLIENT_SECRET`, or use `access-token` with
|
|
523
|
+
`DATABRICKS_TOKEN`. The command opens a session through `DatabricksProvider`, applies `TZ` with
|
|
524
|
+
`SET TIME ZONE` when present, and prints the current session time zone, catalog, and schema.
|
|
525
|
+
The `.env` file is ignored by Git.
|
|
526
|
+
|
|
499
527
|
### Dameng connection
|
|
500
528
|
|
|
501
529
|
Dameng uses the official `dmdb` pool and the `dameng` connection kind:
|
|
@@ -584,6 +612,13 @@ trusted model metadata, must match the active provider dialect, and cannot conta
|
|
|
584
612
|
comments, or parameter placeholders. Property UDFs do not support the legacy `function` or
|
|
585
613
|
`dependencies` fields; application-side computed values belong outside this query SDK.
|
|
586
614
|
|
|
615
|
+
### Schema Mapping and data weaving
|
|
616
|
+
|
|
617
|
+
One logical Schema can use multiple physical sources, conditional measure columns,
|
|
618
|
+
time partitions, and same-connection feature tables. See
|
|
619
|
+
[Schema Mapping and data weaving](docs/data-weaving.md) for the current design and
|
|
620
|
+
links to detailed configuration guides.
|
|
621
|
+
|
|
587
622
|
### Query cache
|
|
588
623
|
|
|
589
624
|
All compiled provider queries, including the internal time-watermark query, can share one
|
|
@@ -592,17 +627,6 @@ cache identity includes namespace, connection id, provider, SQL, and parameters.
|
|
|
592
627
|
expiration belongs to each Schema mapping's `freshness` policy. See
|
|
593
628
|
[Query cache and Redis](docs/query-cache.md).
|
|
594
629
|
|
|
595
|
-
Schema mappings can also expose same-connection entity feature tables as lazy physical
|
|
596
|
-
enrichments. A mapped feature property adds a `LEFT JOIN` only when referenced, and a point-in-time
|
|
597
|
-
feature can be assigned to the containing valid-time entity row. See
|
|
598
|
-
[Schema Mapping feature enrichments](docs/schema-mapping-enrichments.md).
|
|
599
|
-
|
|
600
|
-
For aggregate sources, set `granularity` on mapped date or hierarchy Properties.
|
|
601
|
-
Other available dimensions are inferred from their Property mappings, so there is no
|
|
602
|
-
separate Schema Mapping `dimensions` field. The planner selects a source that covers
|
|
603
|
-
the requested properties and physical time or hierarchy grain. See
|
|
604
|
-
[Schema Mapping physical granularity](docs/schema-mapping-granularity.md).
|
|
605
|
-
|
|
606
630
|
When Redis is shared with other applications, pass an application-specific key prefix in the
|
|
607
631
|
execution JSON. SemanticDB reuses the connection by `cache.id`:
|
|
608
632
|
|
package/dist/cache/types.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ export interface QueryCacheIdentity {
|
|
|
4
4
|
readonly provider: CoreComputeProvider['kind'];
|
|
5
5
|
/** Distinguishes separate databases using the same provider dialect. */
|
|
6
6
|
readonly connectionId?: string;
|
|
7
|
+
readonly dataVersion?: string;
|
|
7
8
|
readonly sql: string;
|
|
8
9
|
readonly parameters: SqlParameters;
|
|
9
10
|
}
|
|
@@ -39,6 +40,6 @@ export interface QueryCacheConfiguration {
|
|
|
39
40
|
}
|
|
40
41
|
export interface InvalidateQueryCacheSourceOptions {
|
|
41
42
|
readonly cache: QueryCacheConfiguration;
|
|
42
|
-
/**
|
|
43
|
+
/** Source identity returned by sourceIdentity(mapping.source). */
|
|
43
44
|
readonly source: string;
|
|
44
45
|
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Expression } from '../planner/index';
|
|
2
|
+
import type { CoreComputeProvider } from '../physical/index';
|
|
3
|
+
/** Render a scoped row-level computation. Inputs have already been resolved by Planner. */
|
|
4
|
+
export declare const compileComputation: (computation: Extract<Expression, {
|
|
5
|
+
kind: "mapping-computation";
|
|
6
|
+
}>, provider: CoreComputeProvider, renderInput: (expression: Expression) => string, bind: (value: unknown) => string) => string;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { ResolvedMappingSource } from '../schema-mappings/index';
|
|
2
|
+
import type { CoreComputeProvider } from '../physical/index';
|
|
3
|
+
/** The only SQL renderer for a resolved table/query row-set source. */
|
|
4
|
+
export declare const compileSource: (source: unknown, provider: CoreComputeProvider) => string;
|
|
5
|
+
export declare const sourceRequiresAlias: (source: ResolvedMappingSource | undefined) => boolean;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { LogicformType } from '../logicform-types';
|
|
2
|
+
import type { OperatorQueryComponent } from '../operators/index';
|
|
3
|
+
import type { LogicalPlan } from '../planner/index';
|
|
4
|
+
import type { ResolvedSemanticSchema } from '../semantic-types/index';
|
|
5
|
+
import { type ExecutionUnit } from './components';
|
|
6
|
+
export interface PreparedComponentPlan {
|
|
7
|
+
readonly logicform: LogicformType;
|
|
8
|
+
readonly plan: LogicalPlan;
|
|
9
|
+
readonly schema: ResolvedSemanticSchema;
|
|
10
|
+
}
|
|
11
|
+
/** Prepare metadata from the same normalized queries and hook results used for computation. */
|
|
12
|
+
export declare const createComponentPropertyResolver: (options: {
|
|
13
|
+
readonly createUnits: (form: LogicformType, plan: LogicalPlan, schema: ResolvedSemanticSchema, source?: LogicformType) => readonly ExecutionUnit[] | undefined;
|
|
14
|
+
readonly prepareQuery: (component: OperatorQueryComponent) => Promise<PreparedComponentPlan>;
|
|
15
|
+
readonly replanSource: (form: LogicformType, schema: ResolvedSemanticSchema, sourceForm: LogicformType, sourcePlan: LogicalPlan) => LogicalPlan;
|
|
16
|
+
readonly resolveSchema: (form: LogicformType) => ResolvedSemanticSchema;
|
|
17
|
+
readonly prepareUnits: (units: readonly ExecutionUnit[]) => Promise<void>;
|
|
18
|
+
}) => {
|
|
19
|
+
getUnits: (form: LogicformType, plan: LogicalPlan, schema: ResolvedSemanticSchema, source?: LogicformType) => readonly ExecutionUnit[] | undefined;
|
|
20
|
+
prepareQuery: (component: OperatorQueryComponent) => Promise<PreparedComponentPlan>;
|
|
21
|
+
resolvePlan: (form: LogicformType, original: LogicalPlan, schema: ResolvedSemanticSchema, source?: LogicformType) => Promise<LogicalPlan>;
|
|
22
|
+
};
|
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
import type { LogicformType } from '../logicform-types';
|
|
2
|
-
import type { OperatorComponentCalculation, OperatorJavaScriptCalculation, OperatorQueryComponent, OperatorRegistry } from '../operators/index';
|
|
2
|
+
import type { OperatorComponentCalculation, OperatorComponentInput, OperatorComponentQuery, OperatorJavaScriptCalculation, OperatorQueryComponent, OperatorRegistry } from '../operators/index';
|
|
3
3
|
import type { DataRow } from '../physical/index';
|
|
4
4
|
import type { LogicalPlan } from '../planner/index';
|
|
5
5
|
import type { ResolvedSemanticSchema } from '../semantic-types/index';
|
|
6
6
|
import { type LocaleTranslate } from '../i18n/index';
|
|
7
|
-
export type ExecutionUnit = OperatorQueryComponent
|
|
7
|
+
export type ExecutionUnit = (OperatorQueryComponent & {
|
|
8
|
+
readonly outputName?: string;
|
|
9
|
+
}) | (OperatorComponentCalculation & {
|
|
8
10
|
readonly outputName: string;
|
|
9
11
|
}) | (OperatorJavaScriptCalculation & {
|
|
10
12
|
readonly outputName: string;
|
|
11
13
|
});
|
|
14
|
+
export declare const isQueryComponent: (input: OperatorComponentInput) => input is OperatorComponentQuery;
|
|
12
15
|
export declare const createExecutionUnits: (logicform: LogicformType, plan: LogicalPlan, schema: ResolvedSemanticSchema, operators: OperatorRegistry, resolveSchema: (schemaId: string) => ResolvedSemanticSchema, sourceLogicform?: LogicformType, locale?: string, t?: LocaleTranslate) => readonly ExecutionUnit[] | undefined;
|
|
13
16
|
export declare const mergeComponentRows: (results: readonly (readonly DataRow[])[], groupNames: readonly string[]) => DataRow[];
|
|
14
|
-
export declare const
|
|
17
|
+
export declare const mergeCalculationRows: (results: readonly (readonly DataRow[])[], groupNames: readonly string[], calculation: OperatorJavaScriptCalculation) => DataRow[];
|
|
18
|
+
export declare const mergeExecutionResults: (results: readonly (readonly DataRow[])[], plan: Pick<LogicalPlan, "groupBy" | "having" | "groupLimit" | "orderBy" | "pagination">) => DataRow[];
|
|
@@ -10,6 +10,7 @@ export interface PhysicalQuerySource {
|
|
|
10
10
|
readonly connectionId?: string;
|
|
11
11
|
/** Base mapping source that owns an enrichment source. */
|
|
12
12
|
readonly mappingSource?: string;
|
|
13
|
+
readonly computationId?: string;
|
|
13
14
|
}
|
|
14
15
|
export declare const resolvePhysicalSourceMapping: (source: PhysicalQuerySource, mappings: SchemaMappingRegistry) => SchemaMappingDefinition | undefined;
|
|
15
16
|
export declare const collectPlanSources: (plan: LogicalPlan) => readonly PhysicalQuerySource[];
|
|
@@ -6,6 +6,7 @@ import type { LogicformPartitionShard, ResolvedSemanticSchema } from '../semanti
|
|
|
6
6
|
/** Intersect range filters so the grain checker sees the effective shard boundary. */
|
|
7
7
|
export declare const partitionQuery: (original: QueryType | undefined, additional: QueryType) => QueryType;
|
|
8
8
|
export declare const validatePartitionShards: (schema: ResolvedSemanticSchema, shards: readonly LogicformPartitionShard[], mappings: SchemaMappingRegistry) => void;
|
|
9
|
+
export declare const isDetailPartition: (logicform: LogicformType) => boolean;
|
|
9
10
|
export interface PartitionedPlans {
|
|
10
11
|
readonly current: LogicalPlan;
|
|
11
12
|
readonly comparison?: LogicalPlan;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { LogicformRandomDataType } from '../logicform-types';
|
|
2
|
+
import type { DataRow } from '../physical/index';
|
|
3
|
+
import type { LogicalPlan } from '../planner/index';
|
|
4
|
+
/** Runs after all calculations/pagination and before semantic result hooks. Never mutates cached rows. */
|
|
5
|
+
export declare const randomizeResultData: (rows: readonly DataRow[], plan: LogicalPlan, randomData: LogicformRandomDataType | undefined) => readonly DataRow[];
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { LogicformType, QueryType } from '../../logicform-types';
|
|
2
|
+
import type { EntityFetchRequest } from './types';
|
|
3
|
+
/** ID-only display expansion uses the latest version that has already started. */
|
|
4
|
+
export declare const createEntityFetchConditions: (request: EntityFetchRequest, idQuery: QueryType) => Pick<LogicformType, "query" | "sort">;
|
|
@@ -7,8 +7,15 @@ export interface EntityFetchRequest {
|
|
|
7
7
|
readonly schema: ResolvedSemanticSchema;
|
|
8
8
|
readonly idProperty: ResolvedSemanticProperty;
|
|
9
9
|
readonly ids: readonly unknown[];
|
|
10
|
+
/** Fetch candidates ordered by descending start time; retain the first row per ID. */
|
|
11
|
+
readonly latestVersion?: {
|
|
12
|
+
readonly startProperty: string;
|
|
13
|
+
readonly asOf: string;
|
|
14
|
+
};
|
|
10
15
|
}
|
|
11
16
|
export interface ResultHydratorOptions {
|
|
17
|
+
readonly expandEntities?: boolean;
|
|
18
|
+
readonly now?: Date;
|
|
12
19
|
readonly semanticTypes: SemanticTypeRegistry;
|
|
13
20
|
readonly resolveSchema: (schemaId: string) => ResolvedSemanticSchema;
|
|
14
21
|
readonly fetchEntities: (request: EntityFetchRequest) => Promise<readonly DataRow[]>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { LogicformType } from '../logicform-types';
|
|
2
|
+
import type { OperatorRegistry } from '../operators/index';
|
|
3
|
+
import type { ExecuteOptions, ExecuteResult, ExecuteSuccessResult } from './types';
|
|
4
|
+
/** Runtime operators are handled only as top-level projections. */
|
|
5
|
+
export declare const hasRuntimeProjection: (form: LogicformType, operators: OperatorRegistry) => boolean;
|
|
6
|
+
export declare const executeRuntime: (input: LogicformType, options: ExecuteOptions, operators: OperatorRegistry, executeNested: (form: LogicformType, options: ExecuteOptions) => Promise<ExecuteResult>) => Promise<ExecuteSuccessResult>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { DataRow } from '../physical/index';
|
|
2
|
+
import type { OrderPlan } from '../planner/index';
|
|
3
|
+
export declare const sampleEntityRows: (rows: readonly DataRow[], limit: number, orderBy: readonly OrderPlan[]) => {
|
|
4
|
+
readonly rows: DataRow[];
|
|
5
|
+
readonly total: number;
|
|
6
|
+
};
|
package/dist/executor/types.d.ts
CHANGED
|
@@ -67,10 +67,16 @@ interface ExecuteBaseOptions {
|
|
|
67
67
|
readonly locale?: string;
|
|
68
68
|
/** Additional or overriding locale files used by generated names and messages. */
|
|
69
69
|
readonly locales?: LocaleInput;
|
|
70
|
-
/** Table, row, and
|
|
70
|
+
/** Table, row, column, and custom metric permissions for this execution. */
|
|
71
71
|
readonly permissions?: Permissions;
|
|
72
72
|
readonly onProgress?: ProgressCallback;
|
|
73
73
|
readonly signal?: AbortSignal;
|
|
74
|
+
/** Application helpers (for example axios) passed to runtime Operators. SDK helper names are reserved. */
|
|
75
|
+
readonly runtimeHelpers?: Readonly<Record<string, unknown>>;
|
|
76
|
+
/** Application configuration passed as the third argument to a runtime Operator's run hook. */
|
|
77
|
+
readonly runtimeConfig?: Readonly<Record<string, unknown>>;
|
|
78
|
+
/** Skip entity expansion in this execution; the public result envelope remains unchanged. */
|
|
79
|
+
readonly result_only?: boolean;
|
|
74
80
|
/** Default time watermark policy; Schema and Property policies override it. */
|
|
75
81
|
readonly timeWatermark?: TimeWatermarkPolicy;
|
|
76
82
|
/** Resource limits for in-process combination of separate physical connections. */
|
|
@@ -81,9 +87,9 @@ interface ExecuteBaseOptions {
|
|
|
81
87
|
}
|
|
82
88
|
export interface ExecuteOptions extends ExecuteBaseOptions {
|
|
83
89
|
/** Physical mappings supplied as JSON definitions. */
|
|
84
|
-
readonly schemaMappings
|
|
90
|
+
readonly schemaMappings?: readonly SchemaMappingDefinition[];
|
|
85
91
|
/** Database connections addressable by SchemaMappingDefinition.connectionId. */
|
|
86
|
-
readonly connections
|
|
92
|
+
readonly connections?: readonly DatabaseConnection[];
|
|
87
93
|
/** Provider factories used for built-in or application-defined connection kinds. */
|
|
88
94
|
readonly providerRegistry?: ProviderRegistry;
|
|
89
95
|
/** JSON configuration for an internally owned and reused query-cache connection. */
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { DataRow } from '../physical/index';
|
|
2
|
+
export type CsvEncoding = 'auto' | 'utf-8' | 'gbk' | 'gb18030' | 'utf-16le' | 'utf-16be';
|
|
3
|
+
export type ImportFile = {
|
|
4
|
+
readonly path: string;
|
|
5
|
+
readonly format?: 'csv' | 'xlsx';
|
|
6
|
+
} | {
|
|
7
|
+
readonly data: Uint8Array;
|
|
8
|
+
readonly format: 'csv' | 'xlsx';
|
|
9
|
+
};
|
|
10
|
+
export interface ReadImportFileOptions {
|
|
11
|
+
readonly file: ImportFile;
|
|
12
|
+
readonly csv?: {
|
|
13
|
+
readonly encoding?: CsvEncoding;
|
|
14
|
+
readonly delimiter?: ',' | ';' | '\t' | '|';
|
|
15
|
+
};
|
|
16
|
+
readonly excel?: {
|
|
17
|
+
readonly sheet?: string;
|
|
18
|
+
readonly headerRow?: number;
|
|
19
|
+
};
|
|
20
|
+
/** Defaults to 50 MiB and 100,000 data rows. */
|
|
21
|
+
readonly maxBytes?: number;
|
|
22
|
+
readonly maxRows?: number;
|
|
23
|
+
readonly signal?: AbortSignal;
|
|
24
|
+
}
|
|
25
|
+
export interface ReadImportFileResult {
|
|
26
|
+
readonly format: 'csv' | 'xlsx';
|
|
27
|
+
readonly encoding?: Exclude<CsvEncoding, 'auto'>;
|
|
28
|
+
readonly sheet?: string;
|
|
29
|
+
readonly columns: readonly string[];
|
|
30
|
+
readonly rows: readonly DataRow[];
|
|
31
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -10,19 +10,22 @@ export { SemanticDBError } from './errors';
|
|
|
10
10
|
export { builtinSemanticTypes, createSemanticTypeRegistry, resolveSchema, SemanticTypeRegistry, validateResolvedSchema, } from './semantic-types/index';
|
|
11
11
|
export { builtinOperators, createOperatorRegistry, OperatorRegistry, resolveOperator, } from './operators/index';
|
|
12
12
|
export type { LegacySchemaPluginContext, MappingGranularityContext, MappingGranularityPlugin, OutputHandlerContext, OutputHandlerDefinition, IntervalSemanticProperties, IntervalSemanticsDefinition, PlannerPeriodDefinition, PlannerPeriodEvaluation, RelationSemanticsDefinition, RelationTemporalPlan, TimeWatermarkLogicformContext, PropertyMetadataPlugin, QueryOperatorCompileContext, QueryOperatorAuthorizeContext, QueryOperatorDefinition, QueryOperatorNormalizeContext, QueryOperatorPhysicalSource, QueryOperatorPlanContext, QueryOperatorPlanResult, SchemaMetadataPlugin, SchemaMappingPlugin, SemanticDBPlugin, } from './plugins/index';
|
|
13
|
-
export { SchemaMappingRegistry, fromYiAskSchemaMapping, getSupportedDimensions, } from './schema-mappings/index';
|
|
14
|
-
export type { AbsoluteDateValue, CompareOperator, DatePartQueryComparison, DatePartQueryOperand, DateTimeValue, DateValue, EntityIdType, ExpressionItemType, LogicformType, NumericQueryComparison, NumericQueryOperand, PublicLogicformType, PeriodShiftTime, PredItemType, QueryLogicalOperand, QueryExpressionType, RelationQueryType, QueryType, QueryValueType, QueryValueTypeWithCompareOperator, RelativeDateValue, RepresentationType, } from './logicform-types';
|
|
13
|
+
export { SchemaMappingRegistry, sourceIdentity, fromYiAskSchemaMapping, getSupportedDimensions, } from './schema-mappings/index';
|
|
14
|
+
export type { AbsoluteDateValue, CalendarDateQueryValue, CompareOperator, DatePartQueryComparison, DatePartQueryOperand, DateTimeValue, DateValue, EntityIdType, ExpressionItemType, LogicformType, LogicformSampleType, LogicformRandomDataOptions, LogicformRandomDataType, NumericQueryComparison, NumericQueryOperand, PublicLogicformType, PeriodShiftTime, PredItemType, QueryLogicalOperand, QueryExpressionType, RelationQueryType, QueryType, QueryValueType, QueryValueTypeWithCompareOperator, RelativeDateValue, RepresentationType, } from './logicform-types';
|
|
15
15
|
export type { RecursiveQueryType } from './plugins/index';
|
|
16
16
|
export type { PrimalType, PropertyHierarchyDefinition, PropertySqlDefinition, ResolvedSemanticProperty, ResolvedSemanticSchema, SemanticTypeNormalizeContext, SemanticPropertyDraft, SemanticSchemaDraft, SemanticTypeDefinition, SemanticTypeResultContext, SemanticTypeResultProperty, TimeGranularity, TimeWatermarkPolicy, } from './semantic-types/index';
|
|
17
17
|
export type { DataRow, SqlParameters, BuiltinDatabaseConnection, DatabaseConnection, DatabaseConnectionBase, DatabaseConnectionExtensions, ProviderDefinition, ProviderKind, ProviderKindExtensions, } from './physical/index';
|
|
18
18
|
export { DBConnector, ProviderRegistry } from './physical/index';
|
|
19
|
+
export { readImportFile } from './file-import/index';
|
|
20
|
+
export type { CsvEncoding, ImportFile, ReadImportFileOptions, ReadImportFileResult } from './file-import/index';
|
|
21
|
+
export type { DuckDBConnectionOptions, ImportColumn, ImportRowsRequest, ImportRowsResult, ImportFileOptions, ImportFileResult } from './physical/index';
|
|
19
22
|
export type { DBConnectorOptions, RunSQLOptions, GetTableListOptions, DescribeTableOptions, DescribeTableRequest, DatabaseColumn, TableDescription, DatabaseTable, SQLResult, TableListRequest, } from './physical/index';
|
|
20
|
-
export type { OperatorDefinition, OperatorDefaultNameContext, OperatorExecutionContext, OperatorComponentContext, OperatorComponentCalculation, OperatorComponentQuery, OperatorExecutionComponent, OperatorPlanInputContext, OperatorPlannedInput, OperatorGroupKeyShift, OperatorJavaScriptCalculation, OperatorQueryComponent,
|
|
21
|
-
export type { SchemaMappingDefinition, SchemaMappingEnrichmentDefinition, SchemaMappingEnrichmentKey, SchemaMappingItem, SchemaMappingGranularity, SchemaMappingGranularityExtensions, SchemaMappingPointTemporalDefinition, SchemaMappingPredDefinition, SchemaMappingPredMatch, SchemaMappingSelection, RejectedSchemaMapping, SourceFreshnessPolicy, YiAskSchemaMappingItem, YiAskSchemaMappingRecord, } from './schema-mappings/index';
|
|
23
|
+
export type { OperatorDefinition, OperatorDefaultNameContext, OperatorFormulaTextContext, OperatorExecutionContext, ResolvedTimeRange, OperatorComponentContext, OperatorComponentCalculation, OperatorComponentQuery, OperatorComponentLiteral, OperatorComponentInput, OperatorExecutionComponent, OperatorPlanInputContext, OperatorPlannedInput, OperatorGroupKeyShift, OperatorJavaScriptCalculation, OperatorQueryComponent, OperatorOutputPropertyContext, OperatorRuntimeHelpers, OperatorRuntimeConfig, OperatorRuntimeExecute, OperatorRuntimeRun, OperatorRuntimeValue, OperatorSqlCapabilities, OperatorSqlContext, ResultProperty, ResultPropertyTemporalMetadata, ResultPropertyTemporalMetadataExtensions, } from './operators/index';
|
|
24
|
+
export type { SchemaMappingDefinition, SchemaMappingSource, ResolvedMappingSource, PropertyMappingCalculation, PropertyMappingValue, PropertyMapping, PredItemMapping, IgnoredMapping, ComputationExpression, ComputationInput, SchemaMappingEnrichmentDefinition, SchemaMappingEnrichmentKey, SchemaMappingItem, QueryPathBinding, QueryPathMappingDefinition, SchemaMappingGranularity, SchemaMappingGranularityExtensions, SchemaMappingPointTemporalDefinition, SchemaMappingPredDefinition, SchemaMappingPredMatch, SchemaMappingSelection, RejectedSchemaMapping, SourceFreshnessPolicy, YiAskSchemaMappingItem, YiAskSchemaMappingRecord, } from './schema-mappings/index';
|
|
22
25
|
export { QueryCacheManager } from './cache/index';
|
|
23
26
|
export type { InvalidateQueryCacheSourceOptions, QueryCacheConfiguration, } from './cache/index';
|
|
24
27
|
export type { ExecuteOptions, ExecuteFailureResult, ExecuteProgressEvent, ExecuteResult, ExecuteSuccessResult, ExecutedSql, ExecutedSqlSchemaMapping, ExecutedSqlType, SqlExecutionSource, PartialExecuteResult, ProgressCallback, } from './executor/index';
|
|
25
|
-
export type { ColumnPermissions, Permissions, SchemaPermissions, } from './permissions/index';
|
|
28
|
+
export type { ColumnPermissions, MetricPermissions, Permissions, SchemaPermissions, } from './permissions/index';
|
|
26
29
|
export type { CreateLogicalPlanOptions, LogicalPlan, QueryLineage, } from './planner/index';
|
|
27
30
|
export { PlannerSemanticRegistry, createPlannerSemanticRegistry, } from './planner/index';
|
|
28
31
|
export type { PlannerSemanticResolution, PlannerSemanticQueryContext, PlannerSemanticRule, PlannerSemanticRuleContext, } from './planner/index';
|
|
@@ -3,7 +3,7 @@ export type RepresentationType = 'value' | 'table' | 'pie' | 'bar' | 'column' |
|
|
|
3
3
|
/** A concrete timestamp accepted by a LogicForm query. */
|
|
4
4
|
export type DateTimeValue = `${number}-${number}-${number} ${number}:${number}:${number}`;
|
|
5
5
|
/** A relative period resolved from the execution clock. */
|
|
6
|
-
export interface RelativeDateValue {
|
|
6
|
+
export interface RelativeDateValue extends AbsoluteDateValue {
|
|
7
7
|
readonly granularity: TimeGranularity;
|
|
8
8
|
readonly offset: number;
|
|
9
9
|
}
|
|
@@ -22,7 +22,14 @@ export interface AbsoluteDateValue {
|
|
|
22
22
|
/** Period reference used by operators such as `$periodShift`. */
|
|
23
23
|
export type PeriodShiftTime = RelativeDateValue | AbsoluteDateValue;
|
|
24
24
|
/** A date value before semantic-type normalization. */
|
|
25
|
-
export type DateValue = string | RelativeDateValue | AbsoluteDateValue;
|
|
25
|
+
export type DateValue = string | RelativeDateValue | AbsoluteDateValue | CalendarDateQueryValue;
|
|
26
|
+
/** Calendar selections; comparison components and finer parts become date-part filters. */
|
|
27
|
+
export type CalendarDateQueryValue = {
|
|
28
|
+
readonly [Part in Exclude<keyof AbsoluteDateValue, 'period'>]?: DatePartQueryOperand;
|
|
29
|
+
} & {
|
|
30
|
+
readonly granularity?: TimeGranularity;
|
|
31
|
+
readonly offset?: number;
|
|
32
|
+
};
|
|
26
33
|
/** Stable entity identity. Numeric IDs must be safe integers. */
|
|
27
34
|
export type EntityIdType = string | number;
|
|
28
35
|
export type CompareOperator = '$eq' | '$gt' | '$gte' | '$lt' | '$lte' | '$ne' | '$in' | '$nin' | '$exists' | '$regex' | '$contains' | '$startsWith' | '$length' | '$and' | '$or' | '$second' | '$minute' | '$hour' | '$weekday' | '$day' | '$week' | '$month' | '$quarter' | '$year' | Extract<keyof QueryOperatorExtensions, string>;
|
|
@@ -118,6 +125,16 @@ export interface LogicformOutputType {
|
|
|
118
125
|
type: LogicformOutputTypeValue;
|
|
119
126
|
filename?: string;
|
|
120
127
|
}
|
|
128
|
+
/** Enable uniform sampling of distinct entity rows; top-level limit controls the count. */
|
|
129
|
+
export type LogicformSampleType = boolean;
|
|
130
|
+
/** Presentation-only numeric perturbation; each output cell gets an independent multiplier. */
|
|
131
|
+
export interface LogicformRandomDataOptions {
|
|
132
|
+
/** Minimum multiplier (inclusive). Defaults to 0.1. */
|
|
133
|
+
readonly minFactor?: number;
|
|
134
|
+
/** Maximum multiplier (exclusive unless equal to minFactor). Defaults to 1.5. */
|
|
135
|
+
readonly maxFactor?: number;
|
|
136
|
+
}
|
|
137
|
+
export type LogicformRandomDataType = boolean | LogicformRandomDataOptions;
|
|
121
138
|
export interface LogicformType {
|
|
122
139
|
/** LogicForm protocol version. This SDK supports version 2.0 and later. */
|
|
123
140
|
version: string;
|
|
@@ -129,6 +146,9 @@ export interface LogicformType {
|
|
|
129
146
|
propertyResolve?: Readonly<Record<string, Readonly<Record<string, string>>>>;
|
|
130
147
|
groupby?: PredItemType[];
|
|
131
148
|
sort?: Record<string, 1 | -1>;
|
|
149
|
+
sample?: LogicformSampleType;
|
|
150
|
+
/** Perturb final scalar numeric values, excluding grouping keys and identities. Top-level only. */
|
|
151
|
+
randomData?: LogicformRandomDataType;
|
|
132
152
|
having?: QueryType;
|
|
133
153
|
output?: LogicformOutputType;
|
|
134
154
|
limit?: number;
|
|
@@ -3,7 +3,14 @@ import type { OperatorRegistry } from '../operators/index';
|
|
|
3
3
|
import type { ResolvedSemanticProperty, ResolvedSemanticSchema, SemanticTypeRegistry } from '../semantic-types/index';
|
|
4
4
|
import type { SemanticDBPlugin } from '../plugins/index';
|
|
5
5
|
import type { LocaleInput, LocaleRegistry } from '../i18n/index';
|
|
6
|
+
import type { ResolvedTimeRange } from '../operators/index';
|
|
6
7
|
export interface NormalizeLogicformOptions {
|
|
8
|
+
/** Reports only this call's main query, never nested or metric queries. */
|
|
9
|
+
readonly onTimeRangeResolved?: (range: ResolvedTimeRange | undefined) => void;
|
|
10
|
+
/** Internal recursion guard: sampling is a top-level result operation. */
|
|
11
|
+
readonly allowSample?: boolean;
|
|
12
|
+
/** Internal recursion guard: numeric perturbation applies only to the final result. */
|
|
13
|
+
readonly allowRandomData?: boolean;
|
|
7
14
|
readonly semanticTypes: SemanticTypeRegistry;
|
|
8
15
|
readonly operators?: OperatorRegistry;
|
|
9
16
|
readonly plugins?: readonly SemanticDBPlugin[];
|
|
@@ -2,3 +2,4 @@ export { normalizeLogicform } from './normalize-logicform';
|
|
|
2
2
|
export { defaultPredName } from './default-pred-name';
|
|
3
3
|
export { assertSupportedLogicformVersion } from './version';
|
|
4
4
|
export { inferPropertyResolvePath } from './property-resolve';
|
|
5
|
+
export { expandPublicLogicform } from './public-logicform';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ResolvedTimeRange } from '../operators/index';
|
|
2
|
+
import type { ResolvedSemanticProperty, ResolvedSemanticSchema, SemanticTypeNormalizeContext } from '../semantic-types/index';
|
|
3
|
+
/** Collect only the root query; metric, relation and nested LF queries never enter here. */
|
|
4
|
+
export declare class MainTimeRangeCollector {
|
|
5
|
+
#private;
|
|
6
|
+
invalidate(): void;
|
|
7
|
+
observe(schema: ResolvedSemanticSchema, property: ResolvedSemanticProperty, queryPath: readonly (string | number)[], customNormalization: boolean): SemanticTypeNormalizeContext['onDateQueryNormalized'];
|
|
8
|
+
get result(): ResolvedTimeRange | undefined;
|
|
9
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { LogicformType } from '../logicform-types';
|
|
2
|
+
import type { ResolvedSemanticSchema } from '../semantic-types/index';
|
|
3
|
+
/**
|
|
4
|
+
* The planner uses canonical relation paths (for example `customer_name`),
|
|
5
|
+
* while a LogicForm exposed to an application keeps the relation structure
|
|
6
|
+
* that the caller wrote. This is the public view of a normalized form.
|
|
7
|
+
*
|
|
8
|
+
* This conversion deliberately only changes relation paths. Scalar values,
|
|
9
|
+
* temporal bounds, generated predicates and operator arguments remain the
|
|
10
|
+
* values produced by the normalizer.
|
|
11
|
+
*/
|
|
12
|
+
type SchemaResolver = (schemaId: string) => ResolvedSemanticSchema;
|
|
13
|
+
export declare const expandPublicLogicform: (logicform: LogicformType, schema: ResolvedSemanticSchema, resolveSchema?: SchemaResolver, source?: LogicformType) => LogicformType;
|
|
14
|
+
export {};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ResolvedSemanticSchema } from '../semantic-types/index';
|
|
2
2
|
import type { LogicformType } from '../logicform-types';
|
|
3
3
|
import type { NormalizeLogicformOptions } from './core';
|
|
4
|
-
|
|
5
|
-
export declare const
|
|
4
|
+
import type { MainTimeRangeCollector } from './main-time-range';
|
|
5
|
+
export declare const normalizeQueryObject: (query: Readonly<Record<string, unknown>>, schema: ResolvedSemanticSchema, options: NormalizeLogicformOptions, timeRange?: MainTimeRangeCollector, queryPath?: readonly (string | number)[]) => Promise<Readonly<Record<string, unknown>>>;
|
|
6
|
+
export declare const normalizeQuery: (query: LogicformType["query"], schema: ResolvedSemanticSchema, options: NormalizeLogicformOptions, timeRange?: MainTimeRangeCollector) => Promise<LogicformType["query"]>;
|
|
@@ -1,2 +1,5 @@
|
|
|
1
1
|
import type { LocaleTranslate } from '../../i18n/index';
|
|
2
|
+
import type { OperatorFormulaTextContext } from '../types';
|
|
3
|
+
/** Describe the target period, rather than serializing the period-shift wire protocol. */
|
|
4
|
+
export declare const periodShiftFormulaText: ({ input, args }: OperatorFormulaTextContext) => string;
|
|
2
5
|
export declare const periodComparisonName: (args: Readonly<Record<string, unknown>>, locale: string, t?: LocaleTranslate) => string;
|
|
@@ -8,6 +8,6 @@ export interface ResolvedTimeRange {
|
|
|
8
8
|
readonly queryWithoutTime?: QueryType;
|
|
9
9
|
}
|
|
10
10
|
export declare const requireTimestampProperty: (schema: ResolvedSemanticSchema, operator: string) => ResolvedSemanticProperty;
|
|
11
|
-
export declare const resolveTimeRange: (query: QueryType, schema: ResolvedSemanticSchema, resolveSchema: (schemaId: string) => ResolvedSemanticSchema, operator: string) => ResolvedTimeRange;
|
|
12
|
-
export declare const resolvePredTimeRange: (logicformQuery: QueryType | undefined, pred: PredItemType, schema: ResolvedSemanticSchema, resolveSchema: (schemaId: string) => ResolvedSemanticSchema, operator: string) => ResolvedTimeRange;
|
|
11
|
+
export declare const resolveTimeRange: (query: QueryType, schema: ResolvedSemanticSchema, resolveSchema: (schemaId: string) => ResolvedSemanticSchema, operator: string, defaultBoundary?: string | number | Date) => ResolvedTimeRange;
|
|
12
|
+
export declare const resolvePredTimeRange: (logicformQuery: QueryType | undefined, pred: PredItemType, schema: ResolvedSemanticSchema, resolveSchema: (schemaId: string) => ResolvedSemanticSchema, operator: string, defaultBoundary?: string | number | Date) => ResolvedTimeRange;
|
|
13
13
|
export declare const withTimeCondition: (query: QueryType | undefined, propertyName: string, condition: unknown) => QueryType;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { OperatorDefinition, OperatorFormulaTextContext } from './types';
|
|
2
|
+
/** Keep arbitrary custom/SQL expressions grouped when another operator consumes them. */
|
|
3
|
+
export declare function groupFormulaText(formula: string): string;
|
|
4
|
+
export declare function groupFormulaText(formula: string | null): string | null;
|
|
5
|
+
export declare const functionFormulaText: (name: string) => (context: OperatorFormulaTextContext) => string;
|
|
6
|
+
/** Missing formulas stay null, including when consumed by another expression. */
|
|
7
|
+
export declare const operatorFormulaText: (operator: OperatorDefinition, context: Omit<OperatorFormulaTextContext, "input" | "inputs"> & {
|
|
8
|
+
readonly input?: string | null;
|
|
9
|
+
readonly inputs: readonly (string | null)[];
|
|
10
|
+
}) => string | null;
|
|
@@ -3,6 +3,7 @@ import { OperatorRegistry } from './registry';
|
|
|
3
3
|
export { OperatorRegistry } from './registry';
|
|
4
4
|
export { resolveOperator } from './resolve';
|
|
5
5
|
export { bindTrustedSqlExpression } from './sql-expression';
|
|
6
|
-
export
|
|
6
|
+
export { groupFormulaText, operatorFormulaText } from './formula-text';
|
|
7
|
+
export type { OperatorDefinition, OperatorDefaultNameContext, OperatorFormulaTextContext, OperatorExecutionContext, ResolvedTimeRange, OperatorComponentContext, OperatorComponentCalculation, OperatorComponentQuery, OperatorComponentLiteral, OperatorComponentInput, OperatorExecutionComponent, OperatorGroupKeyShift, OperatorJavaScriptCalculation, OperatorQueryComponent, OperatorOutputPropertyContext, OperatorPeriodBoundaryPolicy, OperatorPeriodBoundaryPolicyContext, OperatorNormalizePredContext, OperatorPlanExpressionContext, OperatorPeriodEvaluationContext, OperatorRuntimeHelpers, OperatorRuntimeConfig, OperatorRuntimeExecute, OperatorRuntimeRun, OperatorRuntimeValue, OperatorPlanInputContext, OperatorPlannedInput, OperatorRewriteLogicformContext, OperatorValidatePlanContext, OperatorSqlCapabilities, OperatorSqlContext, ResultProperty, ResultPropertyTemporalMetadata, ResultPropertyTemporalMetadataExtensions, } from './types';
|
|
7
8
|
export declare const builtinOperators: readonly import("./types").OperatorDefinition[];
|
|
8
9
|
export declare const createOperatorRegistry: (plugins?: readonly SemanticDBPlugin[]) => OperatorRegistry;
|
|
@@ -2,11 +2,18 @@ import type { OperatorDefinition, OperatorExecutionContext, OperatorPeriodEvalua
|
|
|
2
2
|
export declare class OperatorRegistry {
|
|
3
3
|
#private;
|
|
4
4
|
readonly executionContext: OperatorExecutionContext;
|
|
5
|
-
constructor(definitions?: readonly OperatorDefinition[], executionContext?: OperatorExecutionContext);
|
|
5
|
+
constructor(definitions?: readonly OperatorDefinition[], executionContext?: OperatorExecutionContext, builtinDefinitions?: readonly OperatorDefinition[]);
|
|
6
6
|
withExecutionContext(executionContext: OperatorExecutionContext): OperatorRegistry;
|
|
7
7
|
register(input: OperatorDefinition): this;
|
|
8
|
+
/** Built-in status comes from registry construction, never an operator's spelling. */
|
|
9
|
+
isBuiltin(name: string): boolean;
|
|
8
10
|
get(name: string): OperatorDefinition;
|
|
9
11
|
requiresPerPeriodEvaluation(name: string, context: OperatorPeriodEvaluationContext): boolean;
|
|
12
|
+
/** Whether this predicate needs an executor query component. */
|
|
13
|
+
isComponent(pred: {
|
|
14
|
+
readonly operator?: string;
|
|
15
|
+
readonly query?: Readonly<Record<string, unknown>>;
|
|
16
|
+
}): boolean;
|
|
10
17
|
has(name: string): boolean;
|
|
11
18
|
definitions(): readonly OperatorDefinition[];
|
|
12
19
|
}
|