@stryke/prisma-better-auth-generator 0.11.0 → 0.12.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.
@@ -216,13 +216,13 @@ var lowerCaseFirst = /* @__PURE__ */ __name((input) => {
216
216
  }, "lowerCaseFirst");
217
217
 
218
218
  // src/access-control.ts
219
- var OMITTED_RESOURCES = [
219
+ var USER_RESOURCES = [
220
220
  "user",
221
221
  "session",
222
222
  "account",
223
223
  "verification"
224
224
  ];
225
- var ADDITIONAL_OPERATIONS = [
225
+ var SOFT_DELETE_OPERATIONS = [
226
226
  "softDelete",
227
227
  "softDeleteMany"
228
228
  ];
@@ -239,13 +239,13 @@ import {
239
239
  `
240
240
  export const statements = {
241
241
  ...defaultStatements,
242
- ${modelOperations.filter((modelOperation) => !OMITTED_RESOURCES.includes(lowerCaseFirst(modelOperation.model))).map((modelOperation) => {
242
+ ${modelOperations.filter((modelOperation) => config.omitUserResources ? !USER_RESOURCES.includes(lowerCaseFirst(modelOperation.model)) : true).map((modelOperation) => {
243
243
  const { model, plural: _, ...operations } = modelOperation;
244
244
  const operationsList = Object.keys(operations).filter((operation) => !operation.endsWith("ManyAndReturn") && !operation.endsWith("OrThrow")).map((operation) => `"${operation.replace("One", "")}"`);
245
245
  if (config.withSoftDelete) {
246
- operationsList.push(...ADDITIONAL_OPERATIONS);
246
+ operationsList.push(...SOFT_DELETE_OPERATIONS);
247
247
  }
248
- return `${lowerCaseFirst(model)}: [${Object.keys(operationsList).sort().join(", ")}]`;
248
+ return `${lowerCaseFirst(model)}: [${operationsList.sort().join(", ")}]`;
249
249
  }).join(",\n")}
250
250
  }`
251
251
  );
@@ -4473,7 +4473,8 @@ var z = /* @__PURE__ */ Object.freeze({
4473
4473
  var configBoolean = z.string().trim().transform((value) => !value || value.toLowerCase() === "false" || value.toLowerCase() === "n" || value.toLowerCase() === "no" || value === "0" ? false : value.toLowerCase() === "true" || value.toLowerCase() === "y" || value.toLowerCase() === "yes" || value === "1" ? true : value);
4474
4474
  var configSchema = z.object({
4475
4475
  debug: configBoolean.default("false"),
4476
- withSoftDelete: configBoolean.default("false")
4476
+ withSoftDelete: configBoolean.default("false"),
4477
+ omitUserResources: configBoolean.default("false")
4477
4478
  });
4478
4479
 
4479
4480
  // src/project.ts
package/dist/generator.js CHANGED
@@ -195,13 +195,13 @@ var lowerCaseFirst = /* @__PURE__ */ __name((input) => {
195
195
  }, "lowerCaseFirst");
196
196
 
197
197
  // src/access-control.ts
198
- var OMITTED_RESOURCES = [
198
+ var USER_RESOURCES = [
199
199
  "user",
200
200
  "session",
201
201
  "account",
202
202
  "verification"
203
203
  ];
204
- var ADDITIONAL_OPERATIONS = [
204
+ var SOFT_DELETE_OPERATIONS = [
205
205
  "softDelete",
206
206
  "softDeleteMany"
207
207
  ];
@@ -218,13 +218,13 @@ import {
218
218
  `
219
219
  export const statements = {
220
220
  ...defaultStatements,
221
- ${modelOperations.filter((modelOperation) => !OMITTED_RESOURCES.includes(lowerCaseFirst(modelOperation.model))).map((modelOperation) => {
221
+ ${modelOperations.filter((modelOperation) => config.omitUserResources ? !USER_RESOURCES.includes(lowerCaseFirst(modelOperation.model)) : true).map((modelOperation) => {
222
222
  const { model, plural: _, ...operations } = modelOperation;
223
223
  const operationsList = Object.keys(operations).filter((operation) => !operation.endsWith("ManyAndReturn") && !operation.endsWith("OrThrow")).map((operation) => `"${operation.replace("One", "")}"`);
224
224
  if (config.withSoftDelete) {
225
- operationsList.push(...ADDITIONAL_OPERATIONS);
225
+ operationsList.push(...SOFT_DELETE_OPERATIONS);
226
226
  }
227
- return `${lowerCaseFirst(model)}: [${Object.keys(operationsList).sort().join(", ")}]`;
227
+ return `${lowerCaseFirst(model)}: [${operationsList.sort().join(", ")}]`;
228
228
  }).join(",\n")}
229
229
  }`
230
230
  );
@@ -4452,7 +4452,8 @@ var z = /* @__PURE__ */ Object.freeze({
4452
4452
  var configBoolean = z.string().trim().transform((value) => !value || value.toLowerCase() === "false" || value.toLowerCase() === "n" || value.toLowerCase() === "no" || value === "0" ? false : value.toLowerCase() === "true" || value.toLowerCase() === "y" || value.toLowerCase() === "yes" || value === "1" ? true : value);
4453
4453
  var configSchema = z.object({
4454
4454
  debug: configBoolean.default("false"),
4455
- withSoftDelete: configBoolean.default("false")
4455
+ withSoftDelete: configBoolean.default("false"),
4456
+ omitUserResources: configBoolean.default("false")
4456
4457
  });
4457
4458
 
4458
4459
  // src/project.ts
package/dist/index.cjs CHANGED
@@ -212,13 +212,13 @@ var lowerCaseFirst = /* @__PURE__ */ __name((input) => {
212
212
  }, "lowerCaseFirst");
213
213
 
214
214
  // src/access-control.ts
215
- var OMITTED_RESOURCES = [
215
+ var USER_RESOURCES = [
216
216
  "user",
217
217
  "session",
218
218
  "account",
219
219
  "verification"
220
220
  ];
221
- var ADDITIONAL_OPERATIONS = [
221
+ var SOFT_DELETE_OPERATIONS = [
222
222
  "softDelete",
223
223
  "softDeleteMany"
224
224
  ];
@@ -235,13 +235,13 @@ import {
235
235
  `
236
236
  export const statements = {
237
237
  ...defaultStatements,
238
- ${modelOperations.filter((modelOperation) => !OMITTED_RESOURCES.includes(lowerCaseFirst(modelOperation.model))).map((modelOperation) => {
238
+ ${modelOperations.filter((modelOperation) => config.omitUserResources ? !USER_RESOURCES.includes(lowerCaseFirst(modelOperation.model)) : true).map((modelOperation) => {
239
239
  const { model, plural: _, ...operations } = modelOperation;
240
240
  const operationsList = Object.keys(operations).filter((operation) => !operation.endsWith("ManyAndReturn") && !operation.endsWith("OrThrow")).map((operation) => `"${operation.replace("One", "")}"`);
241
241
  if (config.withSoftDelete) {
242
- operationsList.push(...ADDITIONAL_OPERATIONS);
242
+ operationsList.push(...SOFT_DELETE_OPERATIONS);
243
243
  }
244
- return `${lowerCaseFirst(model)}: [${Object.keys(operationsList).sort().join(", ")}]`;
244
+ return `${lowerCaseFirst(model)}: [${operationsList.sort().join(", ")}]`;
245
245
  }).join(",\n")}
246
246
  }`
247
247
  );
@@ -4469,7 +4469,8 @@ var z = /* @__PURE__ */ Object.freeze({
4469
4469
  var configBoolean = z.string().trim().transform((value) => !value || value.toLowerCase() === "false" || value.toLowerCase() === "n" || value.toLowerCase() === "no" || value === "0" ? false : value.toLowerCase() === "true" || value.toLowerCase() === "y" || value.toLowerCase() === "yes" || value === "1" ? true : value);
4470
4470
  var configSchema = z.object({
4471
4471
  debug: configBoolean.default("false"),
4472
- withSoftDelete: configBoolean.default("false")
4472
+ withSoftDelete: configBoolean.default("false"),
4473
+ omitUserResources: configBoolean.default("false")
4473
4474
  });
4474
4475
 
4475
4476
  // src/project.ts
package/dist/index.js CHANGED
@@ -191,13 +191,13 @@ var lowerCaseFirst = /* @__PURE__ */ __name((input) => {
191
191
  }, "lowerCaseFirst");
192
192
 
193
193
  // src/access-control.ts
194
- var OMITTED_RESOURCES = [
194
+ var USER_RESOURCES = [
195
195
  "user",
196
196
  "session",
197
197
  "account",
198
198
  "verification"
199
199
  ];
200
- var ADDITIONAL_OPERATIONS = [
200
+ var SOFT_DELETE_OPERATIONS = [
201
201
  "softDelete",
202
202
  "softDeleteMany"
203
203
  ];
@@ -214,13 +214,13 @@ import {
214
214
  `
215
215
  export const statements = {
216
216
  ...defaultStatements,
217
- ${modelOperations.filter((modelOperation) => !OMITTED_RESOURCES.includes(lowerCaseFirst(modelOperation.model))).map((modelOperation) => {
217
+ ${modelOperations.filter((modelOperation) => config.omitUserResources ? !USER_RESOURCES.includes(lowerCaseFirst(modelOperation.model)) : true).map((modelOperation) => {
218
218
  const { model, plural: _, ...operations } = modelOperation;
219
219
  const operationsList = Object.keys(operations).filter((operation) => !operation.endsWith("ManyAndReturn") && !operation.endsWith("OrThrow")).map((operation) => `"${operation.replace("One", "")}"`);
220
220
  if (config.withSoftDelete) {
221
- operationsList.push(...ADDITIONAL_OPERATIONS);
221
+ operationsList.push(...SOFT_DELETE_OPERATIONS);
222
222
  }
223
- return `${lowerCaseFirst(model)}: [${Object.keys(operationsList).sort().join(", ")}]`;
223
+ return `${lowerCaseFirst(model)}: [${operationsList.sort().join(", ")}]`;
224
224
  }).join(",\n")}
225
225
  }`
226
226
  );
@@ -4448,7 +4448,8 @@ var z = /* @__PURE__ */ Object.freeze({
4448
4448
  var configBoolean = z.string().trim().transform((value) => !value || value.toLowerCase() === "false" || value.toLowerCase() === "n" || value.toLowerCase() === "no" || value === "0" ? false : value.toLowerCase() === "true" || value.toLowerCase() === "y" || value.toLowerCase() === "yes" || value === "1" ? true : value);
4449
4449
  var configSchema = z.object({
4450
4450
  debug: configBoolean.default("false"),
4451
- withSoftDelete: configBoolean.default("false")
4451
+ withSoftDelete: configBoolean.default("false"),
4452
+ omitUserResources: configBoolean.default("false")
4452
4453
  });
4453
4454
 
4454
4455
  // src/project.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stryke/prisma-better-auth-generator",
3
- "version": "0.11.0",
3
+ "version": "0.12.0",
4
4
  "type": "module",
5
5
  "description": "A package containing a Prisma v6 generator for Better-Auth authentication.",
6
6
  "repository": {