@lokalise/prisma-utils 7.0.0 → 7.0.1
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
|
@@ -154,10 +154,10 @@ import { prismaBulkUpdate } from '@lokalise/prisma-utils'
|
|
|
154
154
|
|
|
155
155
|
await prismaBulkUpdate(prisma, 'segment', {
|
|
156
156
|
dbDriver: 'CockroachDb',
|
|
157
|
-
typeByColumn: { id: 'uuid', value: 'text', words_count: 'int4' },
|
|
157
|
+
typeByColumn: { project_id: 'uuid', id: 'uuid', value: 'text', words_count: 'int4' },
|
|
158
158
|
}, [
|
|
159
|
-
{ where: { id: id1 }, data: { value: 'a', words_count: 1 } },
|
|
160
|
-
{ where: { id: id2 }, data: { value: 'b', words_count: 2 } },
|
|
159
|
+
{ where: { project_id: projectId, id: id1 }, data: { value: 'a', words_count: 1 } },
|
|
160
|
+
{ where: { project_id: projectId, id: id2 }, data: { value: 'b', words_count: 2 } },
|
|
161
161
|
])
|
|
162
162
|
```
|
|
163
163
|
|
|
@@ -168,9 +168,11 @@ UPDATE "segment"
|
|
|
168
168
|
SET "value" = updates."value"::text, "words_count" = updates."words_count"::int4
|
|
169
169
|
FROM (VALUES ($1::uuid, $2::text, $3::int4), ($4::uuid, $5::text, $6::int4))
|
|
170
170
|
AS updates("id", "value", "words_count")
|
|
171
|
-
WHERE "segment"."id" = updates."id"::uuid
|
|
171
|
+
WHERE "segment"."project_id" = $7::uuid AND "segment"."id" = updates."id"::uuid
|
|
172
172
|
```
|
|
173
173
|
|
|
174
|
+
`project_id` has the same value on every entry, so it is emitted as a constant predicate instead of a `VALUES` column (see "Constant `where` columns" below).
|
|
175
|
+
|
|
174
176
|
#### Parameters
|
|
175
177
|
|
|
176
178
|
- **`prisma`** — a Prisma client or a transaction client (e.g. the `tx` passed to `prismaTransaction`'s callback).
|
|
@@ -200,5 +202,6 @@ const updated = await prismaBulkUpdate<{ id: string; value: string }>(
|
|
|
200
202
|
)
|
|
201
203
|
```
|
|
202
204
|
|
|
203
|
-
- **
|
|
205
|
+
- **Constant `where` columns**: a `where` column whose value is the same on every entry becomes `"tbl"."col" = $n::type` instead of a `VALUES` column. With a tenant column such as `project_id` joined from `VALUES`, CockroachDB can pick a lookup join on a primary key that starts with it and read every row of the tenant; as a constant, the planner uses the index on the other key. A value counts as the same only when it is a string, number, boolean or bigint and is `===` to the first entry's value; `null`, `Date`, `Buffer` and objects stay in `VALUES`. When every `where` column is constant, `VALUES` holds only the `data` columns.
|
|
206
|
+
- **Limits**: at most 1000 entries per call, and the total bound parameters (`entries × (VALUES where columns + data columns) + constant where columns`) must not exceed 65535, the shared protocol limit for PostgreSQL and CockroachDB. Both are validated up front. A column may not appear in both `where` and `data`.
|
|
204
207
|
- **Trusted identifiers** — `tableName`, all column names, the column types, and the `returning` keys/aliases are interpolated as raw SQL identifiers (only row values are bound). They must be static, trusted configuration, never end-user input.
|
|
@@ -9,18 +9,27 @@ import type { BulkUpdateEntry, PrismaBulkUpdateOptions } from './types.ts';
|
|
|
9
9
|
*
|
|
10
10
|
* The executed query follows the below structure for provided example data:
|
|
11
11
|
* [
|
|
12
|
-
* { where: { id: 1 }, data: { col1: 11, col2: 12 } },
|
|
13
|
-
* { where: { id: 2 }, data: { col1: 21, col2: 22 } },
|
|
12
|
+
* { where: { tenant_id: 7, id: 1 }, data: { col1: 11, col2: 12 } },
|
|
13
|
+
* { where: { tenant_id: 7, id: 2 }, data: { col1: 21, col2: 22 } },
|
|
14
14
|
* ]
|
|
15
15
|
*
|
|
16
16
|
* UPDATE "tbl"
|
|
17
|
-
* SET "col1" = updates."col1", "col2" = updates."col2"
|
|
17
|
+
* SET "col1" = updates."col1"::int4, "col2" = updates."col2"::int4
|
|
18
18
|
* FROM (
|
|
19
19
|
* VALUES
|
|
20
|
-
* (1,
|
|
21
|
-
* (
|
|
20
|
+
* ($1::int4, $2::int4, $3::int4),
|
|
21
|
+
* ($4::int4, $5::int4, $6::int4)
|
|
22
22
|
* ) AS updates("id", "col1", "col2")
|
|
23
|
-
* WHERE "tbl"."id" = updates."id"
|
|
23
|
+
* WHERE "tbl"."tenant_id" = $7::int4 AND "tbl"."id" = updates."id"::int4
|
|
24
|
+
*
|
|
25
|
+
* A "where" column whose value is the same on every entry (`tenant_id` above) is
|
|
26
|
+
* emitted as a constant predicate instead of a `VALUES` column. Joining a tenant
|
|
27
|
+
* column from `VALUES` lets CockroachDB plan a lookup join on a primary key that
|
|
28
|
+
* starts with it and read every row of the tenant; a constant lets it use the
|
|
29
|
+
* index on the other key. A value counts as the same only when it is a string,
|
|
30
|
+
* number, boolean or bigint and is `===` to the first entry's value. Anything else
|
|
31
|
+
* (`null`, `Date`, `Buffer`, objects) stays in `VALUES`. When every "where" column
|
|
32
|
+
* is constant, `VALUES` holds only the "data" columns.
|
|
24
33
|
*
|
|
25
34
|
* "data" values follow Prisma's convention: an `undefined` value leaves the
|
|
26
35
|
* column untouched (it is dropped from the statement), while `null` sets it to
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import { join, raw, sqltag as sql } from '@prisma/client/runtime/client';
|
|
2
2
|
const JSON_COLUMN_TYPES = new Set(['json', 'jsonb']);
|
|
3
|
+
// `typeof` results for which `a === b` guarantees both bind to the same SQL value.
|
|
4
|
+
const COMPARABLE_VALUE_TYPES = new Set(['string', 'number', 'boolean', 'bigint']);
|
|
3
5
|
const ENTRIES_LIMIT = 1000;
|
|
4
6
|
/**
|
|
5
|
-
* Every
|
|
6
|
-
* placeholder
|
|
7
|
-
* `entries × (
|
|
8
|
-
* statement at 65535 bound parameters and
|
|
9
|
-
* guard the total up front to fail with a
|
|
10
|
-
*
|
|
7
|
+
* Every "data" cell and every "where" cell in the `VALUES` list is one bound
|
|
8
|
+
* placeholder, and each constant "where" predicate adds one more, so the
|
|
9
|
+
* statement uses `entries × (valuesWhereColumns + dataColumns) + constantWhereColumns`
|
|
10
|
+
* parameters. PostgreSQL caps a single statement at 65535 bound parameters and
|
|
11
|
+
* CockroachDB has its own ceiling, so we guard the total up front to fail with a
|
|
12
|
+
* clear message instead of an opaque driver error.
|
|
11
13
|
*/
|
|
12
14
|
const BIND_PARAMETERS_LIMIT = 65535;
|
|
13
15
|
/**
|
|
@@ -18,18 +20,27 @@ const BIND_PARAMETERS_LIMIT = 65535;
|
|
|
18
20
|
*
|
|
19
21
|
* The executed query follows the below structure for provided example data:
|
|
20
22
|
* [
|
|
21
|
-
* { where: { id: 1 }, data: { col1: 11, col2: 12 } },
|
|
22
|
-
* { where: { id: 2 }, data: { col1: 21, col2: 22 } },
|
|
23
|
+
* { where: { tenant_id: 7, id: 1 }, data: { col1: 11, col2: 12 } },
|
|
24
|
+
* { where: { tenant_id: 7, id: 2 }, data: { col1: 21, col2: 22 } },
|
|
23
25
|
* ]
|
|
24
26
|
*
|
|
25
27
|
* UPDATE "tbl"
|
|
26
|
-
* SET "col1" = updates."col1", "col2" = updates."col2"
|
|
28
|
+
* SET "col1" = updates."col1"::int4, "col2" = updates."col2"::int4
|
|
27
29
|
* FROM (
|
|
28
30
|
* VALUES
|
|
29
|
-
* (1,
|
|
30
|
-
* (
|
|
31
|
+
* ($1::int4, $2::int4, $3::int4),
|
|
32
|
+
* ($4::int4, $5::int4, $6::int4)
|
|
31
33
|
* ) AS updates("id", "col1", "col2")
|
|
32
|
-
* WHERE "tbl"."id" = updates."id"
|
|
34
|
+
* WHERE "tbl"."tenant_id" = $7::int4 AND "tbl"."id" = updates."id"::int4
|
|
35
|
+
*
|
|
36
|
+
* A "where" column whose value is the same on every entry (`tenant_id` above) is
|
|
37
|
+
* emitted as a constant predicate instead of a `VALUES` column. Joining a tenant
|
|
38
|
+
* column from `VALUES` lets CockroachDB plan a lookup join on a primary key that
|
|
39
|
+
* starts with it and read every row of the tenant; a constant lets it use the
|
|
40
|
+
* index on the other key. A value counts as the same only when it is a string,
|
|
41
|
+
* number, boolean or bigint and is `===` to the first entry's value. Anything else
|
|
42
|
+
* (`null`, `Date`, `Buffer`, objects) stays in `VALUES`. When every "where" column
|
|
43
|
+
* is constant, `VALUES` holds only the "data" columns.
|
|
33
44
|
*
|
|
34
45
|
* "data" values follow Prisma's convention: an `undefined` value leaves the
|
|
35
46
|
* column untouched (it is dropped from the statement), while `null` sets it to
|
|
@@ -88,10 +99,14 @@ export const prismaBulkUpdate = (prisma, tableName, options, entries) => {
|
|
|
88
99
|
if (overlappingColumn) {
|
|
89
100
|
throw new Error(`Column "${overlappingColumn.name}" must not appear in both "where" and "data"`);
|
|
90
101
|
}
|
|
91
|
-
const
|
|
102
|
+
const constantWhereColumns = resolveConstantWhereColumns(whereColumns, entries);
|
|
103
|
+
const valuesWhereColumns = whereColumns.filter((column) => !constantWhereColumns.has(column));
|
|
104
|
+
const valuesColumns = [...valuesWhereColumns, ...dataColumns];
|
|
105
|
+
const bindParametersCount = entries.length * valuesColumns.length + constantWhereColumns.size;
|
|
92
106
|
if (bindParametersCount > BIND_PARAMETERS_LIMIT) {
|
|
107
|
+
const constantsBreakdown = constantWhereColumns.size > 0 ? ` + ${constantWhereColumns.size} constant "where" values` : '';
|
|
93
108
|
throw new Error(`Bulk update would use ${bindParametersCount} bind parameters ` +
|
|
94
|
-
`(${entries.length} entries × ${
|
|
109
|
+
`(${entries.length} entries × ${valuesColumns.length} columns${constantsBreakdown}), ` +
|
|
95
110
|
`exceeding the limit of ${BIND_PARAMETERS_LIMIT}`);
|
|
96
111
|
}
|
|
97
112
|
// Quote each part of a (possibly schema-qualified) table name separately,
|
|
@@ -104,12 +119,15 @@ export const prismaBulkUpdate = (prisma, tableName, options, entries) => {
|
|
|
104
119
|
const sqlSetExpressions = dataColumns.map((column) => {
|
|
105
120
|
return sql([`"${column.name}" = updates."${column.name}"::${column.type}`]);
|
|
106
121
|
});
|
|
107
|
-
const sqlValuesExpressions = entries.map((entry, index) => prepareSqlValuesExpression(entry, index, whereColumns, dataColumns));
|
|
108
|
-
const sqlValuesColumnAliases =
|
|
122
|
+
const sqlValuesExpressions = entries.map((entry, index) => prepareSqlValuesExpression(entry, index, whereColumns, valuesWhereColumns, dataColumns));
|
|
123
|
+
const sqlValuesColumnAliases = valuesColumns.map((column) => {
|
|
109
124
|
return sql([`"${column.name}"`]);
|
|
110
125
|
});
|
|
111
126
|
const sqlWhereConditions = whereColumns.map((column) => {
|
|
112
|
-
|
|
127
|
+
const qualifiedColumn = `${quotedTableName}."${column.name}"`;
|
|
128
|
+
return constantWhereColumns.has(column)
|
|
129
|
+
? sql `${raw(qualifiedColumn)} = ${renderTypedValue(firstEntry.where[column.name], column.type)}`
|
|
130
|
+
: sql([`${qualifiedColumn} = updates."${column.name}"::${column.type}`]);
|
|
113
131
|
});
|
|
114
132
|
const updateStatement = sql `
|
|
115
133
|
UPDATE ${sql([quotedTableName])}
|
|
@@ -128,23 +146,22 @@ export const prismaBulkUpdate = (prisma, tableName, options, entries) => {
|
|
|
128
146
|
return prisma.$queryRaw(sql `${updateStatement} RETURNING ${join(sqlReturningExpressions, ', ')}`);
|
|
129
147
|
};
|
|
130
148
|
/**
|
|
131
|
-
* Builds the parenthesized `(where..., set...)` tuple for a single entry
|
|
132
|
-
*
|
|
133
|
-
* columns
|
|
134
|
-
*
|
|
135
|
-
*
|
|
149
|
+
* Builds the parenthesized `(where..., set...)` tuple for a single entry: one row
|
|
150
|
+
* of the `VALUES` source, holding the `valuesWhereColumns` subset of the "where"
|
|
151
|
+
* columns. The entry must supply exactly the given `where` columns and the same
|
|
152
|
+
* set of defined `data` columns (the shape established by the first entry); a
|
|
153
|
+
* mismatch throws so the generated `VALUES` list stays rectangular and aligned
|
|
154
|
+
* with the column aliases.
|
|
136
155
|
*/
|
|
137
|
-
const prepareSqlValuesExpression = (entry, index, whereColumns, dataColumns) => {
|
|
156
|
+
const prepareSqlValuesExpression = (entry, index, whereColumns, valuesWhereColumns, dataColumns) => {
|
|
138
157
|
if (whereColumns.length !== Object.keys(entry.where).length) {
|
|
139
158
|
throw new Error(`Entry "where" columns are not the same (at index ${index})`);
|
|
140
159
|
}
|
|
141
|
-
const
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
return renderTypedValue(whereConditionValue, whereConditionColumn.type);
|
|
147
|
-
});
|
|
160
|
+
const missingWhereColumn = whereColumns.find((column) => entry.where[column.name] === undefined);
|
|
161
|
+
if (missingWhereColumn) {
|
|
162
|
+
throw new Error(`Entry "where" column "${missingWhereColumn.name}" was not found (at index ${index})`);
|
|
163
|
+
}
|
|
164
|
+
const sqlWhereValues = valuesWhereColumns.map((column) => renderTypedValue(entry.where[column.name], column.type));
|
|
148
165
|
if (dataColumns.length !== definedColumnNames(entry.data).length) {
|
|
149
166
|
throw new Error(`Entry "data" columns are not the same (at index ${index})`);
|
|
150
167
|
}
|
|
@@ -155,8 +172,17 @@ const prepareSqlValuesExpression = (entry, index, whereColumns, dataColumns) =>
|
|
|
155
172
|
}
|
|
156
173
|
return renderTypedValue(setExpressionValue, setExpressionColumn.type);
|
|
157
174
|
});
|
|
158
|
-
return sql `(${join(sqlWhereValues,
|
|
175
|
+
return sql `(${join([...sqlWhereValues, ...sqlSetValues], ',')})`;
|
|
159
176
|
};
|
|
177
|
+
/**
|
|
178
|
+
* Picks the "where" columns to emit as constant predicates, following the rule in
|
|
179
|
+
* the `prismaBulkUpdate` docblock.
|
|
180
|
+
*/
|
|
181
|
+
const resolveConstantWhereColumns = (whereColumns, entries) => new Set(whereColumns.filter((column) => {
|
|
182
|
+
const firstValue = entries[0]?.where[column.name];
|
|
183
|
+
return (COMPARABLE_VALUE_TYPES.has(typeof firstValue) &&
|
|
184
|
+
entries.every((entry) => entry.where[column.name] === firstValue));
|
|
185
|
+
}));
|
|
160
186
|
/**
|
|
161
187
|
* Pairs each requested column name with its SQL type from `typeByColumn`,
|
|
162
188
|
* throwing when a column has no type mapping (it would otherwise produce an
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prismaBulkUpdate.js","sourceRoot":"","sources":["../../src/bulk-update/prismaBulkUpdate.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AAI,CAAC,IAAI,EAAE,CAAC;QACV,MAAM,IAAI,KAAK,CAAC,uCAAuC,UAAU,GAAG,CAAC,CAAA;IACvE,CAAC;IAED,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,CAAA;AACnC,CAAC,CAAC,CAAA;AAEJ;;;;;GAKG;AACH,MAAM,kBAAkB,GAAG,CAAC,YAAqC,EAAY,EAAE,CAC7E,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,MAAM,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,YAAY,CAAC,UAAU,CAAC,KAAK,SAAS,CAAC,CAAA;AAE1F;;;;;;;;;;;;GAYG;AACH,MAAM,gBAAgB,GAAG,CAAC,KAAc,EAAE,IAAY,EAAE,EAAE,CACxD,KAAK,KAAK,IAAI,IAAI,iBAAiB,CAAC,GAAG,CAAC,IAAI,CAAC;IAC3C,CAAC,CAAC,GAAG,CAAA,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,KAAK,GAAG,CAAC,IAAI,CAAC,EAAE;IAC7C,CAAC,CAAC,GAAG,CAAA,GAAG,KAAK,KAAK,GAAG,CAAC,IAAI,CAAC,EAAE,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lokalise/prisma-utils",
|
|
3
|
-
"version": "7.0.
|
|
3
|
+
"version": "7.0.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"files": [
|
|
@@ -26,18 +26,18 @@
|
|
|
26
26
|
"prisma": "^7.0.0"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@biomejs/biome": "^2.5.
|
|
29
|
+
"@biomejs/biome": "^2.5.12",
|
|
30
30
|
"dotenv": "^17.0.0",
|
|
31
|
+
"@lokalise/biome-config": "^3.1.1",
|
|
32
|
+
"@lokalise/tsconfig": "^5.0.0",
|
|
31
33
|
"@prisma/adapter-pg": "^7.4.0",
|
|
32
|
-
"@prisma/client": "^7.
|
|
34
|
+
"@prisma/client": "^7.10.0",
|
|
33
35
|
"@vitest/coverage-v8": "^4.1.11",
|
|
34
36
|
"cross-env": "^10.0.0",
|
|
35
37
|
"prisma": "^7.10.0",
|
|
36
38
|
"rimraf": "^6.1.3",
|
|
37
39
|
"typescript": "7.0.2",
|
|
38
|
-
"vitest": "^4.1.11"
|
|
39
|
-
"@lokalise/biome-config": "^3.1.1",
|
|
40
|
-
"@lokalise/tsconfig": "^5.0.0"
|
|
40
|
+
"vitest": "^4.1.11"
|
|
41
41
|
},
|
|
42
42
|
"scripts": {
|
|
43
43
|
"build": "rimraf dist && pnpm run db:update-client && tsc --project tsconfig.build.json",
|
|
@@ -51,6 +51,8 @@
|
|
|
51
51
|
"pretest:ci": "docker compose up -d --wait && pnpm run test:migrate",
|
|
52
52
|
"test:ci": "pnpm run test",
|
|
53
53
|
"posttest:ci": "docker compose down",
|
|
54
|
+
"bench:seed": "vitest run --config vitest.bench.config.ts",
|
|
55
|
+
"bench": "vitest bench --run --config vitest.bench.config.ts",
|
|
54
56
|
"package-version": "echo $npm_package_version",
|
|
55
57
|
"postversion": "biome check --write package.json"
|
|
56
58
|
}
|