@stryke/prisma-better-auth-generator 0.10.0 → 0.10.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.
@@ -221,9 +221,7 @@ async function generateAccessControl(sourceFile, modelOperations) {
221
221
  /* ts */
222
222
  `import { createAccessControl } from "better-auth/plugins/access";
223
223
  import {
224
- adminAc,
225
224
  defaultStatements,
226
- userAc
227
225
  } from "better-auth/plugins/admin/access";`
228
226
  );
229
227
  sourceFile.addStatements(
@@ -233,9 +231,8 @@ export const statements = {
233
231
  ...defaultStatements,
234
232
  ${modelOperations.map((modelOperation) => {
235
233
  const { model, plural: _, ...operations } = modelOperation;
236
- return `${lowerCaseFirst(model)}: [${Object.keys(operations).join(", ")}]`;
234
+ return `${lowerCaseFirst(model)}: [${Object.keys(operations).filter((operation) => !operation.endsWith("ManyAndReturn") && !operation.endsWith("OrThrow")).map((operation) => `"${operation.replace("One", "")}"`).join(", ")}]`;
237
235
  }).join(",\n")}
238
- })}
239
236
  }`
240
237
  );
241
238
  sourceFile.addStatements(
package/dist/generator.js CHANGED
@@ -200,9 +200,7 @@ async function generateAccessControl(sourceFile, modelOperations) {
200
200
  /* ts */
201
201
  `import { createAccessControl } from "better-auth/plugins/access";
202
202
  import {
203
- adminAc,
204
203
  defaultStatements,
205
- userAc
206
204
  } from "better-auth/plugins/admin/access";`
207
205
  );
208
206
  sourceFile.addStatements(
@@ -212,9 +210,8 @@ export const statements = {
212
210
  ...defaultStatements,
213
211
  ${modelOperations.map((modelOperation) => {
214
212
  const { model, plural: _, ...operations } = modelOperation;
215
- return `${lowerCaseFirst(model)}: [${Object.keys(operations).join(", ")}]`;
213
+ return `${lowerCaseFirst(model)}: [${Object.keys(operations).filter((operation) => !operation.endsWith("ManyAndReturn") && !operation.endsWith("OrThrow")).map((operation) => `"${operation.replace("One", "")}"`).join(", ")}]`;
216
214
  }).join(",\n")}
217
- })}
218
215
  }`
219
216
  );
220
217
  sourceFile.addStatements(
package/dist/index.cjs CHANGED
@@ -217,9 +217,7 @@ async function generateAccessControl(sourceFile, modelOperations) {
217
217
  /* ts */
218
218
  `import { createAccessControl } from "better-auth/plugins/access";
219
219
  import {
220
- adminAc,
221
220
  defaultStatements,
222
- userAc
223
221
  } from "better-auth/plugins/admin/access";`
224
222
  );
225
223
  sourceFile.addStatements(
@@ -229,9 +227,8 @@ export const statements = {
229
227
  ...defaultStatements,
230
228
  ${modelOperations.map((modelOperation) => {
231
229
  const { model, plural: _, ...operations } = modelOperation;
232
- return `${lowerCaseFirst(model)}: [${Object.keys(operations).join(", ")}]`;
230
+ return `${lowerCaseFirst(model)}: [${Object.keys(operations).filter((operation) => !operation.endsWith("ManyAndReturn") && !operation.endsWith("OrThrow")).map((operation) => `"${operation.replace("One", "")}"`).join(", ")}]`;
233
231
  }).join(",\n")}
234
- })}
235
232
  }`
236
233
  );
237
234
  sourceFile.addStatements(
package/dist/index.js CHANGED
@@ -196,9 +196,7 @@ async function generateAccessControl(sourceFile, modelOperations) {
196
196
  /* ts */
197
197
  `import { createAccessControl } from "better-auth/plugins/access";
198
198
  import {
199
- adminAc,
200
199
  defaultStatements,
201
- userAc
202
200
  } from "better-auth/plugins/admin/access";`
203
201
  );
204
202
  sourceFile.addStatements(
@@ -208,9 +206,8 @@ export const statements = {
208
206
  ...defaultStatements,
209
207
  ${modelOperations.map((modelOperation) => {
210
208
  const { model, plural: _, ...operations } = modelOperation;
211
- return `${lowerCaseFirst(model)}: [${Object.keys(operations).join(", ")}]`;
209
+ return `${lowerCaseFirst(model)}: [${Object.keys(operations).filter((operation) => !operation.endsWith("ManyAndReturn") && !operation.endsWith("OrThrow")).map((operation) => `"${operation.replace("One", "")}"`).join(", ")}]`;
212
210
  }).join(",\n")}
213
- })}
214
211
  }`
215
212
  );
216
213
  sourceFile.addStatements(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stryke/prisma-better-auth-generator",
3
- "version": "0.10.0",
3
+ "version": "0.10.2",
4
4
  "type": "module",
5
5
  "description": "A package containing a Prisma v6 generator for Better-Auth authentication.",
6
6
  "repository": {