@query-graph/core 1.1.1 → 1.1.2

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 CHANGED
@@ -1,11 +1,189 @@
1
1
  # query-graph
2
2
 
3
- Нативное планирование графов запросов и компиляция SQL для Node.js.
3
+ Типизированное описание графов запросов, нативное планирование и компиляция SQL
4
+ для Node.js.
4
5
 
5
- Пакет отвечает за валидацию графа, планирование и генерацию SQL. Подключение к
6
- базе данных и исполнение запросов остаются ответственностью потребителя.
7
- Один и тот же граф и реляционное отображение могут компилироваться в SQL Server
8
- или Oracle SQL.
6
+ `query-graph` позволяет один раз описать доступные данные и связи без SQL, а для
7
+ каждой операции выбрать поля, параметры, сортировку и пагинацию. Rust проверяет
8
+ definition, строит минимальный план связей и компилирует его в SQL Server или
9
+ Oracle SQL.
10
+
11
+ Пакет намеренно **не подключается к базе данных и не выполняет SQL**. Он
12
+ возвращает SQL, bindings и metadata результата; способ исполнения остаётся у
13
+ приложения.
14
+
15
+ Основные возможности:
16
+
17
+ - строгий TypeScript DSL для sources, parameters, relations и projections;
18
+ - runtime-валидация definition и operation в Rust;
19
+ - выбор только необходимых JOIN по запрошенным projection paths;
20
+ - один definition для SQL Server и Oracle;
21
+ - scalar/list parameters без подстановки значений в SQL;
22
+ - `exists`, детерминированные to-one relations, summary-графы и batch relations;
23
+ - тип результата через `ResultOf`.
24
+
25
+ Требуется Node.js 20 или новее.
26
+
27
+ ## Быстрый старт
28
+
29
+ ### Установка
30
+
31
+ ```bash
32
+ npm install @query-graph/core
33
+ ```
34
+
35
+ Основной объектный DSL уже входит в пакет и доступен через
36
+ `@query-graph/core/dsl`.
37
+
38
+ ### 1. Опишите доступные данные
39
+
40
+ Definition использует логические имена. Здесь нет имён таблиц, SQL-алиасов или
41
+ синтаксиса конкретной СУБД.
42
+
43
+ ```ts
44
+ import { registerDefinition } from '@query-graph/core'
45
+ import { constraint, defineGraph, eq, param, project, requiredParameter, source } from '@query-graph/core/dsl'
46
+ import type { QueryOperation, ResultOf } from '@query-graph/core/dsl'
47
+
48
+ const users = source('users', {
49
+ id: 'int64',
50
+ organisationId: 'int64',
51
+ email: 'string',
52
+ })
53
+
54
+ const organisationId = requiredParameter('organisationId', 'int64')
55
+
56
+ const usersDefinition = defineGraph({
57
+ name: 'users',
58
+ root: users,
59
+ sources: [users],
60
+ parameters: [organisationId],
61
+ constraints: [
62
+ constraint({
63
+ predicate: eq(users.field('organisationId'), param(organisationId)),
64
+ }),
65
+ ],
66
+ projection: [
67
+ project({ path: 'id', expression: users.field('id'), default: true }),
68
+ project({ path: 'email', expression: users.field('email'), default: true }),
69
+ ],
70
+ })
71
+ ```
72
+
73
+ ### 2. Добавьте реляционное отображение
74
+
75
+ Mapping связывает логический source с физической таблицей. Его можно заменить,
76
+ не меняя definition.
77
+
78
+ ```ts
79
+ const usersGraph = registerDefinition(usersDefinition).withRelationalMapping({
80
+ sources: {
81
+ users: {
82
+ table: { schema: 'dbo', name: 'users' },
83
+ columns: {
84
+ organisationId: 'organisation_id',
85
+ },
86
+ },
87
+ },
88
+ })
89
+ ```
90
+
91
+ `registerDefinition` валидирует и индексирует definition в Rust. Обычно граф
92
+ регистрируется один раз при запуске приложения и затем переиспользуется.
93
+
94
+ ### 3. Скомпилируйте операцию
95
+
96
+ Operation содержит только изменяемую часть запроса. TypeScript проверяет имена
97
+ полей и параметров относительно конкретного definition.
98
+
99
+ ```ts
100
+ const operation = {
101
+ select: ['id', 'email'],
102
+ parameters: {
103
+ organisationId: 42,
104
+ },
105
+ } as const satisfies QueryOperation<typeof usersDefinition>
106
+
107
+ const statement = usersGraph.compileSqlServer(operation)
108
+
109
+ console.log(statement.sql)
110
+ console.table(statement.bindings)
111
+ console.table(statement.columns)
112
+
113
+ type UserRow = ResultOf<typeof usersDefinition, typeof operation>
114
+ // { id: number | string; email: string }
115
+ ```
116
+
117
+ Для SQL Server получится параметризованный запрос:
118
+
119
+ ```sql
120
+ SELECT
121
+ [t0].[id] AS [c0],
122
+ [t0].[email] AS [c1]
123
+ FROM [dbo].[users] AS [t0]
124
+ WHERE
125
+ ([t0].[organisation_id] = @p0)
126
+ ```
127
+
128
+ В `statement.bindings` placeholder `p0` будет связан с параметром
129
+ `organisationId` типа `int64`.
130
+
131
+ Тот же graph можно передать другому compiler:
132
+
133
+ ```ts
134
+ const oracleStatement = usersGraph.compileOracle(operation, { version: '19c' })
135
+ ```
136
+
137
+ ### 4. Выполните SQL своим драйвером
138
+
139
+ Результат компиляции не содержит соединение с базой данных:
140
+
141
+ | Поле statement | Назначение |
142
+ | -------------- | ------------------------------------------------------------------------------ |
143
+ | `sql` | SQL с именованными placeholders `p0`, `p1` и так далее |
144
+ | `bindings` | связь placeholder с параметром operation, его типом и индексом элемента списка |
145
+ | `columns` | связь физической колонки `cN` с projection path и scalar type |
146
+ | `objects` | presence-маркеры для nullable вложенных объектов |
147
+ | `relations` | связи, фактически выбранные planner для этой операции |
148
+
149
+ Executor приложения берёт значения из `operation.parameters` согласно
150
+ `statement.bindings`, передаёт их DB driver и восстанавливает логические поля по
151
+ `statement.columns`. Разбирать SQL для этого не требуется.
152
+
153
+ ## Как выбрать возможность
154
+
155
+ | Задача | API или раздел |
156
+ | -------------------------------------------------------- | ----------------------------------------------------------- |
157
+ | Выбрать связанные поля `0..1` или `1` | [`relation` и `firstBy`](#to-one-selection) |
158
+ | Отфильтровать root по наличию связанных строк | [`exists`](#existential-constraints) |
159
+ | Переиспользовать часть definition | [GraphModule](#композиция-через-graphmodule) |
160
+ | Передать массив в `IN (...)` | [Параметры-списки](#параметры-списки) |
161
+ | Выбирать сортировку во время выполнения | [Именованные сортировки](#именованные-сортировки) |
162
+ | Получить агрегированный результат | [Summary-графы](#summary-графы) |
163
+ | Отличить отсутствующий объект от объекта с `NULL`-полями | [Presence объектной проекции](#presence-объектной-проекции) |
164
+ | Загрузить коллекцию после пагинации root | [Batch-связи](#batch-связи-и-двухфазное-выполнение) |
165
+ | Обработать структурированную ошибку | [Диагностика](#диагностика) |
166
+
167
+ ## Модель использования
168
+
169
+ | Понятие | Когда создаётся | За что отвечает |
170
+ | ---------------------- | ----------------------------------- | ------------------------------------------------------- |
171
+ | `GraphDefinition` | при объявлении графа | логические sources, relations, constraints и projection |
172
+ | `QueryGraph` | один раз после `registerDefinition` | проверенный и проиндексированный нативный граф |
173
+ | `RelationalMapping` | при конфигурации приложения | физические таблицы и переименования колонок |
174
+ | `QueryOperation` | для конкретного запроса | выбранные поля, параметры, ordering и pagination |
175
+ | `CompiledSqlStatement` | при компиляции operation | SQL и metadata, необходимые executor приложения |
176
+ | `GraphModule` | при композиции definition | переиспользуемый фрагмент без собственного root |
177
+
178
+ Обычный жизненный цикл выглядит так:
179
+
180
+ ```text
181
+ defineGraph -> registerDefinition -> withRelationalMapping
182
+ |
183
+ QueryOperation -----------------------+-> compileSqlServer / compileOracle
184
+ |
185
+ +-> executor приложения -> DB driver
186
+ ```
9
187
 
10
188
  ## Архитектура пакета
11
189
 
@@ -119,6 +297,8 @@ const definition = defineGraph({
119
297
  const graph = registerDefinition(definition)
120
298
  ```
121
299
 
300
+ ### Композиция через GraphModule
301
+
122
302
  `GraphModule` группирует переиспользуемую часть определения: источники,
123
303
  параметры, связи, ограничения, проекцию и сортировку. У модуля нет собственного
124
304
  корневого источника, и его нельзя зарегистрировать или скомпилировать отдельно.
@@ -579,6 +759,64 @@ try {
579
759
  Wire errors, semantic validation и SQL compilation имеют разные верхнеуровневые
580
760
  `code`. Коды отдельных `issues` стабильны и не требуют разбора текста `message`.
581
761
 
762
+ ## Presence объектной проекции
763
+
764
+ Nullable-поля не позволяют определить, отсутствует ли вложенный объект: существующий
765
+ объект может корректно содержать только `NULL`. Для такой границы definition явно
766
+ задаёт выражение присутствия через `projectObject`:
767
+
768
+ ```ts
769
+ const definition = defineGraph({
770
+ name: 'users',
771
+ root: users,
772
+ sources: [users, profiles],
773
+ relations: [
774
+ relation({
775
+ name: 'profile',
776
+ from: users,
777
+ to: profiles,
778
+ on: eq(users.field('id'), profiles.field('userId')),
779
+ }),
780
+ ],
781
+ objects: [
782
+ projectObject({
783
+ path: 'profile',
784
+ presence: profiles.field('id'),
785
+ }),
786
+ ],
787
+ projection: [
788
+ project({
789
+ path: 'profile.displayName',
790
+ expression: profiles.field('displayName'),
791
+ }),
792
+ ],
793
+ })
794
+ ```
795
+
796
+ `presence` должно возвращать не-`NULL`, когда объект существует, и `NULL`, когда
797
+ его нет. Обычно для этого используется обязательный идентификатор source за
798
+ optional relation. Маркер не является доступным для выбора полем проекции.
799
+
800
+ Если operation выбирает хотя бы одно поле под `profile`, planner включает
801
+ presence-выражение в план. SQL compiler добавляет скрытую колонку, например `o0`,
802
+ и возвращает отдельные metadata:
803
+
804
+ ```ts
805
+ statement.objects
806
+ // [{ path: 'profile', presenceColumn: 'o0' }]
807
+ ```
808
+
809
+ `statement.columns` по-прежнему содержит только публичные поля `c0`, `c1` и так
810
+ далее. Исполнитель сначала восстанавливает результат по `statement.columns`, а
811
+ затем устанавливает объект по `path` в `null`, если соответствующая исходная
812
+ колонка `presenceColumn` равна `NULL`. Для вложенных объектов metadata упорядочены
813
+ от самого глубокого path к внешнему.
814
+
815
+ Таким образом, исполнитель не угадывает отсутствие объекта по правилу «все поля
816
+ равны `NULL`». `ResultOf` также учитывает declaration и выводит
817
+ `profile: { ... } | null`. Пакет только компилирует SQL и metadata; выполнение
818
+ запроса и materialization остаются у потребителя.
819
+
582
820
  ## SQL Server
583
821
 
584
822
  Реляционное отображение связывает логические источники с физическими таблицами.
@@ -775,3 +1013,9 @@ Batch-связь может задать собственный `ordering`, но
775
1013
  path соответствующего шага в `plan.batches` нет. Флаги injection в metadata
776
1014
  показывают executor, какие ключи были добавлены исключительно для связывания и
777
1015
  не должны попасть в публичный результат.
1016
+
1017
+ ---
1018
+
1019
+ ### Rule 34
1020
+
1021
+ > Every sufficiently generic abstraction eventually gets an implementation.
package/definition.d.ts CHANGED
@@ -25,7 +25,7 @@ import type {
25
25
  TypedProjectionField,
26
26
  } from './dsl.js'
27
27
 
28
- export const GRAPH_DEFINITION_VERSION: 9
28
+ export const GRAPH_DEFINITION_VERSION: 10
29
29
 
30
30
  export function field<
31
31
  const Key extends string,
package/definition.js CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  const objectDsl = require('./dsl.js')
4
4
 
5
- const GRAPH_DEFINITION_VERSION = 9
5
+ const GRAPH_DEFINITION_VERSION = 10
6
6
 
7
7
  function field(sourceReference, name) {
8
8
  if (typeof sourceReference === 'string') {
@@ -102,6 +102,7 @@ exports.relation = relation
102
102
  exports.constraint = constraint
103
103
  exports.ordering = objectDsl.ordering
104
104
  exports.project = project
105
+ exports.projectObject = objectDsl.projectObject
105
106
  exports.batchQuery = objectDsl.batchQuery
106
107
  exports.batchRelation = objectDsl.batchRelation
107
108
  exports.composeGraph = objectDsl.composeGraph
package/dsl.d.ts CHANGED
@@ -224,11 +224,15 @@ declare const projectionPathType: unique symbol
224
224
  declare const projectionScalarType: unique symbol
225
225
  declare const projectionNullabilityType: unique symbol
226
226
  declare const projectionDefaultType: unique symbol
227
+ declare const projectionObjectPathType: unique symbol
228
+ declare const projectionObjectNullabilityType: unique symbol
227
229
  declare const summaryFieldType: unique symbol
228
230
  declare const typedProjectionPathType: unique symbol
229
231
  declare const typedProjectionScalarType: unique symbol
230
232
  declare const typedProjectionNullabilityType: unique symbol
231
233
  declare const typedProjectionDefaultType: unique symbol
234
+ declare const typedProjectionObjectPathType: unique symbol
235
+ declare const typedProjectionObjectNullabilityType: unique symbol
232
236
 
233
237
  export interface ProjectionTypeMetadata<
234
238
  Path extends string = string,
@@ -242,6 +246,19 @@ export interface ProjectionTypeMetadata<
242
246
  readonly [typedProjectionDefaultType]: SelectedByDefault
243
247
  }
244
248
 
249
+ export interface ProjectionObjectTypeMetadata<
250
+ Path extends string = string,
251
+ Nullability extends NullabilityExpression = NullabilityExpression,
252
+ > {
253
+ readonly [typedProjectionObjectPathType]: Path
254
+ readonly [typedProjectionObjectNullabilityType]: Nullability
255
+ }
256
+
257
+ export type TypedProjectionObject<
258
+ Path extends string = string,
259
+ Nullability extends NullabilityExpression = NullabilityExpression,
260
+ > = ProjectionObjectDefinition<Path, Nullability> & ProjectionObjectTypeMetadata<Path, Nullability>
261
+
245
262
  export type TypedProjectionField<
246
263
  Path extends string = string,
247
264
  Type extends ScalarType = ScalarType,
@@ -282,6 +299,16 @@ export interface ProjectionFieldDefinition<
282
299
  selectedByDefault?: boolean
283
300
  }
284
301
 
302
+ export interface ProjectionObjectDefinition<
303
+ Path extends string = string,
304
+ Nullability extends NullabilityExpression = NullabilityExpression,
305
+ > {
306
+ path: string[]
307
+ readonly [projectionObjectPathType]?: Path
308
+ readonly [projectionObjectNullabilityType]?: Nullability
309
+ presence: Expression
310
+ }
311
+
285
312
  export interface DimensionDefinition<
286
313
  Path extends string = string,
287
314
  Type extends ScalarType = ScalarType,
@@ -314,15 +341,19 @@ export type SummaryFieldDefinition<
314
341
  export interface ProjectionDefinition<
315
342
  Path extends string = string,
316
343
  Field extends ProjectionFieldDefinition = ProjectionFieldDefinition<Path>,
344
+ Object extends ProjectionObjectDefinition = ProjectionObjectDefinition,
317
345
  > {
318
346
  fields: Field[]
347
+ objects: Object[]
319
348
  }
320
349
 
321
350
  export interface ProjectionDefinitionInput<
322
351
  Path extends string = string,
323
352
  Field extends ProjectionFieldDefinition = ProjectionFieldDefinition<Path>,
353
+ Object extends ProjectionObjectDefinition = ProjectionObjectDefinition,
324
354
  > {
325
355
  fields?: Field[]
356
+ objects?: Object[]
326
357
  }
327
358
 
328
359
  export interface OrderByDefinition {
@@ -345,7 +376,7 @@ export interface FirstBySelection {
345
376
  export type RelationSelection = FirstBySelection
346
377
 
347
378
  export interface GraphDefinitionInput {
348
- schemaVersion: 9
379
+ schemaVersion: 10
349
380
  name: string
350
381
  root: string
351
382
  sources: SourceDefinition[]
@@ -363,12 +394,13 @@ export interface GraphDefinition<
363
394
  ProjectionField extends ProjectionFieldDefinition = ProjectionFieldDefinition<ProjectionPath>,
364
395
  Relation extends RelationDefinition = RelationDefinition,
365
396
  Root extends string = string,
397
+ ProjectionObject extends ProjectionObjectDefinition = ProjectionObjectDefinition,
366
398
  > extends GraphDefinitionInput {
367
399
  root: Root
368
400
  parameters: Parameter[]
369
401
  relations: Relation[]
370
402
  constraints: ConstraintDefinition[]
371
- projection: ProjectionDefinition<ProjectionPath, ProjectionField>
403
+ projection: ProjectionDefinition<ProjectionPath, ProjectionField, ProjectionObject>
372
404
  orderings: OrderingDefinition<OrderingName>[]
373
405
  }
374
406
 
@@ -442,6 +474,9 @@ export type DefinitionOrderingName<Definition extends GraphDefinitionInput> =
442
474
  export type DefinitionProjectionField<Definition extends GraphDefinitionInput> = NonNullable<
443
475
  NonNullable<Definition['projection']>['fields']
444
476
  >[number]
477
+ export type DefinitionProjectionObject<Definition extends GraphDefinitionInput> = NonNullable<
478
+ NonNullable<Definition['projection']>['objects']
479
+ >[number]
445
480
 
446
481
  export type DefinitionRelation<Definition extends GraphDefinitionInput> = NonNullable<Definition['relations']>[number]
447
482
 
@@ -931,6 +966,23 @@ type ProjectionFieldPath<Field> =
931
966
  ? Path
932
967
  : never
933
968
 
969
+ type ProjectionObjectPath<Object> =
970
+ Object extends ProjectionObjectTypeMetadata<infer Path, infer _Nullability>
971
+ ? Path
972
+ : Object extends ProjectionObjectDefinition<infer Path>
973
+ ? Path
974
+ : never
975
+
976
+ type ProjectionObjectNullability<Object> =
977
+ Object extends ProjectionObjectTypeMetadata<infer _Path, infer Nullability>
978
+ ? Nullability
979
+ : Object extends ProjectionObjectDefinition<infer _Path, infer Nullability>
980
+ ? Nullability
981
+ : boolean
982
+
983
+ type ProjectionObjectIsNullable<Definition extends GraphDefinitionInput, Object> =
984
+ true extends EvaluateNullability<Definition, ProjectionObjectNullability<Object>> ? true : false
985
+
934
986
  type ProjectionFieldValue<Definition extends GraphDefinitionInput, Field, TypeMap extends ScalarOutputTypeMap> =
935
987
  Field extends ProjectionTypeMetadata<infer _Path, infer Type, infer Nullability, infer _SelectedByDefault>
936
988
  ? true extends EvaluateNullability<Definition, Nullability>
@@ -977,6 +1029,19 @@ type SelectedProjectionField<Definition extends GraphDefinitionInput, Operation>
977
1029
  ? ProjectionFieldByPath<DefinitionProjectionField<Definition>, Path>
978
1030
  : DefaultProjectionField<DefinitionProjectionField<Definition>>
979
1031
 
1032
+ type ProjectionObjectForField<Object, Field> = Object extends ProjectionObjectDefinition
1033
+ ? Field extends ProjectionFieldDefinition
1034
+ ? ProjectionFieldPath<Field> extends `${ProjectionObjectPath<Object>}.${string}`
1035
+ ? Object
1036
+ : never
1037
+ : never
1038
+ : never
1039
+
1040
+ type SelectedProjectionObject<Definition extends GraphDefinitionInput, Field> = ProjectionObjectForField<
1041
+ DefinitionProjectionObject<Definition>,
1042
+ Field
1043
+ >
1044
+
980
1045
  type ProjectionEntry<
981
1046
  Definition extends GraphDefinitionInput,
982
1047
  Field,
@@ -988,6 +1053,13 @@ type ProjectionEntry<
988
1053
  }
989
1054
  : never
990
1055
 
1056
+ type ProjectionObjectEntry<Definition extends GraphDefinitionInput, Object> = Object extends ProjectionObjectDefinition
1057
+ ? {
1058
+ path: ProjectionObjectPath<Object>
1059
+ nullable: ProjectionObjectIsNullable<Definition, Object>
1060
+ }
1061
+ : never
1062
+
991
1063
  type ProjectionEntryHead<Entry> = Entry extends { path: infer Path extends string }
992
1064
  ? Path extends `${infer Head}.${string}`
993
1065
  ? Head
@@ -1012,16 +1084,47 @@ type NestedProjectionEntry<Entry, Key extends string> = Entry extends {
1012
1084
  : never
1013
1085
  : never
1014
1086
 
1015
- type ProjectionValueAtKey<Entry, Key extends string> = [NestedProjectionEntry<Entry, Key>] extends [never]
1087
+ type DirectProjectionObjectNullable<ObjectEntry, Key extends string> = ObjectEntry extends {
1088
+ path: infer Path extends string
1089
+ nullable: infer Nullable extends boolean
1090
+ }
1091
+ ? Path extends Key
1092
+ ? Nullable
1093
+ : never
1094
+ : never
1095
+
1096
+ type NestedProjectionObjectEntry<ObjectEntry, Key extends string> = ObjectEntry extends {
1097
+ path: infer Path extends string
1098
+ nullable: infer Nullable extends boolean
1099
+ }
1100
+ ? Path extends `${Key}.${infer Rest}`
1101
+ ? { path: Rest; nullable: Nullable }
1102
+ : never
1103
+ : never
1104
+
1105
+ type ApplyProjectionObjectNullability<Value, ObjectEntry, Key extends string> =
1106
+ true extends DirectProjectionObjectNullable<ObjectEntry, Key> ? Value | null : Value
1107
+
1108
+ type ProjectionValueAtKeyWithoutObject<Entry, ObjectEntry, Key extends string> = [
1109
+ NestedProjectionEntry<Entry, Key>,
1110
+ ] extends [never]
1016
1111
  ? DirectProjectionEntryValue<Entry, Key>
1017
1112
  : [DirectProjectionEntryValue<Entry, Key>] extends [never]
1018
- ? BuildProjectionResult<NestedProjectionEntry<Entry, Key>>
1019
- : DirectProjectionEntryValue<Entry, Key> | BuildProjectionResult<NestedProjectionEntry<Entry, Key>>
1113
+ ? BuildProjectionResult<NestedProjectionEntry<Entry, Key>, NestedProjectionObjectEntry<ObjectEntry, Key>>
1114
+ :
1115
+ | DirectProjectionEntryValue<Entry, Key>
1116
+ | BuildProjectionResult<NestedProjectionEntry<Entry, Key>, NestedProjectionObjectEntry<ObjectEntry, Key>>
1117
+
1118
+ type ProjectionValueAtKey<Entry, ObjectEntry, Key extends string> = ApplyProjectionObjectNullability<
1119
+ ProjectionValueAtKeyWithoutObject<Entry, ObjectEntry, Key>,
1120
+ ObjectEntry,
1121
+ Key
1122
+ >
1020
1123
 
1021
- type BuildProjectionResult<Entry> = [Entry] extends [never]
1124
+ type BuildProjectionResult<Entry, ObjectEntry = never> = [Entry] extends [never]
1022
1125
  ? Record<never, never>
1023
1126
  : {
1024
- [Key in ProjectionEntryHead<Entry>]: ProjectionValueAtKey<Entry, Key>
1127
+ [Key in ProjectionEntryHead<Entry>]: ProjectionValueAtKey<Entry, ObjectEntry, Key>
1025
1128
  }
1026
1129
 
1027
1130
  export type ResultOf<
@@ -1034,7 +1137,12 @@ export type ResultOf<
1034
1137
  : DefinitionOf<
1035
1138
  Extract<Subject, GraphDefinitionInput | QueryGraph | RelationalQueryGraph>
1036
1139
  > extends infer Definition extends GraphDefinitionInput
1037
- ? BuildProjectionResult<ProjectionEntry<Definition, SelectedProjectionField<Definition, Operation>, TypeMap>>
1140
+ ? SelectedProjectionField<Definition, Operation> extends infer Field
1141
+ ? BuildProjectionResult<
1142
+ ProjectionEntry<Definition, Field, TypeMap>,
1143
+ ProjectionObjectEntry<Definition, SelectedProjectionObject<Definition, Field>>
1144
+ >
1145
+ : never
1038
1146
  : never
1039
1147
 
1040
1148
  type SelectedPaths<Operation> = Operation extends { select: readonly (infer Path extends string)[] } ? Path : never
@@ -1452,6 +1560,14 @@ export interface ProjectionConfiguration<
1452
1560
  default?: SelectedByDefault
1453
1561
  }
1454
1562
 
1563
+ export interface ProjectionObjectConfiguration<
1564
+ Path extends string | readonly string[] = string | readonly string[],
1565
+ Value extends ExpressionInput = ExpressionInput,
1566
+ > {
1567
+ path: Path
1568
+ presence: Value
1569
+ }
1570
+
1455
1571
  type ConfigurationPath<Path extends string | readonly string[]> = Path extends string
1456
1572
  ? Path
1457
1573
  : Path extends readonly string[]
@@ -1471,6 +1587,10 @@ export function project<
1471
1587
  SelectedByDefault
1472
1588
  >
1473
1589
 
1590
+ export function projectObject<const Path extends string | readonly string[], const Value extends ExpressionInput>(
1591
+ configuration: ProjectionObjectConfiguration<Path, Value>,
1592
+ ): TypedProjectionObject<ConfigurationPath<Path>, InputNullability<Value>>
1593
+
1474
1594
  export function dimension<
1475
1595
  const Path extends string | readonly string[],
1476
1596
  const Value extends ExpressionInput,
@@ -1524,6 +1644,7 @@ export interface GraphModuleConfiguration {
1524
1644
  relations?: readonly RelationDefinition[]
1525
1645
  constraints?: readonly ConstraintDefinition[]
1526
1646
  projection?: readonly ProjectionFieldDefinition[]
1647
+ objects?: readonly ProjectionObjectDefinition[]
1527
1648
  orderings?: readonly OrderingDefinition[]
1528
1649
  }
1529
1650
 
@@ -1588,6 +1709,18 @@ type ModuleRelation<Module> =
1588
1709
  ? Relation
1589
1710
  : never
1590
1711
 
1712
+ type ModuleProjectionObject<Module> =
1713
+ Module extends GraphModule<
1714
+ infer _Parameter,
1715
+ infer _ProjectionPath,
1716
+ infer _OrderingName,
1717
+ infer _ProjectionField,
1718
+ infer _Relation,
1719
+ infer ProjectionObject
1720
+ >
1721
+ ? ProjectionObject
1722
+ : never
1723
+
1591
1724
  type ProjectionPathOf<Field> = Field extends ProjectionFieldDefinition<infer Path> ? Path : never
1592
1725
 
1593
1726
  type OrderingNameOf<Ordering> = Ordering extends OrderingDefinition<infer Name> ? Name : never
@@ -1608,6 +1741,10 @@ type ConfigurationProjectionField<Configuration> =
1608
1741
  | Extract<ConfigurationElement<Configuration, 'measures'>, ProjectionFieldDefinition>
1609
1742
  | ModuleProjectionField<ConfigurationElement<Configuration, 'modules'>>
1610
1743
 
1744
+ type ConfigurationProjectionObject<Configuration> =
1745
+ | Extract<ConfigurationElement<Configuration, 'objects'>, ProjectionObjectDefinition>
1746
+ | ModuleProjectionObject<ConfigurationElement<Configuration, 'modules'>>
1747
+
1611
1748
  type ConfigurationOrderingName<Configuration> =
1612
1749
  | OrderingNameOf<ConfigurationElement<Configuration, 'orderings'>>
1613
1750
  | ModuleOrderingName<ConfigurationElement<Configuration, 'modules'>>
@@ -1628,6 +1765,7 @@ export interface GraphModule<
1628
1765
  OrderingName extends string = string,
1629
1766
  ProjectionField extends ProjectionFieldDefinition = ProjectionFieldDefinition<ProjectionPath>,
1630
1767
  Relation extends RelationDefinition = RelationDefinition,
1768
+ ProjectionObject extends ProjectionObjectDefinition = ProjectionObjectDefinition,
1631
1769
  > {
1632
1770
  readonly name: string
1633
1771
  readonly sources: readonly SourceRef[]
@@ -1635,6 +1773,7 @@ export interface GraphModule<
1635
1773
  readonly relations: readonly Relation[]
1636
1774
  readonly constraints: readonly ConstraintDefinition[]
1637
1775
  readonly projection: readonly ProjectionField[]
1776
+ readonly objects: readonly ProjectionObject[]
1638
1777
  readonly orderings: readonly OrderingDefinition<OrderingName>[]
1639
1778
  }
1640
1779
 
@@ -1645,7 +1784,8 @@ export function defineGraphModule<const Configuration extends GraphModuleConfigu
1645
1784
  ConfigurationProjectionPath<Configuration>,
1646
1785
  ConfigurationOrderingName<Configuration>,
1647
1786
  ConfigurationProjectionField<Configuration>,
1648
- ConfigurationRelation<Configuration>
1787
+ ConfigurationRelation<Configuration>,
1788
+ ConfigurationProjectionObject<Configuration>
1649
1789
  >
1650
1790
 
1651
1791
  export interface GraphConfiguration {
@@ -1657,6 +1797,7 @@ export interface GraphConfiguration {
1657
1797
  relations?: readonly RelationDefinition[]
1658
1798
  constraints?: readonly ConstraintDefinition[]
1659
1799
  projection?: readonly ProjectionFieldDefinition[]
1800
+ objects?: readonly ProjectionObjectDefinition[]
1660
1801
  orderings?: readonly OrderingDefinition[]
1661
1802
  }
1662
1803
 
@@ -1668,7 +1809,8 @@ export function defineGraph<const Configuration extends GraphConfiguration>(
1668
1809
  ConfigurationOrderingName<Configuration>,
1669
1810
  ConfigurationProjectionField<Configuration>,
1670
1811
  ConfigurationRelation<Configuration>,
1671
- ConfigurationRoot<Configuration>
1812
+ ConfigurationRoot<Configuration>,
1813
+ ConfigurationProjectionObject<Configuration>
1672
1814
  >
1673
1815
 
1674
1816
  export interface SummaryGraphConfiguration {
@@ -1692,5 +1834,6 @@ export function defineSummaryGraph<const Configuration extends SummaryGraphConfi
1692
1834
  ConfigurationOrderingName<Configuration>,
1693
1835
  ConfigurationProjectionField<Configuration>,
1694
1836
  ConfigurationRelation<Configuration>,
1695
- ConfigurationRoot<Configuration>
1837
+ ConfigurationRoot<Configuration>,
1838
+ never
1696
1839
  >
package/dsl.js CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict'
2
2
 
3
- const GRAPH_DEFINITION_VERSION = 9
3
+ const GRAPH_DEFINITION_VERSION = 10
4
4
  const SCALAR_TYPES = new Set([
5
5
  'boolean',
6
6
  'int32',
@@ -19,6 +19,7 @@ const SUMMARY_FIELD_BRAND = Symbol('SummaryField')
19
19
  const RELATION_CONFIGURATION_KEYS = new Set(['name', 'from', 'to', 'on', 'required', 'cardinality', 'selection'])
20
20
  const CONSTRAINT_CONFIGURATION_KEYS = new Set(['predicate', 'when'])
21
21
  const PROJECTION_CONFIGURATION_KEYS = new Set(['path', 'expression', 'default'])
22
+ const PROJECTION_OBJECT_CONFIGURATION_KEYS = new Set(['path', 'presence'])
22
23
  const EXISTS_CONFIGURATION_KEYS = new Set(['from'])
23
24
  const ORDERING_CONFIGURATION_KEYS = new Set(['name', 'by', 'default'])
24
25
 
@@ -357,6 +358,14 @@ function project(value) {
357
358
  return definition
358
359
  }
359
360
 
361
+ function projectObject(value) {
362
+ const configuration = configurationOf('projectObject', value, PROJECTION_OBJECT_CONFIGURATION_KEYS)
363
+ return {
364
+ path: typeof configuration.path === 'string' ? configuration.path.split('.') : [...configuration.path],
365
+ presence: asExpression(configuration.presence),
366
+ }
367
+ }
368
+
360
369
  function dimension(value) {
361
370
  return summaryField('dimension', configurationOf('dimension', value, PROJECTION_CONFIGURATION_KEYS))
362
371
  }
@@ -429,6 +438,7 @@ function defineGraphModule(configuration) {
429
438
  relations: content.relations,
430
439
  constraints: content.constraints,
431
440
  projection: content.projection,
441
+ objects: content.objects,
432
442
  orderings: content.orderings,
433
443
  }
434
444
  Object.defineProperty(module, GRAPH_MODULE_BRAND, { value: true })
@@ -456,7 +466,7 @@ function defineSummaryGraph(configuration) {
456
466
 
457
467
  function buildGraphDefinition(configuration, mode) {
458
468
  const content = composeDefinitionContent(configuration)
459
- validateProjectionMode(content.projection, mode)
469
+ validateProjectionMode(content.projection, content.objects, mode)
460
470
 
461
471
  return deepFreeze({
462
472
  schemaVersion: GRAPH_DEFINITION_VERSION,
@@ -468,13 +478,17 @@ function buildGraphDefinition(configuration, mode) {
468
478
  constraints: content.constraints,
469
479
  projection: {
470
480
  fields: content.projection,
481
+ objects: content.objects,
471
482
  },
472
483
  orderings: content.orderings,
473
484
  })
474
485
  }
475
486
 
476
- function validateProjectionMode(projection, mode) {
487
+ function validateProjectionMode(projection, objects, mode) {
477
488
  if (mode === 'summary') {
489
+ if (objects.length > 0) {
490
+ throw new TypeError('Summary graph cannot define projection objects')
491
+ }
478
492
  if (projection.length === 0) {
479
493
  throw new TypeError('Summary graph must define at least one dimension or measure')
480
494
  }
@@ -502,6 +516,7 @@ function composeDefinitionContent(configuration) {
502
516
  relations: [],
503
517
  constraints: [],
504
518
  projection: [],
519
+ objects: [],
505
520
  orderings: [],
506
521
  }
507
522
  const indexes = {
@@ -510,6 +525,7 @@ function composeDefinitionContent(configuration) {
510
525
  relations: new Map(),
511
526
  constraints: new Set(),
512
527
  projection: new Map(),
528
+ objects: new Map(),
513
529
  orderings: new Map(),
514
530
  }
515
531
 
@@ -547,6 +563,9 @@ function addDefinitionPart(content, indexes, part, owner) {
547
563
  addNamedDefinitions(content.projection, indexes.projection, part.projection, 'projection', owner, (projection) =>
548
564
  projection.path.join('.'),
549
565
  )
566
+ addNamedDefinitions(content.objects, indexes.objects, part.objects, 'projection object', owner, (object) =>
567
+ object.path.join('.'),
568
+ )
550
569
 
551
570
  addNamedDefinitions(
552
571
  content.orderings,
@@ -732,6 +751,7 @@ exports.relation = relation
732
751
  exports.constraint = constraint
733
752
  exports.ordering = ordering
734
753
  exports.project = project
754
+ exports.projectObject = projectObject
735
755
  exports.dimension = dimension
736
756
  exports.measure = measure
737
757
  exports.asc = asc
package/index.d.ts CHANGED
@@ -64,6 +64,11 @@ export interface CompiledSqlColumn {
64
64
  relations: Array<string>
65
65
  }
66
66
 
67
+ export interface CompiledSqlObject {
68
+ path: string
69
+ presenceColumn: string
70
+ }
71
+
67
72
  export interface CompiledSqlRelation {
68
73
  name: string
69
74
  from: string
@@ -76,6 +81,7 @@ export interface CompiledSqlStatement {
76
81
  sql: string
77
82
  bindings: Array<SqlBinding>
78
83
  columns: Array<CompiledSqlColumn>
84
+ objects: Array<CompiledSqlObject>
79
85
  relations: Array<CompiledSqlRelation>
80
86
  }
81
87
 
package/index.js CHANGED
@@ -80,8 +80,8 @@ function requireNative() {
80
80
  try {
81
81
  const binding = require('@query-graph/core-android-arm64')
82
82
  const bindingPackageVersion = require('@query-graph/core-android-arm64/package.json').version
83
- if (bindingPackageVersion !== '1.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
84
- throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
83
+ if (bindingPackageVersion !== '1.1.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
84
+ throw new Error(`Native binding package version mismatch, expected 1.1.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
85
85
  }
86
86
  return binding
87
87
  } catch (e) {
@@ -96,8 +96,8 @@ function requireNative() {
96
96
  try {
97
97
  const binding = require('@query-graph/core-android-arm-eabi')
98
98
  const bindingPackageVersion = require('@query-graph/core-android-arm-eabi/package.json').version
99
- if (bindingPackageVersion !== '1.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
100
- throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
99
+ if (bindingPackageVersion !== '1.1.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
100
+ throw new Error(`Native binding package version mismatch, expected 1.1.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
101
101
  }
102
102
  return binding
103
103
  } catch (e) {
@@ -116,8 +116,8 @@ function requireNative() {
116
116
  try {
117
117
  const binding = require('@query-graph/core-win32-x64-msvc')
118
118
  const bindingPackageVersion = require('@query-graph/core-win32-x64-msvc/package.json').version
119
- if (bindingPackageVersion !== '1.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
120
- throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
119
+ if (bindingPackageVersion !== '1.1.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
120
+ throw new Error(`Native binding package version mismatch, expected 1.1.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
121
121
  }
122
122
  return binding
123
123
  } catch (e) {
@@ -132,8 +132,8 @@ function requireNative() {
132
132
  try {
133
133
  const binding = require('@query-graph/core-win32-ia32-msvc')
134
134
  const bindingPackageVersion = require('@query-graph/core-win32-ia32-msvc/package.json').version
135
- if (bindingPackageVersion !== '1.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
136
- throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
135
+ if (bindingPackageVersion !== '1.1.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
136
+ throw new Error(`Native binding package version mismatch, expected 1.1.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
137
137
  }
138
138
  return binding
139
139
  } catch (e) {
@@ -148,8 +148,8 @@ function requireNative() {
148
148
  try {
149
149
  const binding = require('@query-graph/core-win32-arm64-msvc')
150
150
  const bindingPackageVersion = require('@query-graph/core-win32-arm64-msvc/package.json').version
151
- if (bindingPackageVersion !== '1.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
152
- throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
151
+ if (bindingPackageVersion !== '1.1.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
152
+ throw new Error(`Native binding package version mismatch, expected 1.1.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
153
153
  }
154
154
  return binding
155
155
  } catch (e) {
@@ -167,8 +167,8 @@ function requireNative() {
167
167
  try {
168
168
  const binding = require('@query-graph/core-darwin-universal')
169
169
  const bindingPackageVersion = require('@query-graph/core-darwin-universal/package.json').version
170
- if (bindingPackageVersion !== '1.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
171
- throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
170
+ if (bindingPackageVersion !== '1.1.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
171
+ throw new Error(`Native binding package version mismatch, expected 1.1.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
172
172
  }
173
173
  return binding
174
174
  } catch (e) {
@@ -183,8 +183,8 @@ function requireNative() {
183
183
  try {
184
184
  const binding = require('@query-graph/core-darwin-x64')
185
185
  const bindingPackageVersion = require('@query-graph/core-darwin-x64/package.json').version
186
- if (bindingPackageVersion !== '1.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
187
- throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
186
+ if (bindingPackageVersion !== '1.1.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
187
+ throw new Error(`Native binding package version mismatch, expected 1.1.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
188
188
  }
189
189
  return binding
190
190
  } catch (e) {
@@ -199,8 +199,8 @@ function requireNative() {
199
199
  try {
200
200
  const binding = require('@query-graph/core-darwin-arm64')
201
201
  const bindingPackageVersion = require('@query-graph/core-darwin-arm64/package.json').version
202
- if (bindingPackageVersion !== '1.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
203
- throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
202
+ if (bindingPackageVersion !== '1.1.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
203
+ throw new Error(`Native binding package version mismatch, expected 1.1.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
204
204
  }
205
205
  return binding
206
206
  } catch (e) {
@@ -219,8 +219,8 @@ function requireNative() {
219
219
  try {
220
220
  const binding = require('@query-graph/core-freebsd-x64')
221
221
  const bindingPackageVersion = require('@query-graph/core-freebsd-x64/package.json').version
222
- if (bindingPackageVersion !== '1.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
223
- throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
222
+ if (bindingPackageVersion !== '1.1.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
223
+ throw new Error(`Native binding package version mismatch, expected 1.1.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
224
224
  }
225
225
  return binding
226
226
  } catch (e) {
@@ -235,8 +235,8 @@ function requireNative() {
235
235
  try {
236
236
  const binding = require('@query-graph/core-freebsd-arm64')
237
237
  const bindingPackageVersion = require('@query-graph/core-freebsd-arm64/package.json').version
238
- if (bindingPackageVersion !== '1.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
239
- throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
238
+ if (bindingPackageVersion !== '1.1.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
239
+ throw new Error(`Native binding package version mismatch, expected 1.1.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
240
240
  }
241
241
  return binding
242
242
  } catch (e) {
@@ -256,8 +256,8 @@ function requireNative() {
256
256
  try {
257
257
  const binding = require('@query-graph/core-linux-x64-musl')
258
258
  const bindingPackageVersion = require('@query-graph/core-linux-x64-musl/package.json').version
259
- if (bindingPackageVersion !== '1.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
260
- throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
259
+ if (bindingPackageVersion !== '1.1.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
260
+ throw new Error(`Native binding package version mismatch, expected 1.1.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
261
261
  }
262
262
  return binding
263
263
  } catch (e) {
@@ -272,8 +272,8 @@ function requireNative() {
272
272
  try {
273
273
  const binding = require('@query-graph/core-linux-x64-gnu')
274
274
  const bindingPackageVersion = require('@query-graph/core-linux-x64-gnu/package.json').version
275
- if (bindingPackageVersion !== '1.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
276
- throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
275
+ if (bindingPackageVersion !== '1.1.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
276
+ throw new Error(`Native binding package version mismatch, expected 1.1.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
277
277
  }
278
278
  return binding
279
279
  } catch (e) {
@@ -290,8 +290,8 @@ function requireNative() {
290
290
  try {
291
291
  const binding = require('@query-graph/core-linux-arm64-musl')
292
292
  const bindingPackageVersion = require('@query-graph/core-linux-arm64-musl/package.json').version
293
- if (bindingPackageVersion !== '1.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
294
- throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
293
+ if (bindingPackageVersion !== '1.1.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
294
+ throw new Error(`Native binding package version mismatch, expected 1.1.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
295
295
  }
296
296
  return binding
297
297
  } catch (e) {
@@ -306,8 +306,8 @@ function requireNative() {
306
306
  try {
307
307
  const binding = require('@query-graph/core-linux-arm64-gnu')
308
308
  const bindingPackageVersion = require('@query-graph/core-linux-arm64-gnu/package.json').version
309
- if (bindingPackageVersion !== '1.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
310
- throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
309
+ if (bindingPackageVersion !== '1.1.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
310
+ throw new Error(`Native binding package version mismatch, expected 1.1.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
311
311
  }
312
312
  return binding
313
313
  } catch (e) {
@@ -324,8 +324,8 @@ function requireNative() {
324
324
  try {
325
325
  const binding = require('@query-graph/core-linux-arm-musleabihf')
326
326
  const bindingPackageVersion = require('@query-graph/core-linux-arm-musleabihf/package.json').version
327
- if (bindingPackageVersion !== '1.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
328
- throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
327
+ if (bindingPackageVersion !== '1.1.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
328
+ throw new Error(`Native binding package version mismatch, expected 1.1.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
329
329
  }
330
330
  return binding
331
331
  } catch (e) {
@@ -340,8 +340,8 @@ function requireNative() {
340
340
  try {
341
341
  const binding = require('@query-graph/core-linux-arm-gnueabihf')
342
342
  const bindingPackageVersion = require('@query-graph/core-linux-arm-gnueabihf/package.json').version
343
- if (bindingPackageVersion !== '1.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
344
- throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
343
+ if (bindingPackageVersion !== '1.1.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
344
+ throw new Error(`Native binding package version mismatch, expected 1.1.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
345
345
  }
346
346
  return binding
347
347
  } catch (e) {
@@ -358,8 +358,8 @@ function requireNative() {
358
358
  try {
359
359
  const binding = require('@query-graph/core-linux-loong64-musl')
360
360
  const bindingPackageVersion = require('@query-graph/core-linux-loong64-musl/package.json').version
361
- if (bindingPackageVersion !== '1.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
362
- throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
361
+ if (bindingPackageVersion !== '1.1.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
362
+ throw new Error(`Native binding package version mismatch, expected 1.1.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
363
363
  }
364
364
  return binding
365
365
  } catch (e) {
@@ -374,8 +374,8 @@ function requireNative() {
374
374
  try {
375
375
  const binding = require('@query-graph/core-linux-loong64-gnu')
376
376
  const bindingPackageVersion = require('@query-graph/core-linux-loong64-gnu/package.json').version
377
- if (bindingPackageVersion !== '1.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
378
- throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
377
+ if (bindingPackageVersion !== '1.1.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
378
+ throw new Error(`Native binding package version mismatch, expected 1.1.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
379
379
  }
380
380
  return binding
381
381
  } catch (e) {
@@ -392,8 +392,8 @@ function requireNative() {
392
392
  try {
393
393
  const binding = require('@query-graph/core-linux-riscv64-musl')
394
394
  const bindingPackageVersion = require('@query-graph/core-linux-riscv64-musl/package.json').version
395
- if (bindingPackageVersion !== '1.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
396
- throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
395
+ if (bindingPackageVersion !== '1.1.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
396
+ throw new Error(`Native binding package version mismatch, expected 1.1.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
397
397
  }
398
398
  return binding
399
399
  } catch (e) {
@@ -408,8 +408,8 @@ function requireNative() {
408
408
  try {
409
409
  const binding = require('@query-graph/core-linux-riscv64-gnu')
410
410
  const bindingPackageVersion = require('@query-graph/core-linux-riscv64-gnu/package.json').version
411
- if (bindingPackageVersion !== '1.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
412
- throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
411
+ if (bindingPackageVersion !== '1.1.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
412
+ throw new Error(`Native binding package version mismatch, expected 1.1.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
413
413
  }
414
414
  return binding
415
415
  } catch (e) {
@@ -425,8 +425,8 @@ function requireNative() {
425
425
  try {
426
426
  const binding = require('@query-graph/core-linux-ppc64-gnu')
427
427
  const bindingPackageVersion = require('@query-graph/core-linux-ppc64-gnu/package.json').version
428
- if (bindingPackageVersion !== '1.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
429
- throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
428
+ if (bindingPackageVersion !== '1.1.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
429
+ throw new Error(`Native binding package version mismatch, expected 1.1.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
430
430
  }
431
431
  return binding
432
432
  } catch (e) {
@@ -441,8 +441,8 @@ function requireNative() {
441
441
  try {
442
442
  const binding = require('@query-graph/core-linux-s390x-gnu')
443
443
  const bindingPackageVersion = require('@query-graph/core-linux-s390x-gnu/package.json').version
444
- if (bindingPackageVersion !== '1.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
445
- throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
444
+ if (bindingPackageVersion !== '1.1.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
445
+ throw new Error(`Native binding package version mismatch, expected 1.1.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
446
446
  }
447
447
  return binding
448
448
  } catch (e) {
@@ -461,8 +461,8 @@ function requireNative() {
461
461
  try {
462
462
  const binding = require('@query-graph/core-openharmony-arm64')
463
463
  const bindingPackageVersion = require('@query-graph/core-openharmony-arm64/package.json').version
464
- if (bindingPackageVersion !== '1.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
465
- throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
464
+ if (bindingPackageVersion !== '1.1.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
465
+ throw new Error(`Native binding package version mismatch, expected 1.1.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
466
466
  }
467
467
  return binding
468
468
  } catch (e) {
@@ -477,8 +477,8 @@ function requireNative() {
477
477
  try {
478
478
  const binding = require('@query-graph/core-openharmony-x64')
479
479
  const bindingPackageVersion = require('@query-graph/core-openharmony-x64/package.json').version
480
- if (bindingPackageVersion !== '1.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
481
- throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
480
+ if (bindingPackageVersion !== '1.1.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
481
+ throw new Error(`Native binding package version mismatch, expected 1.1.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
482
482
  }
483
483
  return binding
484
484
  } catch (e) {
@@ -493,8 +493,8 @@ function requireNative() {
493
493
  try {
494
494
  const binding = require('@query-graph/core-openharmony-arm')
495
495
  const bindingPackageVersion = require('@query-graph/core-openharmony-arm/package.json').version
496
- if (bindingPackageVersion !== '1.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
497
- throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
496
+ if (bindingPackageVersion !== '1.1.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
497
+ throw new Error(`Native binding package version mismatch, expected 1.1.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
498
498
  }
499
499
  return binding
500
500
  } catch (e) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@query-graph/core",
3
- "version": "1.1.1",
3
+ "version": "1.1.2",
4
4
  "description": "Native query graph planner and SQL compiler for Node.js",
5
5
  "workspaces": [
6
6
  "packages/*"
@@ -136,9 +136,9 @@
136
136
  },
137
137
  "packageManager": "yarn@4.13.0",
138
138
  "optionalDependencies": {
139
- "@query-graph/core-win32-x64-msvc": "1.1.1",
140
- "@query-graph/core-darwin-x64": "1.1.1",
141
- "@query-graph/core-linux-x64-gnu": "1.1.1",
142
- "@query-graph/core-darwin-arm64": "1.1.1"
139
+ "@query-graph/core-win32-x64-msvc": "1.1.2",
140
+ "@query-graph/core-darwin-x64": "1.1.2",
141
+ "@query-graph/core-linux-x64-gnu": "1.1.2",
142
+ "@query-graph/core-darwin-arm64": "1.1.2"
143
143
  }
144
144
  }