@prisma/client-engine-runtime 7.5.0-dev.30 → 7.5.0-dev.31
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/dist/events.d.ts +1 -1
- package/dist/index.d.mts +7 -2
- package/dist/index.d.ts +7 -2
- package/dist/index.js +56 -10
- package/dist/index.mjs +56 -10
- package/dist/interpreter/in-memory-processing.d.ts +1 -1
- package/dist/interpreter/query-interpreter.d.ts +2 -1
- package/dist/interpreter/render-query.d.ts +2 -1
- package/dist/interpreter/validation.d.ts +2 -1
- package/dist/query-plan.d.ts +1 -0
- package/dist/tracing.d.ts +2 -1
- package/dist/utils.d.ts +6 -0
- package/package.json +5 -5
package/dist/events.d.ts
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -80,6 +80,10 @@ export declare type DecimalTaggedValue = {
|
|
|
80
80
|
value: string;
|
|
81
81
|
};
|
|
82
82
|
|
|
83
|
+
declare type DeepReadonly<T> = T extends undefined | null | boolean | string | number | symbol | Function | Date ? T : T extends Array<infer U> ? ReadonlyArray<DeepReadonly<U>> : unknown extends T ? unknown : {
|
|
84
|
+
readonly [K in keyof T]: DeepReadonly<T[K]>;
|
|
85
|
+
};
|
|
86
|
+
|
|
83
87
|
export declare function deserializeJsonObject(result: unknown): unknown;
|
|
84
88
|
|
|
85
89
|
/**
|
|
@@ -246,7 +250,7 @@ export declare type PrismaValuePlaceholder = {
|
|
|
246
250
|
export declare type QueryEvent = {
|
|
247
251
|
timestamp: Date;
|
|
248
252
|
query: string;
|
|
249
|
-
params: unknown[];
|
|
253
|
+
params: readonly unknown[];
|
|
250
254
|
duration: number;
|
|
251
255
|
};
|
|
252
256
|
|
|
@@ -259,7 +263,7 @@ export declare class QueryInterpreter {
|
|
|
259
263
|
provider?: SchemaProvider;
|
|
260
264
|
connectionInfo?: ConnectionInfo;
|
|
261
265
|
}): QueryInterpreter;
|
|
262
|
-
run(queryPlan: QueryPlanNode
|
|
266
|
+
run(queryPlan: DeepReadonly<QueryPlanNode>, options: QueryRuntimeOptions): Promise<unknown>;
|
|
263
267
|
private interpretNode;
|
|
264
268
|
}
|
|
265
269
|
|
|
@@ -351,6 +355,7 @@ export declare type QueryPlanNode = {
|
|
|
351
355
|
args: {
|
|
352
356
|
parent: QueryPlanNode;
|
|
353
357
|
children: JoinExpression[];
|
|
358
|
+
canAssumeStrictEquality: boolean;
|
|
354
359
|
};
|
|
355
360
|
} | {
|
|
356
361
|
type: 'mapField';
|
package/dist/index.d.ts
CHANGED
|
@@ -80,6 +80,10 @@ export declare type DecimalTaggedValue = {
|
|
|
80
80
|
value: string;
|
|
81
81
|
};
|
|
82
82
|
|
|
83
|
+
declare type DeepReadonly<T> = T extends undefined | null | boolean | string | number | symbol | Function | Date ? T : T extends Array<infer U> ? ReadonlyArray<DeepReadonly<U>> : unknown extends T ? unknown : {
|
|
84
|
+
readonly [K in keyof T]: DeepReadonly<T[K]>;
|
|
85
|
+
};
|
|
86
|
+
|
|
83
87
|
export declare function deserializeJsonObject(result: unknown): unknown;
|
|
84
88
|
|
|
85
89
|
/**
|
|
@@ -246,7 +250,7 @@ export declare type PrismaValuePlaceholder = {
|
|
|
246
250
|
export declare type QueryEvent = {
|
|
247
251
|
timestamp: Date;
|
|
248
252
|
query: string;
|
|
249
|
-
params: unknown[];
|
|
253
|
+
params: readonly unknown[];
|
|
250
254
|
duration: number;
|
|
251
255
|
};
|
|
252
256
|
|
|
@@ -259,7 +263,7 @@ export declare class QueryInterpreter {
|
|
|
259
263
|
provider?: SchemaProvider;
|
|
260
264
|
connectionInfo?: ConnectionInfo;
|
|
261
265
|
}): QueryInterpreter;
|
|
262
|
-
run(queryPlan: QueryPlanNode
|
|
266
|
+
run(queryPlan: DeepReadonly<QueryPlanNode>, options: QueryRuntimeOptions): Promise<unknown>;
|
|
263
267
|
private interpretNode;
|
|
264
268
|
}
|
|
265
269
|
|
|
@@ -351,6 +355,7 @@ export declare type QueryPlanNode = {
|
|
|
351
355
|
args: {
|
|
352
356
|
parent: QueryPlanNode;
|
|
353
357
|
children: JoinExpression[];
|
|
358
|
+
canAssumeStrictEquality: boolean;
|
|
354
359
|
};
|
|
355
360
|
} | {
|
|
356
361
|
type: 'mapField';
|
package/dist/index.js
CHANGED
|
@@ -757,6 +757,9 @@ function normalizeDateTime(dt) {
|
|
|
757
757
|
return dtWithTz;
|
|
758
758
|
}
|
|
759
759
|
|
|
760
|
+
// src/interpreter/query-interpreter.ts
|
|
761
|
+
var import_klona2 = require("klona");
|
|
762
|
+
|
|
760
763
|
// src/sql-commenter.ts
|
|
761
764
|
var import_klona = require("klona");
|
|
762
765
|
function formatSqlComment(tags) {
|
|
@@ -1040,8 +1043,11 @@ function paginateSingleList(list, { cursor, skip, take }) {
|
|
|
1040
1043
|
const end = take !== null ? start + take : list.length;
|
|
1041
1044
|
return list.slice(start, end);
|
|
1042
1045
|
}
|
|
1043
|
-
function getRecordKey(record, fields) {
|
|
1044
|
-
|
|
1046
|
+
function getRecordKey(record, fields, mappers) {
|
|
1047
|
+
const array = fields.map(
|
|
1048
|
+
(field, index) => mappers?.[index] ? record[field] !== null ? mappers[index](record[field]) : null : record[field]
|
|
1049
|
+
);
|
|
1050
|
+
return JSON.stringify(array);
|
|
1045
1051
|
}
|
|
1046
1052
|
|
|
1047
1053
|
// src/query-plan.ts
|
|
@@ -1633,7 +1639,7 @@ var QueryInterpreter = class _QueryInterpreter {
|
|
|
1633
1639
|
sum += await this.#withQuerySpanAndEvent(
|
|
1634
1640
|
commentedQuery,
|
|
1635
1641
|
context.queryable,
|
|
1636
|
-
() => context.queryable.executeRaw(commentedQuery).catch(
|
|
1642
|
+
() => context.queryable.executeRaw(cloneObject(commentedQuery)).catch(
|
|
1637
1643
|
(err) => node.args.type === "rawSql" ? rethrowAsUserFacingRawError(err) : rethrowAsUserFacing(err)
|
|
1638
1644
|
)
|
|
1639
1645
|
);
|
|
@@ -1648,7 +1654,7 @@ var QueryInterpreter = class _QueryInterpreter {
|
|
|
1648
1654
|
const result = await this.#withQuerySpanAndEvent(
|
|
1649
1655
|
commentedQuery,
|
|
1650
1656
|
context.queryable,
|
|
1651
|
-
() => context.queryable.queryRaw(commentedQuery).catch(
|
|
1657
|
+
() => context.queryable.queryRaw(cloneObject(commentedQuery)).catch(
|
|
1652
1658
|
(err) => node.args.type === "rawSql" ? rethrowAsUserFacingRawError(err) : rethrowAsUserFacing(err)
|
|
1653
1659
|
)
|
|
1654
1660
|
);
|
|
@@ -1700,7 +1706,7 @@ var QueryInterpreter = class _QueryInterpreter {
|
|
|
1700
1706
|
childRecords: (await this.interpretNode(joinExpr.child, context)).value
|
|
1701
1707
|
}))
|
|
1702
1708
|
);
|
|
1703
|
-
return { value: attachChildrenToParents(parent, children), lastInsertId };
|
|
1709
|
+
return { value: attachChildrenToParents(parent, children, node.args.canAssumeStrictEquality), lastInsertId };
|
|
1704
1710
|
}
|
|
1705
1711
|
case "transaction": {
|
|
1706
1712
|
if (!context.transactionManager.enabled) {
|
|
@@ -1747,8 +1753,9 @@ var QueryInterpreter = class _QueryInterpreter {
|
|
|
1747
1753
|
}
|
|
1748
1754
|
case "process": {
|
|
1749
1755
|
const { value, lastInsertId } = await this.interpretNode(node.args.expr, context);
|
|
1750
|
-
|
|
1751
|
-
|
|
1756
|
+
const ops = cloneObject(node.args.operations);
|
|
1757
|
+
evaluateProcessingParameters(ops, context.scope, context.generators);
|
|
1758
|
+
return { value: processRecords(value, ops), lastInsertId };
|
|
1752
1759
|
}
|
|
1753
1760
|
case "initializeRecord": {
|
|
1754
1761
|
const { lastInsertId } = await this.interpretNode(node.args.expr, context);
|
|
@@ -1841,12 +1848,13 @@ function mapField2(value, field) {
|
|
|
1841
1848
|
}
|
|
1842
1849
|
return value;
|
|
1843
1850
|
}
|
|
1844
|
-
function attachChildrenToParents(parentRecords, children) {
|
|
1851
|
+
function attachChildrenToParents(parentRecords, children, canAssumeStrictEquality) {
|
|
1845
1852
|
for (const { joinExpr, childRecords } of children) {
|
|
1846
1853
|
const parentKeys = joinExpr.on.map(([k]) => k);
|
|
1847
1854
|
const childKeys = joinExpr.on.map(([, k]) => k);
|
|
1848
1855
|
const parentMap = {};
|
|
1849
|
-
|
|
1856
|
+
const parentArray = Array.isArray(parentRecords) ? parentRecords : [parentRecords];
|
|
1857
|
+
for (const parent of parentArray) {
|
|
1850
1858
|
const parentRecord = asRecord(parent);
|
|
1851
1859
|
const key = getRecordKey(parentRecord, parentKeys);
|
|
1852
1860
|
if (!parentMap[key]) {
|
|
@@ -1859,11 +1867,12 @@ function attachChildrenToParents(parentRecords, children) {
|
|
|
1859
1867
|
parentRecord[joinExpr.parentField] = [];
|
|
1860
1868
|
}
|
|
1861
1869
|
}
|
|
1870
|
+
const mappers = canAssumeStrictEquality ? void 0 : inferKeyCasts(parentArray, parentKeys);
|
|
1862
1871
|
for (const childRecord of Array.isArray(childRecords) ? childRecords : [childRecords]) {
|
|
1863
1872
|
if (childRecord === null) {
|
|
1864
1873
|
continue;
|
|
1865
1874
|
}
|
|
1866
|
-
const key = getRecordKey(asRecord(childRecord), childKeys);
|
|
1875
|
+
const key = getRecordKey(asRecord(childRecord), childKeys, mappers);
|
|
1867
1876
|
for (const parentRecord of parentMap[key] ?? []) {
|
|
1868
1877
|
if (joinExpr.isRelationUnique) {
|
|
1869
1878
|
parentRecord[joinExpr.parentField] = childRecord;
|
|
@@ -1875,6 +1884,40 @@ function attachChildrenToParents(parentRecords, children) {
|
|
|
1875
1884
|
}
|
|
1876
1885
|
return parentRecords;
|
|
1877
1886
|
}
|
|
1887
|
+
function inferKeyCasts(rows, keys) {
|
|
1888
|
+
function getKeyCast(type) {
|
|
1889
|
+
switch (type) {
|
|
1890
|
+
case "number":
|
|
1891
|
+
return Number;
|
|
1892
|
+
case "string":
|
|
1893
|
+
return String;
|
|
1894
|
+
case "boolean":
|
|
1895
|
+
return Boolean;
|
|
1896
|
+
case "bigint":
|
|
1897
|
+
return BigInt;
|
|
1898
|
+
default:
|
|
1899
|
+
return;
|
|
1900
|
+
}
|
|
1901
|
+
}
|
|
1902
|
+
const keyCasts = Array.from({ length: keys.length });
|
|
1903
|
+
let keysFound = 0;
|
|
1904
|
+
for (const parent of rows) {
|
|
1905
|
+
const parentRecord = asRecord(parent);
|
|
1906
|
+
for (const [i, key] of keys.entries()) {
|
|
1907
|
+
if (parentRecord[key] !== null && keyCasts[i] === void 0) {
|
|
1908
|
+
const keyCast = getKeyCast(typeof parentRecord[key]);
|
|
1909
|
+
if (keyCast !== void 0) {
|
|
1910
|
+
keyCasts[i] = keyCast;
|
|
1911
|
+
}
|
|
1912
|
+
keysFound++;
|
|
1913
|
+
}
|
|
1914
|
+
}
|
|
1915
|
+
if (keysFound === keys.length) {
|
|
1916
|
+
break;
|
|
1917
|
+
}
|
|
1918
|
+
}
|
|
1919
|
+
return keyCasts;
|
|
1920
|
+
}
|
|
1878
1921
|
function evalFieldInitializer(initializer, lastInsertId, scope, generators) {
|
|
1879
1922
|
switch (initializer.type) {
|
|
1880
1923
|
case "value":
|
|
@@ -1934,6 +1977,9 @@ function evaluateProcessingParameters(ops, scope, generators) {
|
|
|
1934
1977
|
evaluateProcessingParameters(nested, scope, generators);
|
|
1935
1978
|
}
|
|
1936
1979
|
}
|
|
1980
|
+
function cloneObject(value) {
|
|
1981
|
+
return (0, import_klona2.klona)(value);
|
|
1982
|
+
}
|
|
1937
1983
|
|
|
1938
1984
|
// src/raw-json-protocol.ts
|
|
1939
1985
|
var import_client_runtime_utils4 = require("@prisma/client-runtime-utils");
|
package/dist/index.mjs
CHANGED
|
@@ -706,6 +706,9 @@ function normalizeDateTime(dt) {
|
|
|
706
706
|
return dtWithTz;
|
|
707
707
|
}
|
|
708
708
|
|
|
709
|
+
// src/interpreter/query-interpreter.ts
|
|
710
|
+
import { klona as klona2 } from "klona";
|
|
711
|
+
|
|
709
712
|
// src/sql-commenter.ts
|
|
710
713
|
import { klona } from "klona";
|
|
711
714
|
function formatSqlComment(tags) {
|
|
@@ -989,8 +992,11 @@ function paginateSingleList(list, { cursor, skip, take }) {
|
|
|
989
992
|
const end = take !== null ? start + take : list.length;
|
|
990
993
|
return list.slice(start, end);
|
|
991
994
|
}
|
|
992
|
-
function getRecordKey(record, fields) {
|
|
993
|
-
|
|
995
|
+
function getRecordKey(record, fields, mappers) {
|
|
996
|
+
const array = fields.map(
|
|
997
|
+
(field, index) => mappers?.[index] ? record[field] !== null ? mappers[index](record[field]) : null : record[field]
|
|
998
|
+
);
|
|
999
|
+
return JSON.stringify(array);
|
|
994
1000
|
}
|
|
995
1001
|
|
|
996
1002
|
// src/query-plan.ts
|
|
@@ -1582,7 +1588,7 @@ var QueryInterpreter = class _QueryInterpreter {
|
|
|
1582
1588
|
sum += await this.#withQuerySpanAndEvent(
|
|
1583
1589
|
commentedQuery,
|
|
1584
1590
|
context.queryable,
|
|
1585
|
-
() => context.queryable.executeRaw(commentedQuery).catch(
|
|
1591
|
+
() => context.queryable.executeRaw(cloneObject(commentedQuery)).catch(
|
|
1586
1592
|
(err) => node.args.type === "rawSql" ? rethrowAsUserFacingRawError(err) : rethrowAsUserFacing(err)
|
|
1587
1593
|
)
|
|
1588
1594
|
);
|
|
@@ -1597,7 +1603,7 @@ var QueryInterpreter = class _QueryInterpreter {
|
|
|
1597
1603
|
const result = await this.#withQuerySpanAndEvent(
|
|
1598
1604
|
commentedQuery,
|
|
1599
1605
|
context.queryable,
|
|
1600
|
-
() => context.queryable.queryRaw(commentedQuery).catch(
|
|
1606
|
+
() => context.queryable.queryRaw(cloneObject(commentedQuery)).catch(
|
|
1601
1607
|
(err) => node.args.type === "rawSql" ? rethrowAsUserFacingRawError(err) : rethrowAsUserFacing(err)
|
|
1602
1608
|
)
|
|
1603
1609
|
);
|
|
@@ -1649,7 +1655,7 @@ var QueryInterpreter = class _QueryInterpreter {
|
|
|
1649
1655
|
childRecords: (await this.interpretNode(joinExpr.child, context)).value
|
|
1650
1656
|
}))
|
|
1651
1657
|
);
|
|
1652
|
-
return { value: attachChildrenToParents(parent, children), lastInsertId };
|
|
1658
|
+
return { value: attachChildrenToParents(parent, children, node.args.canAssumeStrictEquality), lastInsertId };
|
|
1653
1659
|
}
|
|
1654
1660
|
case "transaction": {
|
|
1655
1661
|
if (!context.transactionManager.enabled) {
|
|
@@ -1696,8 +1702,9 @@ var QueryInterpreter = class _QueryInterpreter {
|
|
|
1696
1702
|
}
|
|
1697
1703
|
case "process": {
|
|
1698
1704
|
const { value, lastInsertId } = await this.interpretNode(node.args.expr, context);
|
|
1699
|
-
|
|
1700
|
-
|
|
1705
|
+
const ops = cloneObject(node.args.operations);
|
|
1706
|
+
evaluateProcessingParameters(ops, context.scope, context.generators);
|
|
1707
|
+
return { value: processRecords(value, ops), lastInsertId };
|
|
1701
1708
|
}
|
|
1702
1709
|
case "initializeRecord": {
|
|
1703
1710
|
const { lastInsertId } = await this.interpretNode(node.args.expr, context);
|
|
@@ -1790,12 +1797,13 @@ function mapField2(value, field) {
|
|
|
1790
1797
|
}
|
|
1791
1798
|
return value;
|
|
1792
1799
|
}
|
|
1793
|
-
function attachChildrenToParents(parentRecords, children) {
|
|
1800
|
+
function attachChildrenToParents(parentRecords, children, canAssumeStrictEquality) {
|
|
1794
1801
|
for (const { joinExpr, childRecords } of children) {
|
|
1795
1802
|
const parentKeys = joinExpr.on.map(([k]) => k);
|
|
1796
1803
|
const childKeys = joinExpr.on.map(([, k]) => k);
|
|
1797
1804
|
const parentMap = {};
|
|
1798
|
-
|
|
1805
|
+
const parentArray = Array.isArray(parentRecords) ? parentRecords : [parentRecords];
|
|
1806
|
+
for (const parent of parentArray) {
|
|
1799
1807
|
const parentRecord = asRecord(parent);
|
|
1800
1808
|
const key = getRecordKey(parentRecord, parentKeys);
|
|
1801
1809
|
if (!parentMap[key]) {
|
|
@@ -1808,11 +1816,12 @@ function attachChildrenToParents(parentRecords, children) {
|
|
|
1808
1816
|
parentRecord[joinExpr.parentField] = [];
|
|
1809
1817
|
}
|
|
1810
1818
|
}
|
|
1819
|
+
const mappers = canAssumeStrictEquality ? void 0 : inferKeyCasts(parentArray, parentKeys);
|
|
1811
1820
|
for (const childRecord of Array.isArray(childRecords) ? childRecords : [childRecords]) {
|
|
1812
1821
|
if (childRecord === null) {
|
|
1813
1822
|
continue;
|
|
1814
1823
|
}
|
|
1815
|
-
const key = getRecordKey(asRecord(childRecord), childKeys);
|
|
1824
|
+
const key = getRecordKey(asRecord(childRecord), childKeys, mappers);
|
|
1816
1825
|
for (const parentRecord of parentMap[key] ?? []) {
|
|
1817
1826
|
if (joinExpr.isRelationUnique) {
|
|
1818
1827
|
parentRecord[joinExpr.parentField] = childRecord;
|
|
@@ -1824,6 +1833,40 @@ function attachChildrenToParents(parentRecords, children) {
|
|
|
1824
1833
|
}
|
|
1825
1834
|
return parentRecords;
|
|
1826
1835
|
}
|
|
1836
|
+
function inferKeyCasts(rows, keys) {
|
|
1837
|
+
function getKeyCast(type) {
|
|
1838
|
+
switch (type) {
|
|
1839
|
+
case "number":
|
|
1840
|
+
return Number;
|
|
1841
|
+
case "string":
|
|
1842
|
+
return String;
|
|
1843
|
+
case "boolean":
|
|
1844
|
+
return Boolean;
|
|
1845
|
+
case "bigint":
|
|
1846
|
+
return BigInt;
|
|
1847
|
+
default:
|
|
1848
|
+
return;
|
|
1849
|
+
}
|
|
1850
|
+
}
|
|
1851
|
+
const keyCasts = Array.from({ length: keys.length });
|
|
1852
|
+
let keysFound = 0;
|
|
1853
|
+
for (const parent of rows) {
|
|
1854
|
+
const parentRecord = asRecord(parent);
|
|
1855
|
+
for (const [i, key] of keys.entries()) {
|
|
1856
|
+
if (parentRecord[key] !== null && keyCasts[i] === void 0) {
|
|
1857
|
+
const keyCast = getKeyCast(typeof parentRecord[key]);
|
|
1858
|
+
if (keyCast !== void 0) {
|
|
1859
|
+
keyCasts[i] = keyCast;
|
|
1860
|
+
}
|
|
1861
|
+
keysFound++;
|
|
1862
|
+
}
|
|
1863
|
+
}
|
|
1864
|
+
if (keysFound === keys.length) {
|
|
1865
|
+
break;
|
|
1866
|
+
}
|
|
1867
|
+
}
|
|
1868
|
+
return keyCasts;
|
|
1869
|
+
}
|
|
1827
1870
|
function evalFieldInitializer(initializer, lastInsertId, scope, generators) {
|
|
1828
1871
|
switch (initializer.type) {
|
|
1829
1872
|
case "value":
|
|
@@ -1883,6 +1926,9 @@ function evaluateProcessingParameters(ops, scope, generators) {
|
|
|
1883
1926
|
evaluateProcessingParameters(nested, scope, generators);
|
|
1884
1927
|
}
|
|
1885
1928
|
}
|
|
1929
|
+
function cloneObject(value) {
|
|
1930
|
+
return klona2(value);
|
|
1931
|
+
}
|
|
1886
1932
|
|
|
1887
1933
|
// src/raw-json-protocol.ts
|
|
1888
1934
|
import { Decimal as Decimal4 } from "@prisma/client-runtime-utils";
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { InMemoryOps } from '../query-plan';
|
|
2
2
|
export declare function processRecords(value: unknown, ops: InMemoryOps): unknown;
|
|
3
|
-
export declare function getRecordKey(record: {}, fields: string[]): string;
|
|
3
|
+
export declare function getRecordKey(record: {}, fields: readonly string[], mappers?: ((value: unknown) => unknown)[]): string;
|
|
@@ -5,6 +5,7 @@ import { QueryPlanNode } from '../query-plan';
|
|
|
5
5
|
import { type SchemaProvider } from '../schema';
|
|
6
6
|
import { type TracingHelper } from '../tracing';
|
|
7
7
|
import { type TransactionManager } from '../transaction-manager/transaction-manager';
|
|
8
|
+
import { DeepReadonly } from '../utils';
|
|
8
9
|
import { Value } from './scope';
|
|
9
10
|
export type QueryInterpreterTransactionManager = {
|
|
10
11
|
enabled: true;
|
|
@@ -39,6 +40,6 @@ export declare class QueryInterpreter {
|
|
|
39
40
|
provider?: SchemaProvider;
|
|
40
41
|
connectionInfo?: ConnectionInfo;
|
|
41
42
|
}): QueryInterpreter;
|
|
42
|
-
run(queryPlan: QueryPlanNode
|
|
43
|
+
run(queryPlan: DeepReadonly<QueryPlanNode>, options: QueryRuntimeOptions): Promise<unknown>;
|
|
43
44
|
private interpretNode;
|
|
44
45
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { SqlQuery } from '@prisma/driver-adapter-utils';
|
|
2
2
|
import { type QueryPlanDbQuery } from '../query-plan';
|
|
3
|
+
import { DeepReadonly } from '../utils';
|
|
3
4
|
import { GeneratorRegistrySnapshot } from './generators';
|
|
4
5
|
import { ScopeBindings } from './scope';
|
|
5
|
-
export declare function renderQuery(dbQuery: QueryPlanDbQuery
|
|
6
|
+
export declare function renderQuery(dbQuery: DeepReadonly<QueryPlanDbQuery>, scope: ScopeBindings, generators: GeneratorRegistrySnapshot, maxChunkSize?: number): DeepReadonly<SqlQuery>[];
|
|
6
7
|
export declare function evaluateArg(arg: unknown, scope: ScopeBindings, generators: GeneratorRegistrySnapshot): unknown;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import { DataRule, ValidationError } from '../query-plan';
|
|
2
|
-
|
|
2
|
+
import { DeepReadonly } from '../utils';
|
|
3
|
+
export declare function performValidation(data: unknown, rules: DeepReadonly<DataRule[]>, error: ValidationError): void;
|
|
3
4
|
export declare function doesSatisfyRule(data: unknown, rule: DataRule): boolean;
|
package/dist/query-plan.d.ts
CHANGED
package/dist/tracing.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { type Context, type Span, type SpanOptions } from '@opentelemetry/api';
|
|
|
2
2
|
import type { SqlQuery } from '@prisma/driver-adapter-utils';
|
|
3
3
|
import { QueryEvent } from './events';
|
|
4
4
|
import type { SchemaProvider } from './schema';
|
|
5
|
+
import { DeepReadonly } from './utils';
|
|
5
6
|
export type SpanCallback<R> = (span?: Span, context?: Context) => R;
|
|
6
7
|
export type ExtendedSpanOptions = SpanOptions & {
|
|
7
8
|
name: string;
|
|
@@ -13,7 +14,7 @@ export interface TracingHelper {
|
|
|
13
14
|
export declare const noopTracingHelper: TracingHelper;
|
|
14
15
|
export declare function providerToOtelSystem(provider: SchemaProvider): string;
|
|
15
16
|
export declare function withQuerySpanAndEvent<T>({ query, tracingHelper, provider, onQuery, execute, }: {
|
|
16
|
-
query: SqlQuery
|
|
17
|
+
query: DeepReadonly<SqlQuery>;
|
|
17
18
|
tracingHelper: TracingHelper;
|
|
18
19
|
provider: SchemaProvider;
|
|
19
20
|
onQuery?: (event: QueryEvent) => void;
|
package/dist/utils.d.ts
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
export type DeepReadonly<T> = T extends undefined | null | boolean | string | number | symbol | Function | Date ? T : T extends Array<infer U> ? ReadonlyArray<DeepReadonly<U>> : unknown extends T ? unknown : {
|
|
2
|
+
readonly [K in keyof T]: DeepReadonly<T[K]>;
|
|
3
|
+
};
|
|
4
|
+
export type DeepUnreadonly<T> = T extends undefined | null | boolean | string | number | symbol | Function | Date ? T : T extends ReadonlyArray<infer U> ? Array<DeepUnreadonly<U>> : unknown extends T ? unknown : {
|
|
5
|
+
-readonly [K in keyof T]: DeepUnreadonly<T[K]>;
|
|
6
|
+
};
|
|
1
7
|
export declare function assertNever(_: never, message: string): never;
|
|
2
8
|
/**
|
|
3
9
|
* Checks if two objects are deeply equal, recursively checking all properties for strict equality.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prisma/client-engine-runtime",
|
|
3
|
-
"version": "7.5.0-dev.
|
|
3
|
+
"version": "7.5.0-dev.31",
|
|
4
4
|
"description": "This package is intended for Prisma's internal use",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -31,10 +31,10 @@
|
|
|
31
31
|
"nanoid": "5.1.5",
|
|
32
32
|
"ulid": "3.0.0",
|
|
33
33
|
"uuid": "11.1.0",
|
|
34
|
-
"@prisma/client-runtime-utils": "7.5.0-dev.
|
|
35
|
-
"@prisma/
|
|
36
|
-
"@prisma/sqlcommenter": "7.5.0-dev.
|
|
37
|
-
"@prisma/
|
|
34
|
+
"@prisma/client-runtime-utils": "7.5.0-dev.31",
|
|
35
|
+
"@prisma/driver-adapter-utils": "7.5.0-dev.31",
|
|
36
|
+
"@prisma/sqlcommenter": "7.5.0-dev.31",
|
|
37
|
+
"@prisma/debug": "7.5.0-dev.31"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@codspeed/benchmark.js-plugin": "4.0.0",
|