hekireki 0.47.0 → 0.48.0
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/bin/activerecord.js +1 -1
- package/dist/bin/ajv.js +1 -1
- package/dist/bin/arktype.js +1 -1
- package/dist/bin/atlas.js +1 -1
- package/dist/bin/django.js +1 -1
- package/dist/bin/docs.js +1 -1
- package/dist/bin/drizzle.js +1 -1
- package/dist/bin/ecto.js +1 -1
- package/dist/bin/efcore.js +1 -1
- package/dist/bin/effect.js +1 -1
- package/dist/bin/eloquent.js +1 -1
- package/dist/bin/er.js +1 -1
- package/dist/bin/exposed.js +1 -1
- package/dist/bin/gorm.js +1 -1
- package/dist/bin/hekireki.js +1 -1
- package/dist/bin/kysely.js +1 -1
- package/dist/bin/openapi.js +1 -1
- package/dist/bin/pydantic.js +1 -1
- package/dist/bin/sea-orm.js +1 -1
- package/dist/bin/seed.js +1 -1
- package/dist/bin/sqlalchemy.js +1 -1
- package/dist/bin/typebox.js +1 -1
- package/dist/bin/valibot.js +1 -1
- package/dist/bin/zod.js +1 -1
- package/dist/{bin-CeA8S_Qj.js → bin-CVcdvi5w.js} +18 -7
- package/package.json +1 -1
package/dist/bin/activerecord.js
CHANGED
package/dist/bin/ajv.js
CHANGED
package/dist/bin/arktype.js
CHANGED
package/dist/bin/atlas.js
CHANGED
package/dist/bin/django.js
CHANGED
package/dist/bin/docs.js
CHANGED
package/dist/bin/drizzle.js
CHANGED
package/dist/bin/ecto.js
CHANGED
package/dist/bin/efcore.js
CHANGED
package/dist/bin/effect.js
CHANGED
package/dist/bin/eloquent.js
CHANGED
package/dist/bin/er.js
CHANGED
package/dist/bin/exposed.js
CHANGED
package/dist/bin/gorm.js
CHANGED
package/dist/bin/hekireki.js
CHANGED
|
@@ -6,7 +6,7 @@ import { Console, Data, Effect, Schema } from "effect";
|
|
|
6
6
|
import path from "node:path";
|
|
7
7
|
import { CliError, Command, Flag } from "effect/cli";
|
|
8
8
|
// package.json
|
|
9
|
-
var version = "0.
|
|
9
|
+
var version = "0.48.0";
|
|
10
10
|
// src/schema/path.ts
|
|
11
11
|
/** Where Prisma looks for a schema when neither the command nor prisma.config.ts names one. */
|
|
12
12
|
const DEFAULT_SCHEMA_PATHS = ["prisma/schema.prisma", "schema.prisma"];
|
package/dist/bin/kysely.js
CHANGED
package/dist/bin/openapi.js
CHANGED
package/dist/bin/pydantic.js
CHANGED
package/dist/bin/sea-orm.js
CHANGED
package/dist/bin/seed.js
CHANGED
package/dist/bin/sqlalchemy.js
CHANGED
package/dist/bin/typebox.js
CHANGED
package/dist/bin/valibot.js
CHANGED
package/dist/bin/zod.js
CHANGED
|
@@ -5617,7 +5617,8 @@ function entriesOf(fields, enums) {
|
|
|
5617
5617
|
*/
|
|
5618
5618
|
function uniqueWhere(model, enums) {
|
|
5619
5619
|
const single = model.fields.find((f) => f.isId) ?? model.fields.find((f) => f.isUnique);
|
|
5620
|
-
const
|
|
5620
|
+
const key = model.primaryKey ?? (single === void 0 ? model.uniqueIndexes[0] ?? null : null);
|
|
5621
|
+
const compound = key !== null && key.fields.length > 1 ? key : null;
|
|
5621
5622
|
if (compound === null) {
|
|
5622
5623
|
const entries = single === void 0 ? null : entriesOf([single], enums);
|
|
5623
5624
|
return single === void 0 || entries === null ? null : {
|
|
@@ -5642,13 +5643,18 @@ function uniqueWhere(model, enums) {
|
|
|
5642
5643
|
* Each model's queries as the docs show them: every row, how many, the rows with their relations
|
|
5643
5644
|
* (for a model with one), one row by what is unique to it, and a create, update and delete, with a
|
|
5644
5645
|
* value of each field's type. A query the model cannot take (no unique field to find one row by,
|
|
5645
|
-
* a required field of a type with no value to write) is left out
|
|
5646
|
+
* a required field of a type with no value to write) is left out, and so is one Prisma Client
|
|
5647
|
+
* does not give it: a view is read and not written.
|
|
5646
5648
|
*
|
|
5647
|
-
* @param datamodel - the models and enums Prisma parsed
|
|
5649
|
+
* @param document.datamodel - the models and enums Prisma parsed
|
|
5650
|
+
* @param document.mappings - the operations Prisma Client gives each model
|
|
5648
5651
|
* @returns the queries, model by model
|
|
5649
5652
|
*/
|
|
5650
|
-
function queryExamples(
|
|
5653
|
+
function queryExamples(document) {
|
|
5654
|
+
const { datamodel } = document;
|
|
5651
5655
|
return datamodel.models.flatMap((model) => {
|
|
5656
|
+
const mapping = document.mappings.modelOperations.find((m) => m.model === model.name);
|
|
5657
|
+
const actions = new Set(Object.entries(mapping ?? {}).flatMap(([action, name]) => typeof name === "string" && action !== "model" && action !== "plural" ? [action] : []));
|
|
5652
5658
|
const client = `prisma.${lowerFirst(model.name)}`;
|
|
5653
5659
|
const example = (name, description, code, action, query) => ({
|
|
5654
5660
|
model: model.name,
|
|
@@ -5716,7 +5722,7 @@ function queryExamples(datamodel) {
|
|
|
5716
5722
|
arguments: { where: where.json },
|
|
5717
5723
|
selection: SCALARS
|
|
5718
5724
|
})]
|
|
5719
|
-
];
|
|
5725
|
+
].filter((query) => actions.has(query.request.action));
|
|
5720
5726
|
});
|
|
5721
5727
|
}
|
|
5722
5728
|
const Fragment = z.discriminatedUnion("type", [
|
|
@@ -5995,6 +6001,10 @@ const WasmModule = z.object({ wasm: z.string().meta({
|
|
|
5995
6001
|
example: "AGFzbQ=="
|
|
5996
6002
|
}) }).meta({ description: "The query compiler as @prisma/client ships it, the module in base64" });
|
|
5997
6003
|
const WasmStart = z.custom((value) => typeof value === "function").meta({ description: "The start hook wasm-bindgen puts on the instantiated module." });
|
|
6004
|
+
const CompilerFailure = z.object({ message: z.string().meta({
|
|
6005
|
+
description: "Why it failed.",
|
|
6006
|
+
example: "Operation 'createOne' for model 'V' does not match any query."
|
|
6007
|
+
}) }).meta({ description: "What the compiler throws: an Error, or a plain object with a message" });
|
|
5998
6008
|
/** Where a panic in the compiler writes its message before the WebAssembly trap unwinds. */
|
|
5999
6009
|
const panics = { message: null };
|
|
6000
6010
|
/**
|
|
@@ -6005,7 +6015,8 @@ const loaded = /* @__PURE__ */ new Map();
|
|
|
6005
6015
|
function compilerError(error) {
|
|
6006
6016
|
const { message } = panics;
|
|
6007
6017
|
panics.message = null;
|
|
6008
|
-
|
|
6018
|
+
const result = CompilerFailure.safeParse(error);
|
|
6019
|
+
return new QueryCompilerError({ message: message ?? (result.success ? result.data.message : String(error)) });
|
|
6009
6020
|
}
|
|
6010
6021
|
/**
|
|
6011
6022
|
* The query compiler of the project's own `@prisma/client`, for one database: the one the client
|
|
@@ -6117,7 +6128,7 @@ function docs(options) {
|
|
|
6117
6128
|
dialect,
|
|
6118
6129
|
cwd: process.cwd()
|
|
6119
6130
|
});
|
|
6120
|
-
const examples = queryExamples(options.dmmf
|
|
6131
|
+
const examples = queryExamples(options.dmmf);
|
|
6121
6132
|
const compiled = dialect === null ? null : yield* compileQueries({
|
|
6122
6133
|
schemaPath: options.schemaPath,
|
|
6123
6134
|
datamodel: schemaText(files),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hekireki",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.48.0",
|
|
4
4
|
"description": "Hekireki is a code generator from Prisma schema to validation schemas, ORM models, OpenAPI and ER diagrams, with a Studio for your schema and its data",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"activerecord",
|