pothos-drizzle-generator 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
# pothos-drizzle-generator
|
|
2
2
|
|
|
3
|
+
[](https://www.npmjs.com/package/pothos-drizzle-generator)
|
|
4
|
+
[](https://www.npmjs.com/package/pothos-drizzle-generator)
|
|
5
|
+
[](https://www.npmjs.com/package/pothos-drizzle-generator)
|
|
6
|
+
[](https://deepwiki.com/node-libraries/pothos-drizzle-generator)
|
|
7
|
+
|
|
3
8
|
A Pothos plugin that automatically generates GraphQL schemas based on Drizzle schema information.
|
|
4
9
|
|
|
5
10
|

|
|
@@ -143,10 +148,6 @@ const builder = new SchemaBuilder<PothosTypes>({
|
|
|
143
148
|
},
|
|
144
149
|
},
|
|
145
150
|
models: {
|
|
146
|
-
users: {
|
|
147
|
-
// Prohibit data modification
|
|
148
|
-
// operations: { exclude: ["mutation"] },
|
|
149
|
-
},
|
|
150
151
|
posts: {
|
|
151
152
|
// Fields that cannot be overwritten
|
|
152
153
|
// inputFields: () => ({ exclude: ["createdAt", "updatedAt"] }), // Defined in "all", so commented out
|
|
@@ -17,7 +17,7 @@ class PothosDrizzleGeneratorPlugin extends core_1.BasePlugin {
|
|
|
17
17
|
const builder = this.builder;
|
|
18
18
|
const tables = generator.getTables();
|
|
19
19
|
for (const [modelName, { table, tableInfo, relations, columns, operations, executable, limit, where, orderBy, inputData, depthLimit, },] of Object.entries(tables)) {
|
|
20
|
-
const objectRef = builder.objectRef(
|
|
20
|
+
const objectRef = builder.objectRef(`_${tableInfo.name}_`);
|
|
21
21
|
objectRef.implement({
|
|
22
22
|
fields: (t) => Object.fromEntries(columns.map((c) => {
|
|
23
23
|
return [
|
|
@@ -360,7 +360,7 @@ class PothosDrizzleGeneratorPlugin extends core_1.BasePlugin {
|
|
|
360
360
|
builder.mutationType({
|
|
361
361
|
fields: (t) => ({
|
|
362
362
|
[`delete${tableInfo.name}`]: t.field({
|
|
363
|
-
type: [
|
|
363
|
+
type: [`_${tableInfo.name}_`],
|
|
364
364
|
nullable: false,
|
|
365
365
|
args: {
|
|
366
366
|
where: t.arg({ type: inputWhere }),
|
|
@@ -14,7 +14,7 @@ export class PothosDrizzleGeneratorPlugin extends BasePlugin {
|
|
|
14
14
|
const builder = this.builder;
|
|
15
15
|
const tables = generator.getTables();
|
|
16
16
|
for (const [modelName, { table, tableInfo, relations, columns, operations, executable, limit, where, orderBy, inputData, depthLimit, },] of Object.entries(tables)) {
|
|
17
|
-
const objectRef = builder.objectRef(
|
|
17
|
+
const objectRef = builder.objectRef(`_${tableInfo.name}_`);
|
|
18
18
|
objectRef.implement({
|
|
19
19
|
fields: (t) => Object.fromEntries(columns.map((c) => {
|
|
20
20
|
return [
|
|
@@ -357,7 +357,7 @@ export class PothosDrizzleGeneratorPlugin extends BasePlugin {
|
|
|
357
357
|
builder.mutationType({
|
|
358
358
|
fields: (t) => ({
|
|
359
359
|
[`delete${tableInfo.name}`]: t.field({
|
|
360
|
-
type: [
|
|
360
|
+
type: [`_${tableInfo.name}_`],
|
|
361
361
|
nullable: false,
|
|
362
362
|
args: {
|
|
363
363
|
where: t.arg({ type: inputWhere }),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pothos-drizzle-generator",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"main": "./dist/cjs/index.js",
|
|
5
5
|
"types": "./dist/cjs/index.d.ts",
|
|
6
6
|
"exports": {
|
|
@@ -16,23 +16,23 @@
|
|
|
16
16
|
"lint:fix": "eslint --fix ./src"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@graphql-tools/utils": "10.11.0",
|
|
20
|
-
"@pothos/core": "4.10.0",
|
|
21
|
-
"@pothos/plugin-drizzle": "0.16.
|
|
22
|
-
"drizzle-orm": "1.0.0-beta.
|
|
23
|
-
"graphql": "16.12.0",
|
|
24
|
-
"graphql-scalars": "1.25.0"
|
|
19
|
+
"@graphql-tools/utils": "^10.11.0",
|
|
20
|
+
"@pothos/core": "^4.10.0",
|
|
21
|
+
"@pothos/plugin-drizzle": "^0.16.1",
|
|
22
|
+
"drizzle-orm": "1.0.0-beta.3-bd1ec83",
|
|
23
|
+
"graphql": "^16.12.0",
|
|
24
|
+
"graphql-scalars": "^1.25.0"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
|
-
"@
|
|
28
|
-
"@
|
|
29
|
-
"
|
|
27
|
+
"@eslint/js": "^9.39.2",
|
|
28
|
+
"@types/graphql": "^14.5.0",
|
|
29
|
+
"cpy-cli": "^6.0.0",
|
|
30
|
+
"eslint": "^9.39.2",
|
|
30
31
|
"eslint-config-prettier": "^10.1.8",
|
|
31
32
|
"eslint-import-resolver-typescript": "^4.4.4",
|
|
32
33
|
"eslint-plugin-import": "^2.32.0",
|
|
33
|
-
"typescript": "5.9.3",
|
|
34
|
-
"typescript-eslint": "^8.
|
|
35
|
-
"cpy-cli": "^6.0.0"
|
|
34
|
+
"typescript": "^5.9.3",
|
|
35
|
+
"typescript-eslint": "^8.50.0"
|
|
36
36
|
},
|
|
37
37
|
"repository": "https://github.com/node-libraries/pothos-drizzle-generator",
|
|
38
38
|
"author": "SoraKumo <info@croud.jp>",
|