semanticdb-v2 2.0.0-alpha.10 → 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.
Files changed (80) hide show
  1. package/README.md +39 -15
  2. package/dist/cache/types.d.ts +2 -1
  3. package/dist/compiler/compile-computation.d.ts +6 -0
  4. package/dist/compiler/compile-source.d.ts +5 -0
  5. package/dist/executor/component-properties.d.ts +22 -0
  6. package/dist/executor/components.d.ts +7 -3
  7. package/dist/executor/execute-query.d.ts +1 -0
  8. package/dist/executor/execute.d.ts +1 -1
  9. package/dist/executor/federated-execution.d.ts +2 -1
  10. package/dist/executor/fetch-entities.d.ts +2 -2
  11. package/dist/executor/index.d.ts +1 -1
  12. package/dist/executor/merge-by-id.d.ts +3 -0
  13. package/dist/executor/partition.d.ts +18 -0
  14. package/dist/executor/random-data.d.ts +5 -0
  15. package/dist/executor/result-hydrator/entity-fetch-conditions.d.ts +4 -0
  16. package/dist/executor/result-hydrator/index.d.ts +1 -0
  17. package/dist/executor/result-hydrator/types.d.ts +7 -0
  18. package/dist/executor/runtime-execution.d.ts +6 -0
  19. package/dist/executor/sample.d.ts +6 -0
  20. package/dist/executor/types.d.ts +23 -13
  21. package/dist/file-import/index.d.ts +2 -0
  22. package/dist/file-import/read-file.d.ts +2 -0
  23. package/dist/file-import/types.d.ts +31 -0
  24. package/dist/index.d.ts +11 -6
  25. package/dist/logicform/dimensions.d.ts +16 -0
  26. package/dist/logicform/index.d.ts +2 -0
  27. package/dist/logicform-types.d.ts +22 -2
  28. package/dist/normalizer/core.d.ts +8 -1
  29. package/dist/normalizer/index.d.ts +1 -0
  30. package/dist/normalizer/main-time-range.d.ts +9 -0
  31. package/dist/normalizer/public-logicform.d.ts +14 -0
  32. package/dist/normalizer/query.d.ts +3 -2
  33. package/dist/normalizer/random-data.d.ts +2 -0
  34. package/dist/operators/builtins/period-name.d.ts +3 -0
  35. package/dist/operators/builtins/time-range.d.ts +2 -2
  36. package/dist/operators/formula-text.d.ts +10 -0
  37. package/dist/operators/index.d.ts +2 -1
  38. package/dist/operators/registry.d.ts +8 -1
  39. package/dist/operators/types.d.ts +115 -25
  40. package/dist/permissions/index.d.ts +2 -1
  41. package/dist/permissions/metric-permissions.d.ts +9 -0
  42. package/dist/permissions/permissions.d.ts +4 -3
  43. package/dist/permissions/types.d.ts +5 -0
  44. package/dist/physical/connection.d.ts +4 -0
  45. package/dist/physical/db-connector.d.ts +10 -0
  46. package/dist/physical/duckdb-coordinator-provider.d.ts +3 -23
  47. package/dist/physical/duckdb-dataset.d.ts +23 -0
  48. package/dist/physical/duckdb-provider.d.ts +26 -0
  49. package/dist/physical/duckdb-sql.d.ts +33 -0
  50. package/dist/physical/import-types.d.ts +23 -0
  51. package/dist/physical/import-validation.d.ts +14 -0
  52. package/dist/physical/index.d.ts +4 -0
  53. package/dist/physical/postgresql-provider.d.ts +1 -0
  54. package/dist/physical/provider.d.ts +4 -0
  55. package/dist/planner/build-lineage.d.ts +1 -1
  56. package/dist/planner/create-logical-plan.d.ts +15 -2
  57. package/dist/planner/index.d.ts +3 -2
  58. package/dist/planner/mapping-granularity.d.ts +1 -1
  59. package/dist/planner/materialize-computations.d.ts +3 -0
  60. package/dist/planner/select-schema-mapping.d.ts +16 -1
  61. package/dist/planner/types.d.ts +52 -9
  62. package/dist/planner/udf-inputs.d.ts +6 -0
  63. package/dist/plugins/types.d.ts +4 -2
  64. package/dist/schema/index.d.ts +1 -0
  65. package/dist/schema/relation-keys.d.ts +11 -0
  66. package/dist/schema-mappings/computations.d.ts +3 -0
  67. package/dist/schema-mappings/index.d.ts +5 -1
  68. package/dist/schema-mappings/registry.d.ts +1 -0
  69. package/dist/schema-mappings/source.d.ts +11 -0
  70. package/dist/schema-mappings/sql-inputs.d.ts +7 -0
  71. package/dist/schema-mappings/supported-dimensions.d.ts +10 -0
  72. package/dist/schema-mappings/types.d.ts +107 -15
  73. package/dist/schema-mappings/yiask.d.ts +6 -18
  74. package/dist/semantic-types/index.d.ts +1 -1
  75. package/dist/semantic-types/types.d.ts +50 -2
  76. package/dist/semanticdb.esm.js +6 -5
  77. package/dist/semanticdb.js +6 -5
  78. package/dist/utils/format-date.d.ts +3 -0
  79. package/package.json +5 -3
  80. package/dist/executor/evaluate.d.ts +0 -4
@@ -1,5 +1,6 @@
1
1
  import type { PropertyTypeDraft, SchemaTypeDraft } from 'semanticdb-core';
2
- import type { LogicformType, PredItemType } from '../logicform-types';
2
+ import type dayjs from 'dayjs';
3
+ import type { LogicformType, PredItemType, QueryType } from '../logicform-types';
3
4
  /** Canonical primitive types use `entity`; `object` remains a legacy input alias. */
4
5
  export type PrimalType = 'string' | 'number' | 'boolean' | 'date' | 'entity' | 'object';
5
6
  export type TimeGranularity = 'second' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'quarter' | 'year';
@@ -21,6 +22,31 @@ export interface PropertyHierarchyDefinition {
21
22
  readonly up?: string;
22
23
  readonly down?: string;
23
24
  }
25
+ /** One additive query slice. Candidates are tried in order and must cover the slice. */
26
+ export interface LogicformPartitionShard {
27
+ readonly query: QueryType;
28
+ readonly mappingCandidates: readonly string[];
29
+ }
30
+ export interface LogicformPartitionContext {
31
+ readonly dayjs: typeof dayjs;
32
+ /** Alias for dayjs; this does not provide the Moment.js API. */
33
+ readonly moment: typeof dayjs;
34
+ readonly schemas: Readonly<Record<string, ResolvedSemanticSchema>>;
35
+ readonly schemaMappings: readonly {
36
+ readonly id?: string;
37
+ readonly schemaId: string;
38
+ readonly priority?: number;
39
+ }[];
40
+ /** Runs within the same execution context. A pinned mapping bypasses its Schema partition hook. */
41
+ readonly execute: (logicform: LogicformType, options?: {
42
+ readonly mappingId?: string;
43
+ }) => Promise<{
44
+ readonly result: readonly Readonly<Record<string, unknown>>[];
45
+ }>;
46
+ }
47
+ export type LogicformPartition = (logicform: LogicformType, context: LogicformPartitionContext) => Promise<{
48
+ readonly shards: readonly LogicformPartitionShard[];
49
+ }>;
24
50
  /** Extension point for plugin-owned Schema draft metadata. */
25
51
  export interface SemanticSchemaMetadata {
26
52
  }
@@ -30,9 +56,20 @@ export interface ResolvedSemanticSchemaMetadata {
30
56
  /** Extension point for legacy plugin metadata removed from the canonical Schema shape. */
31
57
  export interface LegacySemanticSchemaMetadata {
32
58
  }
33
- export interface SemanticPropertyDraft extends Omit<PropertyTypeDraft, '_id' | '_sid' | 'id' | 'sid' | 'type' | 'primal_type' | 'isArray' | 'granularity' | 'is_observation' | 'is_snapshot' | 'temporalSemantics' | 'is_dynamic' | 'udf' | 'is_comparable' | 'comparable_order' | 'hierarchy'> {
59
+ export interface SemanticPropertyDraft extends Omit<PropertyTypeDraft, '_id' | '_sid' | 'id' | 'sid' | 'type' | 'primal_type' | 'isArray' | 'granularity' | 'is_observation' | 'is_snapshot' | 'temporalSemantics' | 'is_dynamic' | 'udf' | 'is_comparable' | 'comparable_order' | 'hierarchy' | 'componentProperties'> {
34
60
  readonly id?: string;
61
+ /** Readable calculation exposed on result Schema properties. */
62
+ readonly formulaText?: string | null;
35
63
  readonly type: string;
64
+ /** Relationship cardinality declared by the caller. */
65
+ readonly ref_cardinality?: 'one-to-one' | 'many-to-one' | 'one-to-many' | 'many-to-many';
66
+ /** Caller-supplied virtual relation; scalar one-to-one objects are reverse references. */
67
+ readonly is_virtual?: boolean;
68
+ /** Optional provenance to disambiguate the original reverse-reference foreign key. */
69
+ readonly reverse_ref?: {
70
+ readonly schemaId: string;
71
+ readonly propertyId: string;
72
+ };
36
73
  readonly primal_type?: PrimalType;
37
74
  readonly isArray?: boolean;
38
75
  readonly granularity?: TimeGranularity;
@@ -40,24 +77,33 @@ export interface SemanticPropertyDraft extends Omit<PropertyTypeDraft, '_id' | '
40
77
  readonly is_dynamic?: boolean;
41
78
  readonly udf?: PropertySqlDefinition;
42
79
  readonly comparable?: ComparableCategoryDefinition;
80
+ readonly componentProperties?: readonly SemanticPropertyDraft[];
43
81
  }
44
82
  export interface ResolvedSemanticProperty extends Omit<SemanticPropertyDraft, 'id' | 'primal_type' | 'isArray' | 'is_dynamic'> {
45
83
  readonly id: string;
46
84
  readonly primal_type: PrimalType;
47
85
  readonly isArray: boolean;
48
86
  readonly is_dynamic?: boolean;
87
+ /** Child metric metadata exposed on computed result Schema properties. */
88
+ readonly componentProperties?: readonly ResolvedSemanticProperty[];
49
89
  }
50
90
  export interface SemanticSchemaDraft extends Omit<SchemaTypeDraft, '_id' | 'id' | 'sid' | 'properties' | 'db' | 'from' | 'fromSQL' | 'projections' | keyof SemanticSchemaMetadata | keyof LegacySemanticSchemaMetadata>, SemanticSchemaMetadata {
51
91
  readonly [key: string]: unknown;
52
92
  readonly id: string;
93
+ /** Registered custom aggregate/component/runtime operator names available on this Schema. */
94
+ readonly metrics?: readonly string[];
53
95
  /** Marks the single Schema whose complete rows are loaded as calendar execution context. */
54
96
  readonly is_calendar?: boolean;
97
+ readonly partition?: LogicformPartition;
55
98
  readonly properties: readonly SemanticPropertyDraft[];
56
99
  }
57
100
  export interface ResolvedSemanticSchema extends Omit<SchemaTypeDraft, '_id' | 'id' | 'sid' | 'properties' | 'db' | 'from' | 'fromSQL' | 'projections' | keyof SemanticSchemaMetadata | keyof LegacySemanticSchemaMetadata>, ResolvedSemanticSchemaMetadata {
58
101
  readonly [key: string]: unknown;
59
102
  readonly id: string;
103
+ /** Registered custom aggregate/component/runtime operator names available on this Schema. */
104
+ readonly metrics?: readonly string[];
60
105
  readonly is_calendar?: boolean;
106
+ readonly partition?: LogicformPartition;
61
107
  readonly properties: readonly ResolvedSemanticProperty[];
62
108
  }
63
109
  export interface SemanticTypeNormalizeContext {
@@ -65,6 +111,8 @@ export interface SemanticTypeNormalizeContext {
65
111
  readonly property: ResolvedSemanticProperty;
66
112
  readonly now: Date;
67
113
  readonly requestTimeWatermark: (requestedUpperBound: Date) => Promise<Date | undefined>;
114
+ /** Observe a complete date condition without changing its normalization semantics. */
115
+ readonly onDateQueryNormalized?: (requested: unknown, effective: unknown, timeWatermark?: Date) => void;
68
116
  }
69
117
  /** Context used when deciding whether a value must be evaluated per time period. */
70
118
  export interface SemanticPeriodEvaluationContext {