@cohesivesystems/relations 0.1.0-alpha.15 → 0.1.0-alpha.151

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.
@@ -1,5 +1,312 @@
1
+ export type GraphDeltaKind = 'Unspecified' | 'Overlay' | 'Version';
2
+ export declare const graphDeltaKinds: {
3
+ readonly unspecified: "Unspecified";
4
+ readonly overlay: "Overlay";
5
+ readonly version: "Version";
6
+ };
7
+ export declare const graphDeltaKindLabels: Record<GraphDeltaKind, string>;
1
8
  export type GraphId = string;
9
+ export type GraphDeltaOperation = {
10
+ readonly $operation: 'addShape';
11
+ } & AddShapeOperation | {
12
+ readonly $operation: 'removeShape';
13
+ } & RemoveShapeOperation | {
14
+ readonly $operation: 'replaceShape';
15
+ } & ReplaceShapeOperation | {
16
+ readonly $operation: 'setGraphAnnotation';
17
+ } & SetGraphAnnotationOperation | {
18
+ readonly $operation: 'removeGraphAnnotation';
19
+ } & RemoveGraphAnnotationOperation | {
20
+ readonly $operation: 'addNamedType';
21
+ } & AddNamedTypeOperation | {
22
+ readonly $operation: 'removeNamedType';
23
+ } & RemoveNamedTypeOperation | {
24
+ readonly $operation: 'replaceNamedType';
25
+ } & ReplaceNamedTypeOperation | {
26
+ readonly $operation: 'addShapeField';
27
+ } & AddShapeFieldOperation | {
28
+ readonly $operation: 'removeShapeField';
29
+ } & RemoveShapeFieldOperation | {
30
+ readonly $operation: 'replaceShapeField';
31
+ } & ReplaceShapeFieldOperation | {
32
+ readonly $operation: 'addTypeField';
33
+ } & AddTypeFieldOperation | {
34
+ readonly $operation: 'removeTypeField';
35
+ } & RemoveTypeFieldOperation | {
36
+ readonly $operation: 'replaceTypeField';
37
+ } & ReplaceTypeFieldOperation | {
38
+ readonly $operation: 'setFieldType';
39
+ } & SetFieldTypeOperation | {
40
+ readonly $operation: 'setFieldPresence';
41
+ } & SetFieldPresenceOperation | {
42
+ readonly $operation: 'setFieldCardinality';
43
+ } & SetFieldCardinalityOperation | {
44
+ readonly $operation: 'setFieldNullability';
45
+ } & SetFieldNullabilityOperation | {
46
+ readonly $operation: 'addFieldConstraint';
47
+ } & AddFieldConstraintOperation | {
48
+ readonly $operation: 'removeFieldConstraint';
49
+ } & RemoveFieldConstraintOperation | {
50
+ readonly $operation: 'setShapeAnnotation';
51
+ } & SetShapeAnnotationOperation | {
52
+ readonly $operation: 'removeShapeAnnotation';
53
+ } & RemoveShapeAnnotationOperation | {
54
+ readonly $operation: 'setTypeAnnotation';
55
+ } & SetTypeAnnotationOperation | {
56
+ readonly $operation: 'removeTypeAnnotation';
57
+ } & RemoveTypeAnnotationOperation | {
58
+ readonly $operation: 'setFieldAnnotation';
59
+ } & SetFieldAnnotationOperation | {
60
+ readonly $operation: 'removeFieldAnnotation';
61
+ } & RemoveFieldAnnotationOperation | {
62
+ readonly $operation: 'restrictAllowedValues';
63
+ } & RestrictAllowedValuesOperation | {
64
+ readonly $operation: 'extendAllowedValues';
65
+ } & ExtendAllowedValuesOperation | {
66
+ readonly $operation: 'addEnumValue';
67
+ } & AddEnumValueOperation | {
68
+ readonly $operation: 'removeEnumValue';
69
+ } & RemoveEnumValueOperation;
70
+ export interface AddShapeOperation {
71
+ shape: Shape;
72
+ ordinal?: number | null;
73
+ note?: string | null;
74
+ }
75
+ export interface RemoveShapeOperation {
76
+ note?: string | null;
77
+ shapeId: ShapeId;
78
+ }
79
+ export interface ReplaceShapeOperation {
80
+ note?: string | null;
81
+ shape: Shape;
82
+ }
83
+ export interface SetGraphAnnotationOperation {
84
+ note?: string | null;
85
+ key: AnnotationKey;
86
+ value: AnnotationValue;
87
+ }
88
+ export interface RemoveGraphAnnotationOperation {
89
+ note?: string | null;
90
+ key: AnnotationKey;
91
+ }
92
+ export interface AddNamedTypeOperation {
93
+ type: TypeDefinition;
94
+ ordinal?: number | null;
95
+ note?: string | null;
96
+ }
97
+ export interface RemoveNamedTypeOperation {
98
+ note?: string | null;
99
+ typeId: TypeId;
100
+ }
101
+ export interface ReplaceNamedTypeOperation {
102
+ note?: string | null;
103
+ type: TypeDefinition;
104
+ }
105
+ export interface AddShapeFieldOperation {
106
+ shapeId: ShapeId;
107
+ field: FieldDefinition;
108
+ ordinal?: number | null;
109
+ note?: string | null;
110
+ }
111
+ export interface RemoveShapeFieldOperation {
112
+ note?: string | null;
113
+ shapeId: ShapeId;
114
+ fieldName: FieldName;
115
+ replacementPath?: string | null;
116
+ }
117
+ export interface ReplaceShapeFieldOperation {
118
+ note?: string | null;
119
+ shapeId: ShapeId;
120
+ field: FieldDefinition;
121
+ }
122
+ export interface AddTypeFieldOperation {
123
+ typeId: TypeId;
124
+ field: StructuralField;
125
+ ordinal?: number | null;
126
+ note?: string | null;
127
+ }
128
+ export interface RemoveTypeFieldOperation {
129
+ note?: string | null;
130
+ typeId: TypeId;
131
+ fieldName: FieldName;
132
+ replacementPath?: string | null;
133
+ }
134
+ export interface ReplaceTypeFieldOperation {
135
+ note?: string | null;
136
+ typeId: TypeId;
137
+ field: StructuralField;
138
+ }
139
+ export interface SetFieldTypeOperation {
140
+ note?: string | null;
141
+ target: GraphFieldPath;
142
+ type: TypeRef;
143
+ }
144
+ export interface SetFieldPresenceOperation {
145
+ note?: string | null;
146
+ target: GraphFieldPath;
147
+ presence: FieldPresence;
148
+ }
149
+ export interface SetFieldCardinalityOperation {
150
+ note?: string | null;
151
+ target: GraphFieldPath;
152
+ cardinality: FieldCardinality;
153
+ }
154
+ export interface SetFieldNullabilityOperation {
155
+ note?: string | null;
156
+ target: GraphFieldPath;
157
+ nullability: FieldNullability;
158
+ }
159
+ export interface AddFieldConstraintOperation {
160
+ target: GraphFieldPath;
161
+ constraint: ShapeConstraint;
162
+ note?: string | null;
163
+ }
164
+ export interface RemoveFieldConstraintOperation {
165
+ note?: string | null;
166
+ target: GraphFieldPath;
167
+ constraint: ShapeConstraint;
168
+ }
169
+ export interface SetShapeAnnotationOperation {
170
+ note?: string | null;
171
+ shapeId: ShapeId;
172
+ key: AnnotationKey;
173
+ value: AnnotationValue;
174
+ }
175
+ export interface RemoveShapeAnnotationOperation {
176
+ note?: string | null;
177
+ shapeId: ShapeId;
178
+ key: AnnotationKey;
179
+ }
180
+ export interface SetTypeAnnotationOperation {
181
+ note?: string | null;
182
+ typeId: TypeId;
183
+ key: AnnotationKey;
184
+ value: AnnotationValue;
185
+ }
186
+ export interface RemoveTypeAnnotationOperation {
187
+ note?: string | null;
188
+ typeId: TypeId;
189
+ key: AnnotationKey;
190
+ }
191
+ export interface SetFieldAnnotationOperation {
192
+ note?: string | null;
193
+ target: GraphFieldPath;
194
+ key: AnnotationKey;
195
+ value: AnnotationValue;
196
+ }
197
+ export interface RemoveFieldAnnotationOperation {
198
+ note?: string | null;
199
+ target: GraphFieldPath;
200
+ key: AnnotationKey;
201
+ }
202
+ export interface RestrictAllowedValuesOperation {
203
+ note?: string | null;
204
+ target: GraphFieldPath;
205
+ values: string[];
206
+ }
207
+ export interface ExtendAllowedValuesOperation {
208
+ target: GraphFieldPath;
209
+ values: string[];
210
+ note?: string | null;
211
+ }
212
+ export interface AddEnumValueOperation {
213
+ typeId: TypeId;
214
+ value: EnumValue;
215
+ note?: string | null;
216
+ }
217
+ export interface RemoveEnumValueOperation {
218
+ note?: string | null;
219
+ typeId: TypeId;
220
+ valueName: string;
221
+ }
222
+ export type AnnotationKey = string;
223
+ export type AnnotationValue = unknown;
2
224
  export type ShapeId = string;
225
+ export interface ShapeGraphDocumentMetadata {
226
+ origin: DocumentOrigin;
227
+ name?: string | null;
228
+ description?: string | null;
229
+ sourceUri?: string | null;
230
+ createdAtUtc?: string | null;
231
+ updatedAtUtc?: string | null;
232
+ annotations: Record<string, AnnotationValue>;
233
+ }
234
+ export interface ShapeGraph {
235
+ id: GraphId;
236
+ shapes: Shape[];
237
+ namedTypes: TypeDefinition[];
238
+ annotations: Record<string, AnnotationValue>;
239
+ diagnostics: GraphDiagnostic[];
240
+ hasErrors: boolean;
241
+ }
242
+ export type TypeRef = {
243
+ readonly $type: 'named';
244
+ } & NamedTypeRef | {
245
+ readonly $type: 'opaque';
246
+ } & OpaqueRuntimeTypeRef | {
247
+ readonly $type: 'scalar';
248
+ } & ScalarTypeRef | {
249
+ readonly $type: 'enum';
250
+ } & EnumTypeRef | {
251
+ readonly $type: 'entityRef';
252
+ } & EntityReferenceTypeRef | {
253
+ readonly $type: 'array';
254
+ } & ArrayTypeRef | {
255
+ readonly $type: 'object';
256
+ } & ObjectTypeRef | {
257
+ readonly $type: 'quantity';
258
+ } & QuantityTypeRef | {
259
+ readonly $type: 'json';
260
+ } & JsonTypeRef;
261
+ export interface NamedTypeRef {
262
+ typeId: TypeId;
263
+ }
264
+ export interface OpaqueRuntimeTypeRef {
265
+ runtimeType: string;
266
+ inferenceDiagnostic?: TypeInferenceDiagnostic | null;
267
+ }
268
+ export interface ScalarTypeRef {
269
+ kind: ScalarTypeKind;
270
+ format: PrimitiveFormat;
271
+ }
272
+ export interface EnumTypeRef {
273
+ name: string;
274
+ members: string[];
275
+ }
276
+ export interface EntityReferenceTypeRef {
277
+ entity: EntityTypeName;
278
+ }
279
+ export interface ArrayTypeRef {
280
+ elementType: TypeRef;
281
+ }
282
+ export interface ObjectTypeRef {
283
+ fields: ObjectFieldTypeDef[];
284
+ }
285
+ export interface QuantityTypeRef {
286
+ quantity: string;
287
+ baseKind: ScalarTypeKind;
288
+ }
289
+ export interface JsonTypeRef {
290
+ kind: JsonTypeKind;
291
+ }
292
+ export type FieldCardinality = 'Single' | 'Many';
293
+ export declare const fieldCardinalities: {
294
+ readonly single: "Single";
295
+ readonly many: "Many";
296
+ };
297
+ export declare const fieldCardinalityLabels: Record<FieldCardinality, string>;
298
+ export type FieldPresence = 'Required' | 'Optional';
299
+ export declare const fieldPresences: {
300
+ readonly required: "Required";
301
+ readonly optional: "Optional";
302
+ };
303
+ export declare const fieldPresenceLabels: Record<FieldPresence, string>;
304
+ export type FieldNullability = 'NonNullable' | 'Nullable';
305
+ export declare const fieldNullabilities: {
306
+ readonly nonNullable: "NonNullable";
307
+ readonly nullable: "Nullable";
308
+ };
309
+ export declare const fieldNullabilityLabels: Record<FieldNullability, string>;
3
310
  export type RelationQueryExplainStage = {
4
311
  readonly $stage: 'staticCompilation';
5
312
  } & RelationQueryStaticCompilationExplainStage | {
@@ -333,6 +640,7 @@ export interface QueryDefinition {
333
640
  id: QueryId;
334
641
  name: QueryName;
335
642
  results: QueryResultDefinition[];
643
+ assembly?: NestedQueryResultAssembly | null;
336
644
  body: LogicalQueryDefinition;
337
645
  }
338
646
  export interface RelationQueryDefinitionFingerprint {
@@ -370,6 +678,198 @@ export interface RelationshipCatalogDocumentMetadata {
370
678
  updatedAtUtc?: string | null;
371
679
  annotations: Record<string, AnnotationValue>;
372
680
  }
681
+ export interface Shape {
682
+ id: ShapeId;
683
+ fields: FieldDefinition[];
684
+ constraints: ShapeConstraint[];
685
+ annotations: Record<string, AnnotationValue>;
686
+ role?: string | null;
687
+ entityType?: EntityTypeName | null;
688
+ }
689
+ export type TypeDefinition = {
690
+ readonly $typeDef: 'structural';
691
+ } & Structural | {
692
+ readonly $typeDef: 'enum';
693
+ } & Enum | {
694
+ readonly $typeDef: 'union';
695
+ } & Union;
696
+ export interface Structural {
697
+ id: TypeId;
698
+ name: string;
699
+ fields: StructuralField[];
700
+ constraints: ShapeConstraint[];
701
+ annotations: Record<string, AnnotationValue>;
702
+ }
703
+ export interface Enum {
704
+ id: TypeId;
705
+ name: string;
706
+ underlying: PrimitiveType;
707
+ values: EnumValue[];
708
+ annotations: Record<string, AnnotationValue>;
709
+ }
710
+ export interface Union {
711
+ id: TypeId;
712
+ name: string;
713
+ discriminator: UnionDiscriminator;
714
+ cases: UnionCase[];
715
+ annotations: Record<string, AnnotationValue>;
716
+ }
717
+ export type TypeId = string;
718
+ export interface FieldDefinition {
719
+ name: FieldName;
720
+ type: TypeRef;
721
+ cardinality: FieldCardinality;
722
+ presence: FieldPresence;
723
+ role: FieldRole;
724
+ nullability: FieldNullability;
725
+ mutability: FieldMutability;
726
+ compute?: ComputeDefinition | null;
727
+ constraints: ShapeConstraint[];
728
+ annotations: Record<string, AnnotationValue>;
729
+ }
730
+ export type FieldName = string;
731
+ export interface StructuralField {
732
+ name: FieldName;
733
+ type: TypeRef;
734
+ cardinality: FieldCardinality;
735
+ presence: FieldPresence;
736
+ nullability: FieldNullability;
737
+ role: FieldRole;
738
+ constraints: ShapeConstraint[];
739
+ annotations: Record<string, AnnotationValue>;
740
+ }
741
+ export interface GraphFieldPath {
742
+ shapeId?: ShapeId | null;
743
+ typeId?: TypeId | null;
744
+ path: FieldPath;
745
+ }
746
+ export type ShapeConstraint = {
747
+ readonly $constraint: 'required';
748
+ } & RequiredConstraint | {
749
+ readonly $constraint: 'minLength';
750
+ } & MinLengthConstraint | {
751
+ readonly $constraint: 'maxLength';
752
+ } & MaxLengthConstraint | {
753
+ readonly $constraint: 'range';
754
+ } & RangeConstraint | {
755
+ readonly $constraint: 'regex';
756
+ } & RegexConstraint | {
757
+ readonly $constraint: 'allowedValues';
758
+ } & AllowedValuesConstraint | {
759
+ readonly $constraint: 'occurrence';
760
+ } & OccurrenceConstraint;
761
+ export interface RequiredConstraint {
762
+ field?: FieldPath | null;
763
+ message?: string | null;
764
+ }
765
+ export interface MinLengthConstraint {
766
+ value: number;
767
+ field?: FieldPath | null;
768
+ message?: string | null;
769
+ }
770
+ export interface MaxLengthConstraint {
771
+ value: number;
772
+ field?: FieldPath | null;
773
+ message?: string | null;
774
+ }
775
+ export interface RangeConstraint {
776
+ minimum?: number | null;
777
+ maximum?: number | null;
778
+ field?: FieldPath | null;
779
+ message?: string | null;
780
+ }
781
+ export interface RegexConstraint {
782
+ pattern: string;
783
+ field?: FieldPath | null;
784
+ message?: string | null;
785
+ }
786
+ export interface AllowedValuesConstraint {
787
+ values: string[];
788
+ field?: FieldPath | null;
789
+ message?: string | null;
790
+ }
791
+ export interface OccurrenceConstraint {
792
+ minimum?: number | null;
793
+ maximum?: number | null;
794
+ field?: FieldPath | null;
795
+ message?: string | null;
796
+ }
797
+ export interface EnumValue {
798
+ name: string;
799
+ value?: string | null;
800
+ label?: string | null;
801
+ description?: string | null;
802
+ }
803
+ export type DocumentOrigin = 'Unknown' | 'User' | 'System' | 'Imported' | 'Generated' | 'Compiled' | 'Extracted';
804
+ export declare const documentOrigins: {
805
+ readonly unknown: "Unknown";
806
+ readonly user: "User";
807
+ readonly system: "System";
808
+ readonly imported: "Imported";
809
+ readonly generated: "Generated";
810
+ readonly compiled: "Compiled";
811
+ readonly extracted: "Extracted";
812
+ };
813
+ export declare const documentOriginLabels: Record<DocumentOrigin, string>;
814
+ export interface GraphDiagnostic {
815
+ id: DiagnosticId;
816
+ severity: DiagnosticSeverity;
817
+ message: string;
818
+ shapeId?: ShapeId | null;
819
+ fieldIdentity?: string | null;
820
+ typeId?: TypeId | null;
821
+ }
822
+ export interface TypeInferenceDiagnostic {
823
+ reason: string;
824
+ message?: string | null;
825
+ }
826
+ export type ScalarTypeKind = 'Bool' | 'Int32' | 'Int64' | 'Decimal' | 'String' | 'Guid' | 'Date' | 'DateTime' | 'Instant' | 'Bytes';
827
+ export declare const scalarTypeKinds: {
828
+ readonly bool: "Bool";
829
+ readonly int32: "Int32";
830
+ readonly int64: "Int64";
831
+ readonly decimal: "Decimal";
832
+ readonly string: "String";
833
+ readonly guid: "Guid";
834
+ readonly date: "Date";
835
+ readonly dateTime: "DateTime";
836
+ readonly instant: "Instant";
837
+ readonly bytes: "Bytes";
838
+ };
839
+ export declare const scalarTypeKindLabels: Record<ScalarTypeKind, string>;
840
+ export type PrimitiveFormat = 'None' | 'Uuid' | 'IsoDate' | 'IsoDateTime' | 'IsoInstant' | 'CurrencyCode' | 'CountryCode' | 'Email' | 'Uri' | 'Base64';
841
+ export declare const primitiveFormats: {
842
+ readonly none: "None";
843
+ readonly uuid: "Uuid";
844
+ readonly isoDate: "IsoDate";
845
+ readonly isoDateTime: "IsoDateTime";
846
+ readonly isoInstant: "IsoInstant";
847
+ readonly currencyCode: "CurrencyCode";
848
+ readonly countryCode: "CountryCode";
849
+ readonly email: "Email";
850
+ readonly uri: "Uri";
851
+ readonly base64: "Base64";
852
+ };
853
+ export declare const primitiveFormatLabels: Record<PrimitiveFormat, string>;
854
+ export type EntityTypeName = string;
855
+ export interface ObjectFieldTypeDef {
856
+ name: string;
857
+ type: TypeRef;
858
+ cardinality: FieldCardinality;
859
+ presence: FieldPresence;
860
+ nullability: FieldNullability;
861
+ annotations: Record<string, AnnotationValue>;
862
+ }
863
+ export type JsonTypeKind = 'Any' | 'Object' | 'Array' | 'String' | 'Number' | 'Boolean';
864
+ export declare const jsonTypeKinds: {
865
+ readonly any: "Any";
866
+ readonly object: "Object";
867
+ readonly array: "Array";
868
+ readonly string: "String";
869
+ readonly number: "Number";
870
+ readonly boolean: "Boolean";
871
+ };
872
+ export declare const jsonTypeKindLabels: Record<JsonTypeKind, string>;
373
873
  export type RelationQueryExplainStageStatus = 'Complete' | 'Unavailable' | 'Invalid' | 'Incomplete' | 'Failed';
374
874
  export declare const relationQueryExplainStageStatuses: {
375
875
  readonly complete: "Complete";
@@ -859,19 +1359,6 @@ export interface InvariantDefinition {
859
1359
  expression: Expr;
860
1360
  message?: string | null;
861
1361
  }
862
- export type DocumentOrigin = 'Unknown' | 'User' | 'System' | 'Imported' | 'Generated' | 'Compiled' | 'Extracted';
863
- export declare const documentOrigins: {
864
- readonly unknown: "Unknown";
865
- readonly user: "User";
866
- readonly system: "System";
867
- readonly imported: "Imported";
868
- readonly generated: "Generated";
869
- readonly compiled: "Compiled";
870
- readonly extracted: "Extracted";
871
- };
872
- export declare const documentOriginLabels: Record<DocumentOrigin, string>;
873
- export type AnnotationKey = string;
874
- export type AnnotationValue = unknown;
875
1362
  export interface RelationDraftProducerArtifactReference {
876
1363
  kind: string;
877
1364
  value: string;
@@ -905,6 +1392,13 @@ export interface AggregationQueryResultDefinition {
905
1392
  id: QueryResultId;
906
1393
  input: QueryNodeId;
907
1394
  }
1395
+ export interface NestedQueryResultAssembly {
1396
+ result: QueryResultId;
1397
+ shape: QualifiedShapeId;
1398
+ identity: FieldPath;
1399
+ fields: QueryResultFieldMapping[];
1400
+ collections: QueryResultCollectionAssembly[];
1401
+ }
908
1402
  export interface RelationshipDefinition {
909
1403
  id: RelationshipId;
910
1404
  sourceShape: QualifiedShapeId;
@@ -913,6 +1407,49 @@ export interface RelationshipDefinition {
913
1407
  targetKey: RelationshipTargetKey;
914
1408
  sourceReferenceUniqueness: SourceReferenceUniqueness;
915
1409
  }
1410
+ export type PrimitiveType = 'Bool' | 'Int32' | 'Int64' | 'Decimal' | 'String' | 'Guid' | 'Date' | 'DateTime' | 'Instant' | 'Bytes';
1411
+ export declare const primitiveTypes: {
1412
+ readonly bool: "Bool";
1413
+ readonly int32: "Int32";
1414
+ readonly int64: "Int64";
1415
+ readonly decimal: "Decimal";
1416
+ readonly string: "String";
1417
+ readonly guid: "Guid";
1418
+ readonly date: "Date";
1419
+ readonly dateTime: "DateTime";
1420
+ readonly instant: "Instant";
1421
+ readonly bytes: "Bytes";
1422
+ };
1423
+ export declare const primitiveTypeLabels: Record<PrimitiveType, string>;
1424
+ export interface UnionDiscriminator {
1425
+ fieldName: string;
1426
+ type: PrimitiveType;
1427
+ }
1428
+ export interface UnionCase {
1429
+ name: string;
1430
+ type: TypeRef;
1431
+ discriminatorValue: string;
1432
+ }
1433
+ export type FieldRole = 'Data' | 'Identity' | 'Reference' | 'Computed' | 'Metadata';
1434
+ export declare const fieldRoles: {
1435
+ readonly data: "Data";
1436
+ readonly identity: "Identity";
1437
+ readonly reference: "Reference";
1438
+ readonly computed: "Computed";
1439
+ readonly metadata: "Metadata";
1440
+ };
1441
+ export declare const fieldRoleLabels: Record<FieldRole, string>;
1442
+ export type FieldMutability = 'Mutable' | 'WriteOnce' | 'Computed';
1443
+ export declare const fieldMutabilities: {
1444
+ readonly mutable: "Mutable";
1445
+ readonly writeOnce: "WriteOnce";
1446
+ readonly computed: "Computed";
1447
+ };
1448
+ export declare const fieldMutabilityLabels: Record<FieldMutability, string>;
1449
+ export interface ComputeDefinition {
1450
+ expression: Expr;
1451
+ }
1452
+ export type DiagnosticId = string;
916
1453
  export interface RelationQueryLogicalPlan {
917
1454
  nodes: RelationQueryLogicalPlanNode[];
918
1455
  retainedNodes: QueryNodeId[];
@@ -1040,7 +1577,7 @@ export declare const relationQueryBoundAssessmentStatuses: {
1040
1577
  readonly blocked: "Blocked";
1041
1578
  };
1042
1579
  export declare const relationQueryBoundAssessmentStatusLabels: Record<RelationQueryBoundAssessmentStatus, string>;
1043
- export type RelationQueryLogicalCapabilityKind = 'Source' | 'Filter' | 'RelationshipTraversal' | 'ForwardRelationshipTraversal' | 'InverseRelationshipTraversal' | 'AtMostOneRelationshipTraversal' | 'ManyRelationshipTraversal' | 'RequiredRelationshipTraversal' | 'OptionalRelationshipTraversal' | 'Join' | 'InnerJoin' | 'LeftOuterJoin' | 'RightOuterJoin' | 'FullOuterJoin' | 'TemporalJoin' | 'ExpandCollection' | 'Projection' | 'ProjectionAssignment' | 'DistinctRows' | 'DistinctKeys' | 'Aggregation' | 'AggregateGrouping' | 'AggregateFilter' | 'CountAggregate' | 'SumAggregate' | 'MinimumAggregate' | 'MaximumAggregate' | 'AnyAggregate' | 'AllAggregate' | 'Ordering' | 'AscendingOrdering' | 'DescendingOrdering' | 'NullsFirst' | 'NullsLast' | 'StableTieOrdering' | 'OffsetPaging' | 'KeysetPaging' | 'OnePerRootRelationOutput' | 'ZeroOrOnePerRootRelationOutput' | 'ManyPerRootRelationOutput' | 'SetRelationOutput' | 'RelationOutputIdentity' | 'RelationInvariant' | 'QueryRowsResult' | 'QueryAggregationResult' | 'AlwaysPresentBinding' | 'MayBeAbsentBinding' | 'AverageAggregate';
1580
+ export type RelationQueryLogicalCapabilityKind = 'Source' | 'Filter' | 'RelationshipTraversal' | 'ForwardRelationshipTraversal' | 'InverseRelationshipTraversal' | 'AtMostOneRelationshipTraversal' | 'ManyRelationshipTraversal' | 'RequiredRelationshipTraversal' | 'OptionalRelationshipTraversal' | 'Join' | 'InnerJoin' | 'LeftOuterJoin' | 'RightOuterJoin' | 'FullOuterJoin' | 'TemporalJoin' | 'ExpandCollection' | 'Projection' | 'ProjectionAssignment' | 'DistinctRows' | 'DistinctKeys' | 'Aggregation' | 'AggregateGrouping' | 'AggregateFilter' | 'CountAggregate' | 'SumAggregate' | 'MinimumAggregate' | 'MaximumAggregate' | 'AnyAggregate' | 'AllAggregate' | 'Ordering' | 'AscendingOrdering' | 'DescendingOrdering' | 'NullsFirst' | 'NullsLast' | 'StableTieOrdering' | 'OffsetPaging' | 'KeysetPaging' | 'OnePerRootRelationOutput' | 'ZeroOrOnePerRootRelationOutput' | 'ManyPerRootRelationOutput' | 'SetRelationOutput' | 'RelationOutputIdentity' | 'RelationInvariant' | 'QueryRowsResult' | 'QueryAggregationResult' | 'AlwaysPresentBinding' | 'MayBeAbsentBinding' | 'AverageAggregate' | 'SelectRepresentative';
1044
1581
  export declare const relationQueryLogicalCapabilityKinds: {
1045
1582
  readonly source: "Source";
1046
1583
  readonly filter: "Filter";
@@ -1090,6 +1627,7 @@ export declare const relationQueryLogicalCapabilityKinds: {
1090
1627
  readonly alwaysPresentBinding: "AlwaysPresentBinding";
1091
1628
  readonly mayBeAbsentBinding: "MayBeAbsentBinding";
1092
1629
  readonly averageAggregate: "AverageAggregate";
1630
+ readonly selectRepresentative: "SelectRepresentative";
1093
1631
  };
1094
1632
  export declare const relationQueryLogicalCapabilityKindLabels: Record<RelationQueryLogicalCapabilityKind, string>;
1095
1633
  export interface ExprCapabilityId {
@@ -1232,6 +1770,8 @@ export type LogicalQueryNode = {
1232
1770
  } & ProjectQueryNode | {
1233
1771
  readonly $node: 'distinct';
1234
1772
  } & DistinctQueryNode | {
1773
+ readonly $node: 'selectRepresentative';
1774
+ } & SelectRepresentativeQueryNode | {
1235
1775
  readonly $node: 'aggregate';
1236
1776
  } & AggregateQueryNode | {
1237
1777
  readonly $node: 'order';
@@ -1278,6 +1818,7 @@ export interface ExpandCollectionQueryNode {
1278
1818
  collection: Expr;
1279
1819
  itemBinding: ValueBindingId;
1280
1820
  itemType: TypeRef;
1821
+ itemShape?: QualifiedShapeId | null;
1281
1822
  id: QueryNodeId;
1282
1823
  }
1283
1824
  export interface ProjectQueryNode {
@@ -1292,6 +1833,12 @@ export interface DistinctQueryNode {
1292
1833
  keys: Expr[];
1293
1834
  id: QueryNodeId;
1294
1835
  }
1836
+ export interface SelectRepresentativeQueryNode {
1837
+ id: QueryNodeId;
1838
+ input: QueryNodeId;
1839
+ keys: Expr[];
1840
+ orderings: QueryOrdering[];
1841
+ }
1295
1842
  export interface AggregateQueryNode {
1296
1843
  input: QueryNodeId;
1297
1844
  resultBinding: ValueBindingId;
@@ -1344,56 +1891,6 @@ export declare const binaryOperators: {
1344
1891
  readonly div: "Div";
1345
1892
  };
1346
1893
  export declare const binaryOperatorLabels: Record<BinaryOperator, string>;
1347
- export type TypeRef = {
1348
- readonly $type: 'named';
1349
- } & NamedTypeRef | {
1350
- readonly $type: 'opaque';
1351
- } & OpaqueRuntimeTypeRef | {
1352
- readonly $type: 'scalar';
1353
- } & ScalarTypeRef | {
1354
- readonly $type: 'enum';
1355
- } & EnumTypeRef | {
1356
- readonly $type: 'entityRef';
1357
- } & EntityReferenceTypeRef | {
1358
- readonly $type: 'array';
1359
- } & ArrayTypeRef | {
1360
- readonly $type: 'object';
1361
- } & ObjectTypeRef | {
1362
- readonly $type: 'quantity';
1363
- } & QuantityTypeRef | {
1364
- readonly $type: 'json';
1365
- } & JsonTypeRef;
1366
- export interface NamedTypeRef {
1367
- typeId: TypeId;
1368
- }
1369
- export interface OpaqueRuntimeTypeRef {
1370
- runtimeType: string;
1371
- inferenceDiagnostic?: TypeInferenceDiagnostic | null;
1372
- }
1373
- export interface ScalarTypeRef {
1374
- kind: ScalarTypeKind;
1375
- format: PrimitiveFormat;
1376
- }
1377
- export interface EnumTypeRef {
1378
- name: string;
1379
- members: string[];
1380
- }
1381
- export interface EntityReferenceTypeRef {
1382
- entity: EntityTypeName;
1383
- }
1384
- export interface ArrayTypeRef {
1385
- elementType: TypeRef;
1386
- }
1387
- export interface ObjectTypeRef {
1388
- fields: ObjectFieldTypeDef[];
1389
- }
1390
- export interface QuantityTypeRef {
1391
- quantity: string;
1392
- baseKind: ScalarTypeKind;
1393
- }
1394
- export interface JsonTypeRef {
1395
- kind: JsonTypeKind;
1396
- }
1397
1894
  export type AggregateOperator = 'Count' | 'Sum' | 'Min' | 'Max' | 'Any' | 'All' | 'Average';
1398
1895
  export declare const aggregateOperators: {
1399
1896
  readonly count: "Count";
@@ -1409,6 +1906,15 @@ export type EntityId = string;
1409
1906
  export type QueryAssignmentId = string;
1410
1907
  export type RelationDraftCandidateId = string;
1411
1908
  export type QueryResultId = string;
1909
+ export interface QueryResultFieldMapping {
1910
+ source: FieldPath;
1911
+ target: FieldPath;
1912
+ }
1913
+ export interface QueryResultCollectionAssembly {
1914
+ target: FieldPath;
1915
+ identity: FieldPath;
1916
+ fields: QueryResultFieldMapping[];
1917
+ }
1412
1918
  export type RelationshipId = string;
1413
1919
  export type RelationshipTargetKey = {
1414
1920
  readonly $targetKey: 'observationIdentity';
@@ -1580,6 +2086,11 @@ export interface ProjectionAssignment {
1580
2086
  target: FieldPath;
1581
2087
  value: Expr;
1582
2088
  }
2089
+ export interface QueryOrdering {
2090
+ key: Expr;
2091
+ direction: QuerySortDirection;
2092
+ nullPlacement: QueryNullPlacement;
2093
+ }
1583
2094
  export interface QueryGrouping {
1584
2095
  id: QueryAssignmentId;
1585
2096
  target: FieldPath;
@@ -1592,11 +2103,6 @@ export interface QueryAggregateAssignment {
1592
2103
  value?: Expr | null;
1593
2104
  filter?: Expr | null;
1594
2105
  }
1595
- export interface QueryOrdering {
1596
- key: Expr;
1597
- direction: QuerySortDirection;
1598
- nullPlacement: QueryNullPlacement;
1599
- }
1600
2106
  export type QueryPageDefinition = {
1601
2107
  readonly $page: 'offset';
1602
2108
  } & OffsetPageDefinition | {
@@ -1611,12 +2117,6 @@ export interface KeysetPageDefinition {
1611
2117
  limit: number;
1612
2118
  }
1613
2119
  export type QueryParameterId = string;
1614
- export type FieldPresence = 'Required' | 'Optional';
1615
- export declare const fieldPresences: {
1616
- readonly required: "Required";
1617
- readonly optional: "Optional";
1618
- };
1619
- export declare const fieldPresenceLabels: Record<FieldPresence, string>;
1620
2120
  export type QueryParameterDefaultKind = 'None' | 'Value';
1621
2121
  export declare const queryParameterDefaultKinds: {
1622
2122
  readonly none: "None";
@@ -1646,58 +2146,6 @@ export interface UnresolvedRelationDraftAssignmentResolution {
1646
2146
  export interface AmbiguousRelationDraftAssignmentResolution {
1647
2147
  candidateIds: RelationDraftCandidateId[];
1648
2148
  }
1649
- export type TypeId = string;
1650
- export interface TypeInferenceDiagnostic {
1651
- reason: string;
1652
- message?: string | null;
1653
- }
1654
- export type ScalarTypeKind = 'Bool' | 'Int32' | 'Int64' | 'Decimal' | 'String' | 'Guid' | 'Date' | 'DateTime' | 'Instant' | 'Bytes';
1655
- export declare const scalarTypeKinds: {
1656
- readonly bool: "Bool";
1657
- readonly int32: "Int32";
1658
- readonly int64: "Int64";
1659
- readonly decimal: "Decimal";
1660
- readonly string: "String";
1661
- readonly guid: "Guid";
1662
- readonly date: "Date";
1663
- readonly dateTime: "DateTime";
1664
- readonly instant: "Instant";
1665
- readonly bytes: "Bytes";
1666
- };
1667
- export declare const scalarTypeKindLabels: Record<ScalarTypeKind, string>;
1668
- export type PrimitiveFormat = 'None' | 'Uuid' | 'IsoDate' | 'IsoDateTime' | 'IsoInstant' | 'CurrencyCode' | 'CountryCode' | 'Email' | 'Uri' | 'Base64';
1669
- export declare const primitiveFormats: {
1670
- readonly none: "None";
1671
- readonly uuid: "Uuid";
1672
- readonly isoDate: "IsoDate";
1673
- readonly isoDateTime: "IsoDateTime";
1674
- readonly isoInstant: "IsoInstant";
1675
- readonly currencyCode: "CurrencyCode";
1676
- readonly countryCode: "CountryCode";
1677
- readonly email: "Email";
1678
- readonly uri: "Uri";
1679
- readonly base64: "Base64";
1680
- };
1681
- export declare const primitiveFormatLabels: Record<PrimitiveFormat, string>;
1682
- export type EntityTypeName = string;
1683
- export interface ObjectFieldTypeDef {
1684
- name: string;
1685
- type: TypeRef;
1686
- cardinality: FieldCardinality;
1687
- presence: FieldPresence;
1688
- nullability: FieldNullability;
1689
- annotations: Record<string, AnnotationValue>;
1690
- }
1691
- export type JsonTypeKind = 'Any' | 'Object' | 'Array' | 'String' | 'Number' | 'Boolean';
1692
- export declare const jsonTypeKinds: {
1693
- readonly any: "Any";
1694
- readonly object: "Object";
1695
- readonly array: "Array";
1696
- readonly string: "String";
1697
- readonly number: "Number";
1698
- readonly boolean: "Boolean";
1699
- };
1700
- export declare const jsonTypeKindLabels: Record<JsonTypeKind, string>;
1701
2149
  export interface RelationQueryLogicalPlanInput {
1702
2150
  canonicalInput: QueryNodeId;
1703
2151
  effectiveInput: QueryNodeId;
@@ -1730,7 +2178,7 @@ export declare const relationQueryRealizationTraceStepKinds: {
1730
2178
  readonly terminal: "Terminal";
1731
2179
  };
1732
2180
  export declare const relationQueryRealizationTraceStepKindLabels: Record<RelationQueryRealizationTraceStepKind, string>;
1733
- export type RelationQueryExpressionSiteKind = 'FilterPredicate' | 'JoinPredicate' | 'ExpandCollection' | 'ProjectionAssignmentValue' | 'DistinctKey' | 'AggregateGroupingKey' | 'AggregateAssignmentValue' | 'AggregateAssignmentFilter' | 'OrderKey' | 'KeysetBoundary' | 'RelationOutputKey' | 'RelationInvariant' | 'TemporalJoinCorrelation' | 'TemporalJoinPoint' | 'TemporalJoinIntervalLowerBound' | 'TemporalJoinIntervalUpperBound';
2181
+ export type RelationQueryExpressionSiteKind = 'FilterPredicate' | 'JoinPredicate' | 'ExpandCollection' | 'ProjectionAssignmentValue' | 'DistinctKey' | 'AggregateGroupingKey' | 'AggregateAssignmentValue' | 'AggregateAssignmentFilter' | 'OrderKey' | 'KeysetBoundary' | 'RelationOutputKey' | 'RelationInvariant' | 'TemporalJoinCorrelation' | 'TemporalJoinPoint' | 'TemporalJoinIntervalLowerBound' | 'TemporalJoinIntervalUpperBound' | 'RepresentativeKey';
1734
2182
  export declare const relationQueryExpressionSiteKinds: {
1735
2183
  readonly filterPredicate: "FilterPredicate";
1736
2184
  readonly joinPredicate: "JoinPredicate";
@@ -1748,6 +2196,7 @@ export declare const relationQueryExpressionSiteKinds: {
1748
2196
  readonly temporalJoinPoint: "TemporalJoinPoint";
1749
2197
  readonly temporalJoinIntervalLowerBound: "TemporalJoinIntervalLowerBound";
1750
2198
  readonly temporalJoinIntervalUpperBound: "TemporalJoinIntervalUpperBound";
2199
+ readonly representativeKey: "RepresentativeKey";
1751
2200
  };
1752
2201
  export declare const relationQueryExpressionSiteKindLabels: Record<RelationQueryExpressionSiteKind, string>;
1753
2202
  export type ExprSiteId = string;
@@ -1780,18 +2229,6 @@ export declare const relationDraftUnresolvedReasons: {
1780
2229
  readonly multipleCandidates: "MultipleCandidates";
1781
2230
  };
1782
2231
  export declare const relationDraftUnresolvedReasonLabels: Record<RelationDraftUnresolvedReason, string>;
1783
- export type FieldCardinality = 'Single' | 'Many';
1784
- export declare const fieldCardinalities: {
1785
- readonly single: "Single";
1786
- readonly many: "Many";
1787
- };
1788
- export declare const fieldCardinalityLabels: Record<FieldCardinality, string>;
1789
- export type FieldNullability = 'NonNullable' | 'Nullable';
1790
- export declare const fieldNullabilities: {
1791
- readonly nonNullable: "NonNullable";
1792
- readonly nullable: "Nullable";
1793
- };
1794
- export declare const fieldNullabilityLabels: Record<FieldNullability, string>;
1795
2232
  export interface RelationQueryLogicalBypass {
1796
2233
  kind: RelationQueryLogicalBypassKind;
1797
2234
  node: QueryNodeId;
@@ -1845,10 +2282,32 @@ export declare const temporalNullBoundBehaviors: {
1845
2282
  readonly unbounded: "Unbounded";
1846
2283
  };
1847
2284
  export declare const temporalNullBoundBehaviorLabels: Record<TemporalNullBoundBehavior, string>;
2285
+ export interface GraphDelta {
2286
+ id: string;
2287
+ kind: GraphDeltaKind;
2288
+ sourceGraphId?: GraphId | null;
2289
+ targetGraphId?: GraphId | null;
2290
+ sourceVersion?: string | null;
2291
+ targetVersion?: string | null;
2292
+ operations: GraphDeltaOperation[];
2293
+ annotations: Record<string, AnnotationValue>;
2294
+ }
1848
2295
  export interface QualifiedShapeId {
1849
2296
  graphId: GraphId;
1850
2297
  shapeId: ShapeId;
1851
2298
  }
2299
+ export interface ShapeGraphDocument {
2300
+ schemaVersion: string;
2301
+ metadata: ShapeGraphDocumentMetadata;
2302
+ graph: ShapeGraph;
2303
+ }
2304
+ export interface ValueContract {
2305
+ type?: TypeRef | null;
2306
+ shape?: QualifiedShapeId | null;
2307
+ cardinality: FieldCardinality;
2308
+ presence: FieldPresence;
2309
+ nullability: FieldNullability;
2310
+ }
1852
2311
  export interface RelationQueryExplainArtifact {
1853
2312
  schemaVersion: string;
1854
2313
  stages: RelationQueryExplainStage[];