@stryke/prisma-better-auth-generator 0.10.2 → 0.10.4
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/generator.cjs +8 -2
- package/dist/generator.js +8 -2
- package/dist/index.cjs +8 -2
- package/dist/index.js +8 -2
- package/package.json +1 -1
package/dist/generator.cjs
CHANGED
|
@@ -216,6 +216,12 @@ var lowerCaseFirst = /* @__PURE__ */ __name((input) => {
|
|
|
216
216
|
}, "lowerCaseFirst");
|
|
217
217
|
|
|
218
218
|
// src/access-control.ts
|
|
219
|
+
var OMITTED_RESOURCES = [
|
|
220
|
+
"user",
|
|
221
|
+
"session",
|
|
222
|
+
"account",
|
|
223
|
+
"verification"
|
|
224
|
+
];
|
|
219
225
|
async function generateAccessControl(sourceFile, modelOperations) {
|
|
220
226
|
sourceFile.addStatements(
|
|
221
227
|
/* ts */
|
|
@@ -229,9 +235,9 @@ import {
|
|
|
229
235
|
`
|
|
230
236
|
export const statements = {
|
|
231
237
|
...defaultStatements,
|
|
232
|
-
${modelOperations.map((modelOperation) => {
|
|
238
|
+
${modelOperations.filter((modelOperation) => !OMITTED_RESOURCES.includes(lowerCaseFirst(modelOperation.model))).map((modelOperation) => {
|
|
233
239
|
const { model, plural: _, ...operations } = modelOperation;
|
|
234
|
-
return `${lowerCaseFirst(model)}: [${Object.keys(operations).filter((operation) => !operation.endsWith("ManyAndReturn") && !operation.endsWith("OrThrow")).map((operation) => `"${operation.replace("One", "")}"`).join(", ")}]`;
|
|
240
|
+
return `${lowerCaseFirst(model)}: [${Object.keys(operations).sort().filter((operation) => !operation.endsWith("ManyAndReturn") && !operation.endsWith("OrThrow")).map((operation) => `"${operation.replace("One", "")}"`).join(", ")}]`;
|
|
235
241
|
}).join(",\n")}
|
|
236
242
|
}`
|
|
237
243
|
);
|
package/dist/generator.js
CHANGED
|
@@ -195,6 +195,12 @@ var lowerCaseFirst = /* @__PURE__ */ __name((input) => {
|
|
|
195
195
|
}, "lowerCaseFirst");
|
|
196
196
|
|
|
197
197
|
// src/access-control.ts
|
|
198
|
+
var OMITTED_RESOURCES = [
|
|
199
|
+
"user",
|
|
200
|
+
"session",
|
|
201
|
+
"account",
|
|
202
|
+
"verification"
|
|
203
|
+
];
|
|
198
204
|
async function generateAccessControl(sourceFile, modelOperations) {
|
|
199
205
|
sourceFile.addStatements(
|
|
200
206
|
/* ts */
|
|
@@ -208,9 +214,9 @@ import {
|
|
|
208
214
|
`
|
|
209
215
|
export const statements = {
|
|
210
216
|
...defaultStatements,
|
|
211
|
-
${modelOperations.map((modelOperation) => {
|
|
217
|
+
${modelOperations.filter((modelOperation) => !OMITTED_RESOURCES.includes(lowerCaseFirst(modelOperation.model))).map((modelOperation) => {
|
|
212
218
|
const { model, plural: _, ...operations } = modelOperation;
|
|
213
|
-
return `${lowerCaseFirst(model)}: [${Object.keys(operations).filter((operation) => !operation.endsWith("ManyAndReturn") && !operation.endsWith("OrThrow")).map((operation) => `"${operation.replace("One", "")}"`).join(", ")}]`;
|
|
219
|
+
return `${lowerCaseFirst(model)}: [${Object.keys(operations).sort().filter((operation) => !operation.endsWith("ManyAndReturn") && !operation.endsWith("OrThrow")).map((operation) => `"${operation.replace("One", "")}"`).join(", ")}]`;
|
|
214
220
|
}).join(",\n")}
|
|
215
221
|
}`
|
|
216
222
|
);
|
package/dist/index.cjs
CHANGED
|
@@ -212,6 +212,12 @@ var lowerCaseFirst = /* @__PURE__ */ __name((input) => {
|
|
|
212
212
|
}, "lowerCaseFirst");
|
|
213
213
|
|
|
214
214
|
// src/access-control.ts
|
|
215
|
+
var OMITTED_RESOURCES = [
|
|
216
|
+
"user",
|
|
217
|
+
"session",
|
|
218
|
+
"account",
|
|
219
|
+
"verification"
|
|
220
|
+
];
|
|
215
221
|
async function generateAccessControl(sourceFile, modelOperations) {
|
|
216
222
|
sourceFile.addStatements(
|
|
217
223
|
/* ts */
|
|
@@ -225,9 +231,9 @@ import {
|
|
|
225
231
|
`
|
|
226
232
|
export const statements = {
|
|
227
233
|
...defaultStatements,
|
|
228
|
-
${modelOperations.map((modelOperation) => {
|
|
234
|
+
${modelOperations.filter((modelOperation) => !OMITTED_RESOURCES.includes(lowerCaseFirst(modelOperation.model))).map((modelOperation) => {
|
|
229
235
|
const { model, plural: _, ...operations } = modelOperation;
|
|
230
|
-
return `${lowerCaseFirst(model)}: [${Object.keys(operations).filter((operation) => !operation.endsWith("ManyAndReturn") && !operation.endsWith("OrThrow")).map((operation) => `"${operation.replace("One", "")}"`).join(", ")}]`;
|
|
236
|
+
return `${lowerCaseFirst(model)}: [${Object.keys(operations).sort().filter((operation) => !operation.endsWith("ManyAndReturn") && !operation.endsWith("OrThrow")).map((operation) => `"${operation.replace("One", "")}"`).join(", ")}]`;
|
|
231
237
|
}).join(",\n")}
|
|
232
238
|
}`
|
|
233
239
|
);
|
package/dist/index.js
CHANGED
|
@@ -191,6 +191,12 @@ var lowerCaseFirst = /* @__PURE__ */ __name((input) => {
|
|
|
191
191
|
}, "lowerCaseFirst");
|
|
192
192
|
|
|
193
193
|
// src/access-control.ts
|
|
194
|
+
var OMITTED_RESOURCES = [
|
|
195
|
+
"user",
|
|
196
|
+
"session",
|
|
197
|
+
"account",
|
|
198
|
+
"verification"
|
|
199
|
+
];
|
|
194
200
|
async function generateAccessControl(sourceFile, modelOperations) {
|
|
195
201
|
sourceFile.addStatements(
|
|
196
202
|
/* ts */
|
|
@@ -204,9 +210,9 @@ import {
|
|
|
204
210
|
`
|
|
205
211
|
export const statements = {
|
|
206
212
|
...defaultStatements,
|
|
207
|
-
${modelOperations.map((modelOperation) => {
|
|
213
|
+
${modelOperations.filter((modelOperation) => !OMITTED_RESOURCES.includes(lowerCaseFirst(modelOperation.model))).map((modelOperation) => {
|
|
208
214
|
const { model, plural: _, ...operations } = modelOperation;
|
|
209
|
-
return `${lowerCaseFirst(model)}: [${Object.keys(operations).filter((operation) => !operation.endsWith("ManyAndReturn") && !operation.endsWith("OrThrow")).map((operation) => `"${operation.replace("One", "")}"`).join(", ")}]`;
|
|
215
|
+
return `${lowerCaseFirst(model)}: [${Object.keys(operations).sort().filter((operation) => !operation.endsWith("ManyAndReturn") && !operation.endsWith("OrThrow")).map((operation) => `"${operation.replace("One", "")}"`).join(", ")}]`;
|
|
210
216
|
}).join(",\n")}
|
|
211
217
|
}`
|
|
212
218
|
);
|