@baeta/plugin-prisma 2.0.0-next.3 → 2.0.0-next.7

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/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # @baeta/plugin-prisma
2
2
 
3
+ ## 2.0.0-next.7
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies []:
8
+ - @baeta/plugin-exec@2.0.0-next.7
9
+
3
10
  ## 2.0.0-next.3
4
11
 
5
12
  ### Patch Changes
package/README.md CHANGED
@@ -131,7 +131,7 @@ const userQuery = Query.user
131
131
  });
132
132
 
133
133
  const updateUserMutation = Mutation.updateUser
134
- .use(async (next) => {
134
+ .$use(async (next) => {
135
135
  const user = await next();
136
136
  await userCache.save(user);
137
137
  return user;
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../lib/client-generator.ts","../index.ts"],"sourcesContent":["import { readFile } from 'node:fs/promises';\nimport type { Ctx, WatcherFile } from '@baeta/generator-sdk';\nimport { createExecPlugin } from '@baeta/plugin-exec';\nimport { resolve } from '@baeta/util-path';\nimport type { PrismaPluginOptions } from './options.ts';\n\nasync function compareSchemas(cwd: string, current: string, generated: string) {\n\tconst [currentSchema, generatedSchema] = await Promise.all([\n\t\treadFile(resolve(cwd, current), 'utf-8'),\n\t\treadFile(resolve(cwd, generated), 'utf-8').catch(() => null),\n\t]);\n\treturn currentSchema.replaceAll(' ', '') === generatedSchema?.replaceAll(' ', '');\n}\n\nexport function createPrismaClientPlugin(options: PrismaPluginOptions) {\n\tconst { prismaSchema, generateCommand, generatedSchemaPath } = options;\n\n\treturn createExecPlugin({\n\t\tname: 'prisma-client',\n\t\tactionName: 'Prisma client',\n\t\texec: generateCommand ?? 'prisma generate',\n\t\twatch: (generatorOptions, watcher, reload) => {\n\t\t\tconst prismaPath = resolve(generatorOptions.cwd, prismaSchema);\n\n\t\t\tconst handleChange = (file: WatcherFile) => {\n\t\t\t\tif (file.path === prismaPath) {\n\t\t\t\t\treload(file);\n\t\t\t\t}\n\t\t\t};\n\n\t\t\twatcher.on('update', handleChange);\n\t\t\twatcher.on('delete', handleChange);\n\t\t},\n\t\tskip: async (ctx: Ctx) => {\n\t\t\tconst schema = resolve(ctx.generatorOptions.cwd, prismaSchema);\n\n\t\t\tif (ctx.watching && ctx.changedFile?.path !== schema) {\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\tif (!ctx.watching && generatedSchemaPath) {\n\t\t\t\treturn compareSchemas(ctx.generatorOptions.cwd, prismaSchema, generatedSchemaPath);\n\t\t\t}\n\n\t\t\treturn false;\n\t\t},\n\t});\n}\n","import { createPrismaClientPlugin } from './lib/client-generator.ts';\nimport type { PrismaPluginOptions } from './lib/options.ts';\n\nexport type { PrismaPluginOptions };\nexport default prismaPlugin;\n\n/**\n * A plugin that manages Prisma client generation in your Baeta project.\n * See https://baeta.io/docs/plugins/prisma\n *\n * @param options - Configuration options for the pagination plugin\n * @returns A Baeta generator plugin\n */\nexport function prismaPlugin(options: PrismaPluginOptions) {\n\tif (options.generateClient === false) {\n\t\treturn [];\n\t}\n\treturn [createPrismaClientPlugin(options)];\n}\n"],"mappings":";;;;;AAMA,eAAe,eAAe,KAAa,SAAiB,WAAmB;CAC9E,MAAM,CAAC,eAAe,mBAAmB,MAAM,QAAQ,IAAI,CAC1D,SAAS,QAAQ,KAAK,QAAQ,EAAE,QAAQ,EACxC,SAAS,QAAQ,KAAK,UAAU,EAAE,QAAQ,CAAC,YAAY,KAAK,CAC5D,CAAC;AACF,QAAO,cAAc,WAAW,KAAK,GAAG,KAAK,iBAAiB,WAAW,KAAK,GAAG;;AAGlF,SAAgB,yBAAyB,SAA8B;CACtE,MAAM,EAAE,cAAc,iBAAiB,wBAAwB;AAE/D,QAAO,iBAAiB;EACvB,MAAM;EACN,YAAY;EACZ,MAAM,mBAAmB;EACzB,QAAQ,kBAAkB,SAAS,WAAW;GAC7C,MAAM,aAAa,QAAQ,iBAAiB,KAAK,aAAa;GAE9D,MAAM,gBAAgB,SAAsB;AAC3C,QAAI,KAAK,SAAS,WACjB,QAAO,KAAK;;AAId,WAAQ,GAAG,UAAU,aAAa;AAClC,WAAQ,GAAG,UAAU,aAAa;;EAEnC,MAAM,OAAO,QAAa;GACzB,MAAM,SAAS,QAAQ,IAAI,iBAAiB,KAAK,aAAa;AAE9D,OAAI,IAAI,YAAY,IAAI,aAAa,SAAS,OAC7C,QAAO;AAGR,OAAI,CAAC,IAAI,YAAY,oBACpB,QAAO,eAAe,IAAI,iBAAiB,KAAK,cAAc,oBAAoB;AAGnF,UAAO;;EAER,CAAC;;;;;AC1CH,4BAAe;;;;;;;;AASf,SAAgB,aAAa,SAA8B;AAC1D,KAAI,QAAQ,mBAAmB,MAC9B,QAAO,EAAE;AAEV,QAAO,CAAC,yBAAyB,QAAQ,CAAC"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../lib/client-generator.ts","../index.ts"],"sourcesContent":["import { readFile } from 'node:fs/promises';\nimport type { Ctx, WatcherFile } from '@baeta/generator-sdk';\nimport { createExecPlugin } from '@baeta/plugin-exec';\nimport { resolve } from '@baeta/util-path';\nimport type { PrismaPluginOptions } from './options.ts';\n\nasync function compareSchemas(cwd: string, current: string, generated: string) {\n\tconst [currentSchema, generatedSchema] = await Promise.all([\n\t\treadFile(resolve(cwd, current), 'utf-8'),\n\t\treadFile(resolve(cwd, generated), 'utf-8').catch(() => null),\n\t]);\n\treturn currentSchema.replaceAll(' ', '') === generatedSchema?.replaceAll(' ', '');\n}\n\nexport function createPrismaClientPlugin(options: PrismaPluginOptions) {\n\tconst { prismaSchema, generateCommand, generatedSchemaPath } = options;\n\n\treturn createExecPlugin({\n\t\tname: 'prisma-client',\n\t\tactionName: 'Prisma client',\n\t\texec: generateCommand ?? 'prisma generate',\n\t\twatch: (generatorOptions, watcher, reload) => {\n\t\t\tconst prismaPath = resolve(generatorOptions.cwd, prismaSchema);\n\n\t\t\tconst handleChange = (file: WatcherFile) => {\n\t\t\t\tif (file.path === prismaPath) {\n\t\t\t\t\treload(file);\n\t\t\t\t}\n\t\t\t};\n\n\t\t\twatcher.on('update', handleChange);\n\t\t\twatcher.on('delete', handleChange);\n\t\t},\n\t\tskip: async (ctx: Ctx) => {\n\t\t\tconst schema = resolve(ctx.generatorOptions.cwd, prismaSchema);\n\n\t\t\tif (ctx.watching && ctx.changedFile?.path !== schema) {\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\tif (!ctx.watching && generatedSchemaPath) {\n\t\t\t\treturn compareSchemas(ctx.generatorOptions.cwd, prismaSchema, generatedSchemaPath);\n\t\t\t}\n\n\t\t\treturn false;\n\t\t},\n\t});\n}\n","import { createPrismaClientPlugin } from './lib/client-generator.ts';\nimport type { PrismaPluginOptions } from './lib/options.ts';\n\nexport type { PrismaPluginOptions } from './lib/options.ts';\n\nexport default prismaPlugin;\n\n/**\n * A plugin that manages Prisma client generation in your Baeta project.\n * See https://baeta.io/docs/plugins/prisma\n *\n * @param options - Configuration options for the pagination plugin\n * @returns A Baeta generator plugin\n */\nexport function prismaPlugin(options: PrismaPluginOptions) {\n\tif (options.generateClient === false) {\n\t\treturn [];\n\t}\n\treturn [createPrismaClientPlugin(options)];\n}\n"],"mappings":";;;;;AAMA,eAAe,eAAe,KAAa,SAAiB,WAAmB;CAC9E,MAAM,CAAC,eAAe,mBAAmB,MAAM,QAAQ,IAAI,CAC1D,SAAS,QAAQ,KAAK,QAAQ,EAAE,QAAQ,EACxC,SAAS,QAAQ,KAAK,UAAU,EAAE,QAAQ,CAAC,YAAY,KAAK,CAC5D,CAAC;AACF,QAAO,cAAc,WAAW,KAAK,GAAG,KAAK,iBAAiB,WAAW,KAAK,GAAG;;AAGlF,SAAgB,yBAAyB,SAA8B;CACtE,MAAM,EAAE,cAAc,iBAAiB,wBAAwB;AAE/D,QAAO,iBAAiB;EACvB,MAAM;EACN,YAAY;EACZ,MAAM,mBAAmB;EACzB,QAAQ,kBAAkB,SAAS,WAAW;GAC7C,MAAM,aAAa,QAAQ,iBAAiB,KAAK,aAAa;GAE9D,MAAM,gBAAgB,SAAsB;AAC3C,QAAI,KAAK,SAAS,WACjB,QAAO,KAAK;;AAId,WAAQ,GAAG,UAAU,aAAa;AAClC,WAAQ,GAAG,UAAU,aAAa;;EAEnC,MAAM,OAAO,QAAa;GACzB,MAAM,SAAS,QAAQ,IAAI,iBAAiB,KAAK,aAAa;AAE9D,OAAI,IAAI,YAAY,IAAI,aAAa,SAAS,OAC7C,QAAO;AAGR,OAAI,CAAC,IAAI,YAAY,oBACpB,QAAO,eAAe,IAAI,iBAAiB,KAAK,cAAc,oBAAoB;AAGnF,UAAO;;EAER,CAAC;;;;;ACzCH,4BAAe;;;;;;;;AASf,SAAgB,aAAa,SAA8B;AAC1D,KAAI,QAAQ,mBAAmB,MAC9B,QAAO,EAAE;AAEV,QAAO,CAAC,yBAAyB,QAAQ,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@baeta/plugin-prisma",
3
- "version": "2.0.0-next.3",
3
+ "version": "2.0.0-next.7",
4
4
  "keywords": [
5
5
  "baeta",
6
6
  "graphql",
@@ -40,18 +40,26 @@
40
40
  "build": "builder build",
41
41
  "prepack": "builder prepare",
42
42
  "postpack": "builder prepare --clean",
43
+ "test": "builder test",
44
+ "test:circular": "builder test-circular",
43
45
  "types": "tsc --noEmit"
44
46
  },
47
+ "ava": {
48
+ "extensions": {
49
+ "ts": "module"
50
+ }
51
+ },
45
52
  "dependencies": {
46
53
  "@baeta/generator-sdk": "^2.0.0-next.3",
47
- "@baeta/plugin-exec": "^2.0.0-next.3",
54
+ "@baeta/plugin-exec": "^2.0.0-next.7",
48
55
  "@baeta/util-path": "^2.0.0-next.2",
49
56
  "execa": "^9.6.0"
50
57
  },
51
58
  "devDependencies": {
52
59
  "@baeta/builder": "^0.0.0",
60
+ "@baeta/testing": "^0.0.0",
53
61
  "@baeta/tsconfig": "^0.0.0",
54
- "@types/node": "^22.18.13",
62
+ "@types/node": "^22.19.1",
55
63
  "typescript": "^5.9.3"
56
64
  },
57
65
  "engines": {