@query-graph/core 1.1.5 → 1.1.6

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/LICENSE CHANGED
@@ -1,6 +1,7 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2020 N-API for Rust
3
+ Copyright (c) 2026 Viktor Marichev
4
+ Copyright (c) 2020 N-API for Rust contributors
4
5
 
5
6
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
7
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -17,6 +17,7 @@
17
17
  - выбор JOIN только для реально запрошенных полей и условий;
18
18
  - scalar и list parameters без подстановки значений в SQL;
19
19
  - <code>exists</code>, <code>firstBy</code>, nullable projection objects и именованные ordering;
20
+ - вычисляемые проекции с переносимыми строковыми и числовыми функциями;
20
21
  - summary-графы с dimensions, measures, <code>GROUP BY</code> и <code>HAVING</code>;
21
22
  - batch relations для загрузки коллекций после пагинации root;
22
23
  - один семантический definition для SQL Server и Oracle.
@@ -38,8 +39,8 @@ npm install @query-graph/core
38
39
 
39
40
  ```ts
40
41
  import { registerDefinition } from '@query-graph/core'
41
- import { constraint, defineGraph, eq, param, project, requiredParameter, source } from '@query-graph/core/dsl'
42
- import type { QueryOperation, ResultOf } from '@query-graph/core/dsl'
42
+ import { constraint, defineGraph, eq, project, requiredParam, source } from '@query-graph/core/dsl'
43
+ import type { ResultOf } from '@query-graph/core/dsl'
43
44
 
44
45
  const users = source('users', {
45
46
  id: 'int64',
@@ -47,7 +48,7 @@ const users = source('users', {
47
48
  email: 'string',
48
49
  })
49
50
 
50
- const organisationId = requiredParameter('organisationId', 'int64')
51
+ const organisationId = requiredParam('organisationId', 'int64')
51
52
 
52
53
  const usersDefinition = defineGraph({
53
54
  name: 'users',
@@ -56,7 +57,7 @@ const usersDefinition = defineGraph({
56
57
  parameters: [organisationId],
57
58
  constraints: [
58
59
  constraint({
59
- predicate: eq(users.field('organisationId'), param(organisationId)),
60
+ predicate: eq(users.field('organisationId'), organisationId),
60
61
  }),
61
62
  ],
62
63
  projection: [
@@ -76,13 +77,8 @@ const usersGraph = registerDefinition(usersDefinition).withRelationalMapping({
76
77
  },
77
78
  })
78
79
 
79
- const operation = {
80
- select: ['id', 'email'],
81
- parameters: { organisationId: 42 },
82
- } as const satisfies QueryOperation<typeof usersDefinition>
83
-
84
- const statement = usersGraph.compileSqlServer(operation, { version: '2022' })
85
- type UserRow = ResultOf<typeof usersDefinition, typeof operation>
80
+ const statement = usersGraph.compileSqlServer({ parameters: { organisationId: 42 } }, { version: '2022' })
81
+ type UserRow = ResultOf<typeof usersDefinition>
86
82
  ```
87
83
 
88
84
  <code>statement</code> содержит:
@@ -95,16 +91,108 @@ type UserRow = ResultOf<typeof usersDefinition, typeof operation>
95
91
  | <code>objects</code> | presence metadata для nullable вложенных объектов |
96
92
  | <code>relations</code> | связи, выбранные planner для этой operation |
97
93
 
98
- Executor берет значения из <code>operation.parameters</code> по
94
+ Executor берет значения из <code>parameters</code> переданной operation по
99
95
  <code>bindings</code>, вызывает DB driver и восстанавливает объект по
100
96
  <code>columns</code> и <code>objects</code>. Разбирать SQL не нужно.
101
97
 
102
98
  Тот же mapped graph можно скомпилировать в Oracle:
103
99
 
104
100
  ```ts
105
- const oracleStatement = usersGraph.compileOracle(operation, { version: '19c' })
101
+ const oracleStatement = usersGraph.compileOracle({ parameters: { organisationId: 42 } }, { version: '19c' })
102
+ ```
103
+
104
+ ## Зачем нужен planner
105
+
106
+ В реальном графе преимущество проявляется, когда одна definition обслуживает
107
+ разные формы результата:
108
+
109
+ ```text
110
+ orders
111
+ |-- customer
112
+ | `-- organisation
113
+ |-- latestPayment [firstBy]
114
+ `-- items [batch many]
115
+
116
+ constraints: organisationId, exists(activePromotion)
117
+ ```
118
+
119
+ <code>ordersDefinition</code> содержит показанные на схеме relations и
120
+ projection. Его небанальные части выглядят так:
121
+
122
+ ```ts
123
+ const latestPayment = relation({
124
+ name: 'latestPayment',
125
+ from: orders,
126
+ to: payments,
127
+ on: eq(orders.field('id'), payments.field('orderId')),
128
+ selection: firstBy(desc(payments.field('createdAt'))),
129
+ })
130
+
131
+ const hasActivePromotion = constraint({
132
+ predicate: exists(promotions, eq(promotions.field('active'), true)),
133
+ })
134
+
135
+ const ordersDefinition = defineGraph({
136
+ name: 'orders',
137
+ root: orders,
138
+ sources: [orders, customers, organisations, payments, promotions],
139
+ parameters: [organisationId],
140
+ relations: [customer, customerOrganisation, latestPayment, activePromotion],
141
+ constraints: [byOrganisation, hasActivePromotion],
142
+ objects: [customerObject, latestPaymentObject],
143
+ projection: [orderId, customerName, customerOrganisationName, latestPaymentAmount],
144
+ })
145
+
146
+ const items = batchRelation({
147
+ name: 'items',
148
+ from: 'id',
149
+ query: batchQuery({
150
+ graph: orderItemsGraph,
151
+ key: { path: 'orderId', parameter: orderIds },
152
+ }),
153
+ cardinality: 'many',
154
+ })
155
+
156
+ const mappedOrders = registerDefinition(ordersDefinition).withRelationalMapping(orderMapping)
157
+ const ordersGraph = composeGraph({ root: mappedOrders, relations: [items] })
158
+ ```
159
+
160
+ Обычные source и projection declarations здесь свернуты в именованные
161
+ константы. <code>customerObject</code> и <code>latestPaymentObject</code> созданы
162
+ через <code>projectObject</code>, поэтому отсутствующая to-one строка становится
163
+ <code>null</code>.
164
+
165
+ Одна и та же definition теперь обслуживает дешевый список:
166
+
167
+ ```ts
168
+ const listPlan = ordersGraph.compileSqlServerPlan({
169
+ select: ['id'],
170
+ parameters: { organisationId: 42 },
171
+ })
172
+
173
+ listPlan.root.relations // []
174
+ listPlan.batches // []
175
+ ```
176
+
177
+ И подробное представление:
178
+
179
+ ```ts
180
+ const detailsPlan = ordersGraph.compileSqlServerPlan({
181
+ select: ['id', 'customer.name', 'latestPayment.amount', 'items.name'],
182
+ parameters: { organisationId: 42 },
183
+ })
184
+
185
+ detailsPlan.root.relations.map(({ name }) => name)
186
+ // ['customer', 'latestPayment']
187
+
188
+ detailsPlan.batches.map(({ name }) => name)
189
+ // ['items']
106
190
  ```
107
191
 
192
+ Planner не добавляет невыбранную <code>customerOrganisation</code>,
193
+ <code>exists(activePromotion)</code> остается semijoin без размножения root-строк,
194
+ а <code>items</code> загружается одним batch-запросом для всех найденных orders.
195
+
108
196
  ## Модель
109
197
 
110
198
  ```text
@@ -160,9 +248,9 @@ import { defineGraph, relation, project } from '@query-graph/core/dsl'
160
248
  ```
161
249
 
162
250
  <code>@query-graph/core/definition</code> сохраняет позиционные фабрики только
163
- для совместимости линии 1.2.x. <code>@query-graph/dsl-object</code> остается
164
- тонким deprecated facade над <code>@query-graph/core/dsl</code>. Новому коду эти
165
- entrypoint не нужны.
251
+ для обратной совместимости с ранним API 1.x.
252
+ <code>@query-graph/dsl-object</code> остается тонким deprecated facade над
253
+ <code>@query-graph/core/dsl</code>. Новому коду эти entrypoint не нужны.
166
254
 
167
255
  Batch-фабрики временно доступны из package root, но новый код должен импортировать
168
256
  их из <code>@query-graph/core/dsl</code>.
@@ -177,7 +265,3 @@ JavaScript.
177
265
  SQL execution намеренно остается у потребителя. Это позволяет использовать
178
266
  любой pool, transaction model, tracing и политику retry, не связывая planner с
179
267
  конкретным DB driver.
180
-
181
- ### Rule 34
182
-
183
- Every sufficiently generic abstraction eventually gets an implementation.
package/definition.d.ts CHANGED
@@ -30,7 +30,7 @@ import type {
30
30
  } from './dsl.js'
31
31
 
32
32
  /** @deprecated Import authoring primitives from `@query-graph/core/dsl`. */
33
- export const GRAPH_DEFINITION_VERSION: 10
33
+ export const GRAPH_DEFINITION_VERSION: 11
34
34
 
35
35
  /** @deprecated Use `source.field(name)` from `@query-graph/core/dsl`. */
36
36
  export function field<
package/definition.js CHANGED
@@ -65,13 +65,17 @@ exports.hidden = objectDsl.hidden
65
65
  exports.source = objectDsl.source
66
66
  exports.field = field
67
67
  exports.requiredParameter = objectDsl.requiredParameter
68
+ exports.requiredParam = objectDsl.requiredParam
68
69
  exports.optionalParameter = objectDsl.optionalParameter
70
+ exports.optionalParam = objectDsl.optionalParam
69
71
  exports.param = objectDsl.param
70
72
  exports.literal = objectDsl.literal
71
73
  exports.integer = objectDsl.integer
72
74
  exports.decimal = objectDsl.decimal
73
75
  exports.requiredListParameter = objectDsl.requiredListParameter
76
+ exports.requiredListParam = objectDsl.requiredListParam
74
77
  exports.optionalListParameter = objectDsl.optionalListParameter
78
+ exports.optionalListParam = objectDsl.optionalListParam
75
79
  exports.eq = objectDsl.eq
76
80
  exports.neq = objectDsl.neq
77
81
  exports.lt = objectDsl.lt
@@ -86,11 +90,15 @@ exports.not = objectDsl.not
86
90
  exports.isNull = objectDsl.isNull
87
91
  exports.isNotNull = objectDsl.isNotNull
88
92
  exports.inParameter = objectDsl.inParameter
93
+ exports.inParam = objectDsl.inParam
89
94
  exports.exists = objectDsl.exists
90
95
  exports.lower = objectDsl.lower
91
96
  exports.upper = objectDsl.upper
92
97
  exports.coalesce = objectDsl.coalesce
93
98
  exports.concat = objectDsl.concat
99
+ exports.divide = objectDsl.divide
100
+ exports.truncate = objectDsl.truncate
101
+ exports.modulo = objectDsl.modulo
94
102
  exports.count = objectDsl.count
95
103
  exports.countDistinct = objectDsl.countDistinct
96
104
  exports.sum = objectDsl.sum
package/docs/authoring.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # Authoring DSL
2
2
 
3
3
  Authoring API находится в <code>@query-graph/core/dsl</code>. Он создает
4
- семантический definition версии 10, который не содержит таблиц, SQL aliases или
4
+ семантический definition версии 11, который не содержит таблиц, SQL aliases или
5
5
  синтаксиса диалекта.
6
6
 
7
7
  ## Sources и поля
@@ -22,13 +22,18 @@ const users = source('users', {
22
22
  ## Параметры
23
23
 
24
24
  ```ts
25
- const id = requiredParameter('id', 'int64')
26
- const status = optionalParameter('status', 'string')
27
- const ids = requiredListParameter('ids', 'int64')
25
+ const id = requiredParam('id', 'int64')
26
+ const status = optionalParam('status', 'string')
27
+ const ids = requiredListParam('ids', 'int64')
28
+ const optionalIds = optionalListParam('optionalIds', 'int64')
28
29
  ```
29
30
 
30
- Scalar parameter используется через <code>param</code>, list parameter через
31
- <code>inParameter</code>. Optional parameter не активирует constraint с
31
+ Scalar parameter передается в expression напрямую, list parameter используется
32
+ через <code>inParam</code>. Явная форма <code>param(id)</code> поддерживается
33
+ для совместимости. Полные имена <code>requiredParameter</code>,
34
+ <code>optionalParameter</code>, <code>requiredListParameter</code>,
35
+ <code>optionalListParameter</code> и <code>inParameter</code> остаются алиасами
36
+ тех же factories. Optional parameter не активирует constraint с
32
37
  <code>when</code>, пока значение отсутствует.
33
38
 
34
39
  ## Expressions
@@ -37,11 +42,34 @@ DSL предоставляет сравнения, boolean groups, null tests, s
37
42
  агрегаты и literals:
38
43
 
39
44
  ```ts
40
- const predicate = and(eq(users.field('organisationId'), param(organisationId)), isNull(users.field('dateDelete')))
45
+ const predicate = and(eq(users.field('organisationId'), organisationId), isNull(users.field('dateDelete')))
41
46
  ```
42
47
 
43
- Типы operands проверяются TypeScript во время authoring и повторно Rust при
44
- регистрации.
48
+ Semantic functions позволяют оставить вычисляемые поля частью графа, не
49
+ привязывая definition к синтаксису Oracle или SQL Server:
50
+
51
+ ```ts
52
+ const durationProjection = [
53
+ project({
54
+ path: 'hoursDuration',
55
+ expression: truncate(divide(services.field('durationMinutes'), 60)),
56
+ }),
57
+ project({
58
+ path: 'minutesDuration',
59
+ expression: modulo(services.field('durationMinutes'), 60),
60
+ }),
61
+ ]
62
+ ```
63
+
64
+ <code>divide</code> возвращает decimal для точных числовых типов и float64,
65
+ если хотя бы один operand имеет тип float64. <code>truncate</code> отбрасывает
66
+ дробную часть по направлению к нулю и сохраняет scalar type. <code>modulo</code>
67
+ принимает int32, int64 и decimal; float64 отклоняется, чтобы definition одинаково
68
+ работал в поддерживаемых диалектах. Nullability распространяется от operands к
69
+ результату.
70
+
71
+ TypeScript выводит тип и nullability результата во время authoring. Rust при
72
+ регистрации повторно проверяет arity и совместимость типов operands.
45
73
 
46
74
  ## Relations
47
75
 
@@ -72,7 +100,7 @@ const profileRelation = relation({
72
100
  ```ts
73
101
  constraint({
74
102
  when: organisationId,
75
- predicate: eq(users.field('organisationId'), param(organisationId)),
103
+ predicate: eq(users.field('organisationId'), organisationId),
76
104
  })
77
105
 
78
106
  constraint({
@@ -19,7 +19,7 @@ Many-связь в одном SQL может размножить root-стро
19
19
  Child-модуль один раз закрепляет контракт ключа:
20
20
 
21
21
  ```ts
22
- const itemIds = requiredListParameter('itemIds', 'int64')
22
+ const itemIds = requiredListParam('itemIds', 'int64')
23
23
 
24
24
  const childrenQuery = batchQuery({
25
25
  graph: childrenGraph,
@@ -47,6 +47,6 @@ JavaScript.
47
47
 
48
48
  ## Совместимость diagnostics
49
49
 
50
- Wire schema остается версии 10. В совместимых выпусках сохраняются diagnostic
50
+ Wire schema остается версии 11. В совместимых выпусках сохраняются diagnostic
51
51
  codes и locations. Message предназначен человеку и не должен использоваться как
52
52
  machine-readable contract.
package/docs/sql.md CHANGED
@@ -33,6 +33,18 @@ const oracle = graph.compileOracle(operation, { version: '19c' })
33
33
  Version capabilities проверяются до возврата SQL. Например, pagination и
34
34
  <code>firstBy</code> могут требовать более новую версию диалекта.
35
35
 
36
+ Semantic functions рендерятся с одинаковым поведением через разные конструкции
37
+ диалектов:
38
+
39
+ | DSL | Oracle | SQL Server |
40
+ | -------------------------------- | ----------------------------- | --------------------------------- |
41
+ | <code>divide(left, right)</code> | <code>left / right</code> | дробное <code>left / right</code> |
42
+ | <code>truncate(value)</code> | <code>TRUNC(value)</code> | <code>ROUND(value, 0, 1)</code> |
43
+ | <code>modulo(left, right)</code> | <code>MOD(left, right)</code> | <code>left % right</code> |
44
+
45
+ SQL Server compiler принудительно переводит <code>divide</code> в дробную
46
+ арифметику, чтобы два integer operands не дали integer division.
47
+
36
48
  ## Bindings
37
49
 
38
50
  Compiler никогда не вставляет operation values в SQL. Каждый binding содержит:
package/dsl.d.ts CHANGED
@@ -120,9 +120,13 @@ export {
120
120
  hidden,
121
121
  source,
122
122
  requiredParameter,
123
+ requiredParam,
123
124
  optionalParameter,
125
+ optionalParam,
124
126
  requiredListParameter,
127
+ requiredListParam,
125
128
  optionalListParameter,
129
+ optionalListParam,
126
130
  param,
127
131
  literal,
128
132
  integer,
@@ -137,6 +141,7 @@ export {
137
141
  inList,
138
142
  and,
139
143
  inParameter,
144
+ inParam,
140
145
  or,
141
146
  not,
142
147
  isNull,
@@ -146,6 +151,9 @@ export {
146
151
  upper,
147
152
  coalesce,
148
153
  concat,
154
+ divide,
155
+ truncate,
156
+ modulo,
149
157
  count,
150
158
  countDistinct,
151
159
  sum,
package/dsl.js CHANGED
@@ -9,13 +9,17 @@ exports.nullable = primitives.nullable
9
9
  exports.hidden = primitives.hidden
10
10
  exports.source = primitives.source
11
11
  exports.requiredParameter = primitives.requiredParameter
12
+ exports.requiredParam = primitives.requiredParam
12
13
  exports.optionalParameter = primitives.optionalParameter
14
+ exports.optionalParam = primitives.optionalParam
13
15
  exports.param = primitives.param
14
16
  exports.literal = primitives.literal
15
17
  exports.integer = primitives.integer
16
18
  exports.decimal = primitives.decimal
17
19
  exports.requiredListParameter = primitives.requiredListParameter
20
+ exports.requiredListParam = primitives.requiredListParam
18
21
  exports.optionalListParameter = primitives.optionalListParameter
22
+ exports.optionalListParam = primitives.optionalListParam
19
23
  exports.eq = primitives.eq
20
24
  exports.neq = primitives.neq
21
25
  exports.lt = primitives.lt
@@ -30,11 +34,15 @@ exports.not = primitives.not
30
34
  exports.isNull = primitives.isNull
31
35
  exports.isNotNull = primitives.isNotNull
32
36
  exports.inParameter = primitives.inParameter
37
+ exports.inParam = primitives.inParam
33
38
  exports.exists = primitives.exists
34
39
  exports.lower = primitives.lower
35
40
  exports.upper = primitives.upper
36
41
  exports.coalesce = primitives.coalesce
37
42
  exports.concat = primitives.concat
43
+ exports.divide = primitives.divide
44
+ exports.truncate = primitives.truncate
45
+ exports.modulo = primitives.modulo
38
46
  exports.count = primitives.count
39
47
  exports.countDistinct = primitives.countDistinct
40
48
  exports.sum = primitives.sum
@@ -11,7 +11,7 @@ const {
11
11
  const { asExpression, copySource, referenceName } = require('./primitives.js')
12
12
  const { GRAPH_MODULE_BRAND, SUMMARY_FIELD_BRAND } = require('./symbols.js')
13
13
 
14
- const GRAPH_DEFINITION_VERSION = 10
14
+ const GRAPH_DEFINITION_VERSION = 11
15
15
  const RELATION_CONFIGURATION_KEYS = new Set(['name', 'from', 'to', 'on', 'required', 'cardinality', 'selection'])
16
16
  const CONSTRAINT_CONFIGURATION_KEYS = new Set(['predicate', 'when'])
17
17
  const PROJECTION_CONFIGURATION_KEYS = new Set(['path', 'expression', 'default'])
@@ -1,7 +1,7 @@
1
1
  'use strict'
2
2
 
3
3
  const { arrayOf, configurationOf, nonEmptyString, objectOf, optionalBoolean } = require('../configuration.js')
4
- const { SUMMARY_FIELD_BRAND } = require('./symbols.js')
4
+ const { PARAMETER_REF_BRAND, SUMMARY_FIELD_BRAND } = require('./symbols.js')
5
5
 
6
6
  const SCALAR_TYPES = new Set([
7
7
  'boolean',
@@ -266,6 +266,18 @@ function concat(first, ...rest) {
266
266
  return call('concat', first, ...rest)
267
267
  }
268
268
 
269
+ function divide(left, right) {
270
+ return call('divide', left, right)
271
+ }
272
+
273
+ function truncate(expression) {
274
+ return call('truncate', expression)
275
+ }
276
+
277
+ function modulo(left, right) {
278
+ return call('modulo', left, right)
279
+ }
280
+
269
281
  function aggregate(functionName, expression) {
270
282
  const definition = {
271
283
  kind: 'aggregate',
@@ -325,6 +337,7 @@ function parameterDefinition(name, scalarType, required, shape = 'scalar') {
325
337
  if (shape === 'list') {
326
338
  definition.shape = 'list'
327
339
  }
340
+ Object.defineProperty(definition, PARAMETER_REF_BRAND, { value: true })
328
341
  return definition
329
342
  }
330
343
 
@@ -354,6 +367,9 @@ function asExpression(value) {
354
367
  if (value?.[SUMMARY_FIELD_BRAND] === true) {
355
368
  return value.expression
356
369
  }
370
+ if (value?.[PARAMETER_REF_BRAND] === true) {
371
+ return param(value)
372
+ }
357
373
  if (value && typeof value === 'object' && typeof value.kind === 'string') {
358
374
  return value
359
375
  }
@@ -399,6 +415,7 @@ module.exports = {
399
415
  count,
400
416
  countDistinct,
401
417
  decimal,
418
+ divide,
402
419
  eq,
403
420
  exists,
404
421
  fieldType,
@@ -406,6 +423,7 @@ module.exports = {
406
423
  gte,
407
424
  hidden,
408
425
  inList,
426
+ inParam: inParameter,
409
427
  inParameter,
410
428
  integer,
411
429
  isNotNull,
@@ -417,17 +435,23 @@ module.exports = {
417
435
  lte,
418
436
  maximum,
419
437
  minimum,
438
+ modulo,
420
439
  neq,
421
440
  not,
422
441
  nullable,
442
+ optionalListParam: optionalListParameter,
423
443
  optionalListParameter,
444
+ optionalParam: optionalParameter,
424
445
  optionalParameter,
425
446
  or,
426
447
  param,
427
448
  referenceName,
449
+ requiredListParam: requiredListParameter,
428
450
  requiredListParameter,
451
+ requiredParam: requiredParameter,
429
452
  requiredParameter,
430
453
  source,
431
454
  sum,
455
+ truncate,
432
456
  upper,
433
457
  }
@@ -1,4 +1,5 @@
1
1
  'use strict'
2
2
 
3
3
  exports.GRAPH_MODULE_BRAND = Symbol('GraphModule')
4
+ exports.PARAMETER_REF_BRAND = Symbol('ParameterRef')
4
5
  exports.SUMMARY_FIELD_BRAND = Symbol('SummaryField')
package/native.js CHANGED
@@ -81,12 +81,12 @@ function requireNative() {
81
81
  const binding = require('@query-graph/core-android-arm64')
82
82
  const bindingPackageVersion = require('@query-graph/core-android-arm64/package.json').version
83
83
  if (
84
- bindingPackageVersion !== '1.1.5' &&
84
+ bindingPackageVersion !== '1.1.6' &&
85
85
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
86
86
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
87
87
  ) {
88
88
  throw new Error(
89
- `Native binding package version mismatch, expected 1.1.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
89
+ `Native binding package version mismatch, expected 1.1.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
90
90
  )
91
91
  }
92
92
  return binding
@@ -103,12 +103,12 @@ function requireNative() {
103
103
  const binding = require('@query-graph/core-android-arm-eabi')
104
104
  const bindingPackageVersion = require('@query-graph/core-android-arm-eabi/package.json').version
105
105
  if (
106
- bindingPackageVersion !== '1.1.5' &&
106
+ bindingPackageVersion !== '1.1.6' &&
107
107
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
108
108
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
109
109
  ) {
110
110
  throw new Error(
111
- `Native binding package version mismatch, expected 1.1.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
111
+ `Native binding package version mismatch, expected 1.1.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
112
112
  )
113
113
  }
114
114
  return binding
@@ -129,12 +129,12 @@ function requireNative() {
129
129
  const binding = require('@query-graph/core-win32-x64-msvc')
130
130
  const bindingPackageVersion = require('@query-graph/core-win32-x64-msvc/package.json').version
131
131
  if (
132
- bindingPackageVersion !== '1.1.5' &&
132
+ bindingPackageVersion !== '1.1.6' &&
133
133
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
134
134
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
135
135
  ) {
136
136
  throw new Error(
137
- `Native binding package version mismatch, expected 1.1.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
137
+ `Native binding package version mismatch, expected 1.1.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
138
138
  )
139
139
  }
140
140
  return binding
@@ -151,12 +151,12 @@ function requireNative() {
151
151
  const binding = require('@query-graph/core-win32-ia32-msvc')
152
152
  const bindingPackageVersion = require('@query-graph/core-win32-ia32-msvc/package.json').version
153
153
  if (
154
- bindingPackageVersion !== '1.1.5' &&
154
+ bindingPackageVersion !== '1.1.6' &&
155
155
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
156
156
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
157
157
  ) {
158
158
  throw new Error(
159
- `Native binding package version mismatch, expected 1.1.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
159
+ `Native binding package version mismatch, expected 1.1.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
160
160
  )
161
161
  }
162
162
  return binding
@@ -173,12 +173,12 @@ function requireNative() {
173
173
  const binding = require('@query-graph/core-win32-arm64-msvc')
174
174
  const bindingPackageVersion = require('@query-graph/core-win32-arm64-msvc/package.json').version
175
175
  if (
176
- bindingPackageVersion !== '1.1.5' &&
176
+ bindingPackageVersion !== '1.1.6' &&
177
177
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
178
178
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
179
179
  ) {
180
180
  throw new Error(
181
- `Native binding package version mismatch, expected 1.1.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
181
+ `Native binding package version mismatch, expected 1.1.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
182
182
  )
183
183
  }
184
184
  return binding
@@ -198,12 +198,12 @@ function requireNative() {
198
198
  const binding = require('@query-graph/core-darwin-universal')
199
199
  const bindingPackageVersion = require('@query-graph/core-darwin-universal/package.json').version
200
200
  if (
201
- bindingPackageVersion !== '1.1.5' &&
201
+ bindingPackageVersion !== '1.1.6' &&
202
202
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
203
203
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
204
204
  ) {
205
205
  throw new Error(
206
- `Native binding package version mismatch, expected 1.1.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
206
+ `Native binding package version mismatch, expected 1.1.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
207
207
  )
208
208
  }
209
209
  return binding
@@ -220,12 +220,12 @@ function requireNative() {
220
220
  const binding = require('@query-graph/core-darwin-x64')
221
221
  const bindingPackageVersion = require('@query-graph/core-darwin-x64/package.json').version
222
222
  if (
223
- bindingPackageVersion !== '1.1.5' &&
223
+ bindingPackageVersion !== '1.1.6' &&
224
224
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
225
225
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
226
226
  ) {
227
227
  throw new Error(
228
- `Native binding package version mismatch, expected 1.1.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
228
+ `Native binding package version mismatch, expected 1.1.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
229
229
  )
230
230
  }
231
231
  return binding
@@ -242,12 +242,12 @@ function requireNative() {
242
242
  const binding = require('@query-graph/core-darwin-arm64')
243
243
  const bindingPackageVersion = require('@query-graph/core-darwin-arm64/package.json').version
244
244
  if (
245
- bindingPackageVersion !== '1.1.5' &&
245
+ bindingPackageVersion !== '1.1.6' &&
246
246
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
247
247
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
248
248
  ) {
249
249
  throw new Error(
250
- `Native binding package version mismatch, expected 1.1.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
250
+ `Native binding package version mismatch, expected 1.1.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
251
251
  )
252
252
  }
253
253
  return binding
@@ -268,12 +268,12 @@ function requireNative() {
268
268
  const binding = require('@query-graph/core-freebsd-x64')
269
269
  const bindingPackageVersion = require('@query-graph/core-freebsd-x64/package.json').version
270
270
  if (
271
- bindingPackageVersion !== '1.1.5' &&
271
+ bindingPackageVersion !== '1.1.6' &&
272
272
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
273
273
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
274
274
  ) {
275
275
  throw new Error(
276
- `Native binding package version mismatch, expected 1.1.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
276
+ `Native binding package version mismatch, expected 1.1.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
277
277
  )
278
278
  }
279
279
  return binding
@@ -290,12 +290,12 @@ function requireNative() {
290
290
  const binding = require('@query-graph/core-freebsd-arm64')
291
291
  const bindingPackageVersion = require('@query-graph/core-freebsd-arm64/package.json').version
292
292
  if (
293
- bindingPackageVersion !== '1.1.5' &&
293
+ bindingPackageVersion !== '1.1.6' &&
294
294
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
295
295
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
296
296
  ) {
297
297
  throw new Error(
298
- `Native binding package version mismatch, expected 1.1.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
298
+ `Native binding package version mismatch, expected 1.1.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
299
299
  )
300
300
  }
301
301
  return binding
@@ -317,12 +317,12 @@ function requireNative() {
317
317
  const binding = require('@query-graph/core-linux-x64-musl')
318
318
  const bindingPackageVersion = require('@query-graph/core-linux-x64-musl/package.json').version
319
319
  if (
320
- bindingPackageVersion !== '1.1.5' &&
320
+ bindingPackageVersion !== '1.1.6' &&
321
321
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
322
322
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
323
323
  ) {
324
324
  throw new Error(
325
- `Native binding package version mismatch, expected 1.1.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
325
+ `Native binding package version mismatch, expected 1.1.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
326
326
  )
327
327
  }
328
328
  return binding
@@ -339,12 +339,12 @@ function requireNative() {
339
339
  const binding = require('@query-graph/core-linux-x64-gnu')
340
340
  const bindingPackageVersion = require('@query-graph/core-linux-x64-gnu/package.json').version
341
341
  if (
342
- bindingPackageVersion !== '1.1.5' &&
342
+ bindingPackageVersion !== '1.1.6' &&
343
343
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
344
344
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
345
345
  ) {
346
346
  throw new Error(
347
- `Native binding package version mismatch, expected 1.1.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
347
+ `Native binding package version mismatch, expected 1.1.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
348
348
  )
349
349
  }
350
350
  return binding
@@ -363,12 +363,12 @@ function requireNative() {
363
363
  const binding = require('@query-graph/core-linux-arm64-musl')
364
364
  const bindingPackageVersion = require('@query-graph/core-linux-arm64-musl/package.json').version
365
365
  if (
366
- bindingPackageVersion !== '1.1.5' &&
366
+ bindingPackageVersion !== '1.1.6' &&
367
367
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
368
368
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
369
369
  ) {
370
370
  throw new Error(
371
- `Native binding package version mismatch, expected 1.1.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
371
+ `Native binding package version mismatch, expected 1.1.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
372
372
  )
373
373
  }
374
374
  return binding
@@ -385,12 +385,12 @@ function requireNative() {
385
385
  const binding = require('@query-graph/core-linux-arm64-gnu')
386
386
  const bindingPackageVersion = require('@query-graph/core-linux-arm64-gnu/package.json').version
387
387
  if (
388
- bindingPackageVersion !== '1.1.5' &&
388
+ bindingPackageVersion !== '1.1.6' &&
389
389
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
390
390
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
391
391
  ) {
392
392
  throw new Error(
393
- `Native binding package version mismatch, expected 1.1.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
393
+ `Native binding package version mismatch, expected 1.1.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
394
394
  )
395
395
  }
396
396
  return binding
@@ -409,12 +409,12 @@ function requireNative() {
409
409
  const binding = require('@query-graph/core-linux-arm-musleabihf')
410
410
  const bindingPackageVersion = require('@query-graph/core-linux-arm-musleabihf/package.json').version
411
411
  if (
412
- bindingPackageVersion !== '1.1.5' &&
412
+ bindingPackageVersion !== '1.1.6' &&
413
413
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
414
414
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
415
415
  ) {
416
416
  throw new Error(
417
- `Native binding package version mismatch, expected 1.1.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
417
+ `Native binding package version mismatch, expected 1.1.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
418
418
  )
419
419
  }
420
420
  return binding
@@ -431,12 +431,12 @@ function requireNative() {
431
431
  const binding = require('@query-graph/core-linux-arm-gnueabihf')
432
432
  const bindingPackageVersion = require('@query-graph/core-linux-arm-gnueabihf/package.json').version
433
433
  if (
434
- bindingPackageVersion !== '1.1.5' &&
434
+ bindingPackageVersion !== '1.1.6' &&
435
435
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
436
436
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
437
437
  ) {
438
438
  throw new Error(
439
- `Native binding package version mismatch, expected 1.1.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
439
+ `Native binding package version mismatch, expected 1.1.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
440
440
  )
441
441
  }
442
442
  return binding
@@ -455,12 +455,12 @@ function requireNative() {
455
455
  const binding = require('@query-graph/core-linux-loong64-musl')
456
456
  const bindingPackageVersion = require('@query-graph/core-linux-loong64-musl/package.json').version
457
457
  if (
458
- bindingPackageVersion !== '1.1.5' &&
458
+ bindingPackageVersion !== '1.1.6' &&
459
459
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
460
460
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
461
461
  ) {
462
462
  throw new Error(
463
- `Native binding package version mismatch, expected 1.1.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
463
+ `Native binding package version mismatch, expected 1.1.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
464
464
  )
465
465
  }
466
466
  return binding
@@ -477,12 +477,12 @@ function requireNative() {
477
477
  const binding = require('@query-graph/core-linux-loong64-gnu')
478
478
  const bindingPackageVersion = require('@query-graph/core-linux-loong64-gnu/package.json').version
479
479
  if (
480
- bindingPackageVersion !== '1.1.5' &&
480
+ bindingPackageVersion !== '1.1.6' &&
481
481
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
482
482
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
483
483
  ) {
484
484
  throw new Error(
485
- `Native binding package version mismatch, expected 1.1.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
485
+ `Native binding package version mismatch, expected 1.1.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
486
486
  )
487
487
  }
488
488
  return binding
@@ -501,12 +501,12 @@ function requireNative() {
501
501
  const binding = require('@query-graph/core-linux-riscv64-musl')
502
502
  const bindingPackageVersion = require('@query-graph/core-linux-riscv64-musl/package.json').version
503
503
  if (
504
- bindingPackageVersion !== '1.1.5' &&
504
+ bindingPackageVersion !== '1.1.6' &&
505
505
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
506
506
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
507
507
  ) {
508
508
  throw new Error(
509
- `Native binding package version mismatch, expected 1.1.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
509
+ `Native binding package version mismatch, expected 1.1.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
510
510
  )
511
511
  }
512
512
  return binding
@@ -523,12 +523,12 @@ function requireNative() {
523
523
  const binding = require('@query-graph/core-linux-riscv64-gnu')
524
524
  const bindingPackageVersion = require('@query-graph/core-linux-riscv64-gnu/package.json').version
525
525
  if (
526
- bindingPackageVersion !== '1.1.5' &&
526
+ bindingPackageVersion !== '1.1.6' &&
527
527
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
528
528
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
529
529
  ) {
530
530
  throw new Error(
531
- `Native binding package version mismatch, expected 1.1.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
531
+ `Native binding package version mismatch, expected 1.1.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
532
532
  )
533
533
  }
534
534
  return binding
@@ -546,12 +546,12 @@ function requireNative() {
546
546
  const binding = require('@query-graph/core-linux-ppc64-gnu')
547
547
  const bindingPackageVersion = require('@query-graph/core-linux-ppc64-gnu/package.json').version
548
548
  if (
549
- bindingPackageVersion !== '1.1.5' &&
549
+ bindingPackageVersion !== '1.1.6' &&
550
550
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
551
551
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
552
552
  ) {
553
553
  throw new Error(
554
- `Native binding package version mismatch, expected 1.1.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
554
+ `Native binding package version mismatch, expected 1.1.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
555
555
  )
556
556
  }
557
557
  return binding
@@ -568,12 +568,12 @@ function requireNative() {
568
568
  const binding = require('@query-graph/core-linux-s390x-gnu')
569
569
  const bindingPackageVersion = require('@query-graph/core-linux-s390x-gnu/package.json').version
570
570
  if (
571
- bindingPackageVersion !== '1.1.5' &&
571
+ bindingPackageVersion !== '1.1.6' &&
572
572
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
573
573
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
574
574
  ) {
575
575
  throw new Error(
576
- `Native binding package version mismatch, expected 1.1.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
576
+ `Native binding package version mismatch, expected 1.1.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
577
577
  )
578
578
  }
579
579
  return binding
@@ -594,12 +594,12 @@ function requireNative() {
594
594
  const binding = require('@query-graph/core-openharmony-arm64')
595
595
  const bindingPackageVersion = require('@query-graph/core-openharmony-arm64/package.json').version
596
596
  if (
597
- bindingPackageVersion !== '1.1.5' &&
597
+ bindingPackageVersion !== '1.1.6' &&
598
598
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
599
599
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
600
600
  ) {
601
601
  throw new Error(
602
- `Native binding package version mismatch, expected 1.1.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
602
+ `Native binding package version mismatch, expected 1.1.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
603
603
  )
604
604
  }
605
605
  return binding
@@ -616,12 +616,12 @@ function requireNative() {
616
616
  const binding = require('@query-graph/core-openharmony-x64')
617
617
  const bindingPackageVersion = require('@query-graph/core-openharmony-x64/package.json').version
618
618
  if (
619
- bindingPackageVersion !== '1.1.5' &&
619
+ bindingPackageVersion !== '1.1.6' &&
620
620
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
621
621
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
622
622
  ) {
623
623
  throw new Error(
624
- `Native binding package version mismatch, expected 1.1.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
624
+ `Native binding package version mismatch, expected 1.1.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
625
625
  )
626
626
  }
627
627
  return binding
@@ -638,12 +638,12 @@ function requireNative() {
638
638
  const binding = require('@query-graph/core-openharmony-arm')
639
639
  const bindingPackageVersion = require('@query-graph/core-openharmony-arm/package.json').version
640
640
  if (
641
- bindingPackageVersion !== '1.1.5' &&
641
+ bindingPackageVersion !== '1.1.6' &&
642
642
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
643
643
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
644
644
  ) {
645
645
  throw new Error(
646
- `Native binding package version mismatch, expected 1.1.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
646
+ `Native binding package version mismatch, expected 1.1.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
647
647
  )
648
648
  }
649
649
  return binding
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@query-graph/core",
3
- "version": "1.1.5",
3
+ "version": "1.1.6",
4
4
  "description": "Native query graph planner and SQL compiler for Node.js",
5
5
  "workspaces": [
6
6
  "packages/*"
@@ -141,9 +141,9 @@
141
141
  },
142
142
  "packageManager": "yarn@4.13.0",
143
143
  "optionalDependencies": {
144
- "@query-graph/core-win32-x64-msvc": "1.1.5",
145
- "@query-graph/core-darwin-x64": "1.1.5",
146
- "@query-graph/core-linux-x64-gnu": "1.1.5",
147
- "@query-graph/core-darwin-arm64": "1.1.5"
144
+ "@query-graph/core-win32-x64-msvc": "1.1.6",
145
+ "@query-graph/core-darwin-x64": "1.1.6",
146
+ "@query-graph/core-linux-x64-gnu": "1.1.6",
147
+ "@query-graph/core-darwin-arm64": "1.1.6"
148
148
  }
149
149
  }
@@ -84,11 +84,14 @@ export interface SourceRef<Key extends string = string, Fields extends FieldSpec
84
84
  >
85
85
  }
86
86
 
87
+ declare const parameterRefBrand: unique symbol
88
+
87
89
  export interface ScalarParameterRef<
88
90
  Name extends string = string,
89
91
  Type extends ScalarType = ScalarType,
90
92
  Required extends boolean = boolean,
91
93
  > extends ParameterDefinition {
94
+ readonly [parameterRefBrand]: true
92
95
  name: Name
93
96
  scalarType: Type
94
97
  shape?: 'scalar'
@@ -100,6 +103,7 @@ export interface ListParameterRef<
100
103
  Type extends ScalarType = ScalarType,
101
104
  Required extends boolean = boolean,
102
105
  > extends ParameterDefinition {
106
+ readonly [parameterRefBrand]: true
103
107
  name: Name
104
108
  scalarType: Type
105
109
  shape: 'list'
@@ -121,7 +125,7 @@ export type RelationRef<
121
125
  > = RelationDefinition<Name, From, To, Required, Cardinality>
122
126
 
123
127
  export type LiteralInput = null | boolean | string | number
124
- export type ExpressionInput = Expression | LiteralInput | SummaryFieldDefinition
128
+ export type ExpressionInput = Expression | LiteralInput | ScalarParameterRef | SummaryFieldDefinition
125
129
 
126
130
  type NumberLiteralScalarType<Value extends number> = number extends Value
127
131
  ? 'int64' | 'decimal'
@@ -134,26 +138,30 @@ type InputScalarType<Input extends ExpressionInput> =
134
138
  ? Type
135
139
  : Input extends ProjectionFieldDefinition<infer _Path, infer Type, infer _Nullability, infer _SelectedByDefault>
136
140
  ? Type
137
- : Input extends null
138
- ? null
139
- : Input extends boolean
140
- ? 'boolean'
141
- : Input extends string
142
- ? 'string'
143
- : Input extends number
144
- ? NumberLiteralScalarType<Input>
145
- : ScalarType
141
+ : Input extends ScalarParameterRef<infer _Name, infer Type, infer _Required>
142
+ ? Type
143
+ : Input extends null
144
+ ? null
145
+ : Input extends boolean
146
+ ? 'boolean'
147
+ : Input extends string
148
+ ? 'string'
149
+ : Input extends number
150
+ ? NumberLiteralScalarType<Input>
151
+ : ScalarType
146
152
 
147
153
  type InputNullability<Input extends ExpressionInput> =
148
154
  Input extends ExpressionTypeMetadata<infer _Type, infer Nullability>
149
155
  ? Nullability
150
156
  : Input extends ProjectionFieldDefinition<infer _Path, infer _Type, infer Nullability, infer _SelectedByDefault>
151
157
  ? Nullability
152
- : Input extends null
153
- ? true
154
- : Input extends Expression
155
- ? boolean
156
- : false
158
+ : Input extends ScalarParameterRef
159
+ ? false
160
+ : Input extends null
161
+ ? true
162
+ : Input extends Expression
163
+ ? boolean
164
+ : false
157
165
 
158
166
  export type ExpressionScalarType<Input extends ExpressionInput> = InputScalarType<Input>
159
167
  export type ExpressionNullability<Input extends ExpressionInput> = InputNullability<Input>
@@ -176,6 +184,8 @@ type AverageScalarType<Type extends ScalarType | null> = Type extends 'float64'
176
184
  ? 'decimal'
177
185
  : Exclude<Type, null>
178
186
 
187
+ type DivideScalarType<Type extends ScalarType | null> = 'float64' extends Type ? 'float64' : 'decimal'
188
+
179
189
  type InputNullabilities<Inputs extends readonly ExpressionInput[]> = {
180
190
  [Index in keyof Inputs]: InputNullability<Inputs[Index]>
181
191
  }
@@ -211,18 +221,23 @@ export function requiredParameter<const Name extends string, const Type extends
211
221
  name: Name,
212
222
  scalarType: Type,
213
223
  ): ScalarParameterRef<Name, Type, true>
224
+ export const requiredParam: typeof requiredParameter
214
225
  export function optionalParameter<const Name extends string, const Type extends ScalarType>(
215
226
  name: Name,
216
227
  scalarType: Type,
217
228
  ): ScalarParameterRef<Name, Type, false>
229
+ export const optionalParam: typeof optionalParameter
218
230
  export function requiredListParameter<const Name extends string, const Type extends ScalarType>(
219
231
  name: Name,
220
232
  scalarType: Type,
221
233
  ): ListParameterRef<Name, Type, true>
234
+ export const requiredListParam: typeof requiredListParameter
222
235
  export function optionalListParameter<const Name extends string, const Type extends ScalarType>(
223
236
  name: Name,
224
237
  scalarType: Type,
225
238
  ): ListParameterRef<Name, Type, false>
239
+ export const optionalListParam: typeof optionalListParameter
240
+ /** @deprecated Pass a scalar parameter reference directly to an expression factory. */
226
241
  export function param<const Name extends string, const Type extends ScalarType>(
227
242
  parameter: ScalarParameterRef<Name, Type>,
228
243
  ): TypedExpression<ParameterExpression<Name>, Type, false>
@@ -282,6 +297,7 @@ export function inParameter<
282
297
  expression: Value,
283
298
  parameter: ListParameterRef<Name, Type>,
284
299
  ): TypedExpression<InParameterExpression<Name>, 'boolean', InputNullability<Value>>
300
+ export const inParam: typeof inParameter
285
301
  export function or<const Expressions extends readonly ExpressionInput[]>(
286
302
  ...expressions: Expressions
287
303
  ): TypedExpression<ExpressionGroup, 'boolean', AnyInputNullability<Expressions>>
@@ -326,6 +342,25 @@ export function concat<const First extends ExpressionInput, const Rest extends r
326
342
  first: First,
327
343
  ...rest: Rest
328
344
  ): TypedExpression<FunctionExpression, 'string', AllInputNullability<readonly [First, ...Rest]>>
345
+ export function divide<const Left extends ExpressionInput, const Right extends ExpressionInput>(
346
+ left: Left,
347
+ right: Right,
348
+ ): TypedExpression<
349
+ FunctionExpression,
350
+ DivideScalarType<InputScalarType<Left | Right>>,
351
+ AnyInputNullability<readonly [Left, Right]>
352
+ >
353
+ export function truncate<const Value extends ExpressionInput>(
354
+ expression: Value,
355
+ ): TypedExpression<FunctionExpression, Exclude<InputScalarType<Value>, null>, InputNullability<Value>>
356
+ export function modulo<const Left extends ExpressionInput, const Right extends ExpressionInput>(
357
+ left: Left,
358
+ right: Right,
359
+ ): TypedExpression<
360
+ FunctionExpression,
361
+ PromoteScalarType<InputScalarType<Left | Right>>,
362
+ AnyInputNullability<readonly [Left, Right]>
363
+ >
329
364
 
330
365
  export function count(expression?: ExpressionInput): TypedExpression<AggregateExpression, 'int64', false>
331
366
  export function countDistinct(expression: ExpressionInput): TypedExpression<AggregateExpression, 'int64', false>
package/types/model.d.ts CHANGED
@@ -28,7 +28,7 @@ export type ParameterShape = 'scalar' | 'list'
28
28
  export type RelationCardinality = 'one' | 'many'
29
29
  export type OrderDirection = 'asc' | 'desc'
30
30
  export type NullsOrder = 'first' | 'last'
31
- export type SemanticFunctionName = 'lower' | 'upper' | 'coalesce' | 'concat'
31
+ export type SemanticFunctionName = 'lower' | 'upper' | 'coalesce' | 'concat' | 'divide' | 'truncate' | 'modulo'
32
32
  export type AggregateFunctionName = 'count' | 'countDistinct' | 'sum' | 'average' | 'minimum' | 'maximum'
33
33
  export type ProjectionFieldRole = 'value' | 'dimension' | 'measure'
34
34
 
@@ -376,7 +376,7 @@ export interface FirstBySelection {
376
376
  export type RelationSelection = FirstBySelection
377
377
 
378
378
  export interface GraphDefinitionInput {
379
- schemaVersion: 10
379
+ schemaVersion: 11
380
380
  name: string
381
381
  root: string
382
382
  sources: SourceDefinition[]