@stryke/prisma-better-auth-generator 0.12.0 → 0.12.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,4 +1,47 @@
1
1
  <!-- START header -->
2
+ <!-- prettier-ignore-start -->
3
+ <!-- markdownlint-disable -->
4
+
5
+
6
+ <div align="center"><img src="https://public.storm-cdn.com/storm-banner.gif" width="100%" alt="Storm Software" /></div>
7
+ <br />
8
+
9
+ <div align="center">
10
+ <b>
11
+ <a href="https://stormsoftware.com" target="_blank">Website</a> •
12
+ <a href="https://github.com/storm-software/stryke" target="_blank">GitHub</a> •
13
+ <a href="https://discord.gg/MQ6YVzakM5">Discord</a> • <a href="https://stormsoftware.com/projects/stryke/docs" target="_blank">Docs</a> • <a href="https://stormsoftware.com/contact" target="_blank">Contact</a> •
14
+ <a href="https://github.com/storm-software/stryke/issues/new?assignees=&labels=bug&template=bug-report.yml&title=Bug Report%3A+">Report a Bug</a>
15
+ </b>
16
+ </div>
17
+
18
+ <br />
19
+ This package is part of Storm Software's **🌩️ Stryke** monorepo. Stryke packages TypeScript utility packages with shared functionality common to many Storm Software applications.
20
+
21
+ <br />
22
+
23
+ <h3 align="center">💻 Visit <a href="https://stormsoftware.com" target="_blank">stormsoftware.com</a> to stay up to date with this developer</h3><br />
24
+
25
+ [![Version](https://img.shields.io/badge/version-0.12.1-1fb2a6.svg?style=for-the-badge&color=1fb2a6)](https://prettier.io/)&nbsp;[![Nx](https://img.shields.io/badge/Nx-17.0.2-lightgrey?style=for-the-badge&logo=nx&logoWidth=20&&color=1fb2a6)](http://nx.dev/)&nbsp;[![NextJs](https://img.shields.io/badge/Next.js-14.0.2-lightgrey?style=for-the-badge&logo=nextdotjs&logoWidth=20&color=1fb2a6)](https://nextjs.org/)&nbsp;[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg?style=for-the-badge&logo=commitlint&color=1fb2a6)](http://commitizen.github.io/cz-cli/)&nbsp;![Semantic-Release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=for-the-badge&color=1fb2a6)&nbsp;[![documented with Fumadocs](https://img.shields.io/badge/documented_with-fumadocs-success.svg?style=for-the-badge&logo=readthedocs&color=1fb2a6)](https://fumadocs.vercel.app/)&nbsp;![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/storm-software/stryke/cr.yml?style=for-the-badge&logo=github-actions&color=1fb2a6)
26
+
27
+ > [!IMPORTANT] This repository, and the apps, libraries, and tools contained
28
+ > within, is still in it's initial development phase. As a result, bugs and
29
+ > issues are expected with it's usage. When the main development phase
30
+ > completes, a proper release will be performed, the packages will be availible
31
+ > through NPM (and other distributions), and this message will be removed.
32
+ > However, in the meantime, please feel free to report any issues you may come
33
+ > across.
34
+
35
+ <div align="center">
36
+ <b>Be sure to ⭐ this repository on <a href="https://github.com/storm-software/stryke" target="_blank">GitHub</a> so you can keep up to date on any daily progress!</b>
37
+ </div>
38
+
39
+ <br />
40
+
41
+
42
+ <!-- markdownlint-restore -->
43
+ <!-- prettier-ignore-end -->
44
+
2
45
  <!-- END header -->
3
46
 
4
47
  # prisma-better-auth-generator
@@ -6,6 +49,23 @@
6
49
  A package containing a Prisma v6 generator for Better-Auth authentication
7
50
 
8
51
  <!-- START doctoc -->
52
+ <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
53
+ ## Table of Contents
54
+
55
+ - [Installing](#installing)
56
+ - [Reduced Package Size](#reduced-package-size)
57
+ - [Development](#development)
58
+ - [Building](#building)
59
+ - [Running unit tests](#running-unit-tests)
60
+ - [Linting](#linting)
61
+ - [Storm Workspaces](#storm-workspaces)
62
+ - [Roadmap](#roadmap)
63
+ - [Support](#support)
64
+ - [License](#license)
65
+ - [Changelog](#changelog)
66
+ - [Contributing](#contributing)
67
+ - [Contributors](#contributors)
68
+
9
69
  <!-- END doctoc -->
10
70
 
11
71
  ## Installing
@@ -61,4 +121,173 @@ Run `nx lint prisma-better-auth-generator` to run [ESLint](https://eslint.org/)
61
121
  on the package.
62
122
 
63
123
  <!-- START footer -->
124
+ <!-- prettier-ignore-start -->
125
+ <!-- markdownlint-disable -->
126
+
127
+
128
+ ## Storm Workspaces
129
+
130
+ Storm workspaces are built using
131
+ <a href="https://nx.dev/" target="_blank">Nx</a>, a set of extensible dev tools
132
+ for monorepos, which helps you develop like Google, Facebook, and Microsoft.
133
+ Building on top of Nx, the Open System provides a set of tools and patterns that
134
+ help you scale your monorepo to many teams while keeping the codebase
135
+ maintainable.
136
+
137
+ <div align="right">[ <a href="#table-of-contents">Back to top ▲</a> ]</div>
138
+ <br />
139
+
140
+ ## Roadmap
141
+
142
+ See the [open issues](https://github.com/storm-software/stryke/issues) for a
143
+ list of proposed features (and known issues).
144
+
145
+ - [Top Feature Requests](https://github.com/storm-software/stryke/issues?q=label%3Aenhancement+is%3Aopen+sort%3Areactions-%2B1-desc)
146
+ (Add your votes using the 👍 reaction)
147
+ - [Top Bugs](https://github.com/storm-software/stryke/issues?q=is%3Aissue+is%3Aopen+label%3Abug+sort%3Areactions-%2B1-desc)
148
+ (Add your votes using the 👍 reaction)
149
+ - [Newest Bugs](https://github.com/storm-software/stryke/issues?q=is%3Aopen+is%3Aissue+label%3Abug)
150
+
151
+ <div align="right">[ <a href="#table-of-contents">Back to top ▲</a> ]</div>
152
+ <br />
153
+
154
+ ## Support
155
+
156
+ Reach out to the maintainer at one of the following places:
157
+
158
+ - [Contact](https://stormsoftware.com/contact)
159
+ - [GitHub discussions](https://github.com/storm-software/stryke/discussions)
160
+ - <support@stormsoftware.com>
161
+
162
+ <div align="right">[ <a href="#table-of-contents">Back to top ▲</a> ]</div>
163
+ <br />
164
+
165
+ ## License
166
+
167
+ This project is licensed under the **Apache License 2.0**. Feel free to edit and
168
+ distribute this template as you like.
169
+
170
+ See [LICENSE](LICENSE) for more information.
171
+
172
+ <div align="right">[ <a href="#table-of-contents">Back to top ▲</a> ]</div>
173
+ <br />
174
+
175
+ ## Changelog
176
+
177
+ This project adheres to
178
+ [Semantic Versioning](https://semver.org/spec/v2.0.0.html). Every release, along
179
+ with the migration instructions, is documented in the [CHANGELOG](CHANGELOG.md)
180
+ file
181
+
182
+ <div align="right">[ <a href="#table-of-contents">Back to top ▲</a> ]</div>
183
+ <br />
184
+
185
+ ## Contributing
186
+
187
+ First off, thanks for taking the time to contribute! Contributions are what
188
+ makes the open-source community such an amazing place to learn, inspire, and
189
+ create. Any contributions you make will benefit everybody else and are **greatly
190
+ appreciated**.
191
+
192
+ Please try to create bug reports that are:
193
+
194
+ - _Reproducible._ Include steps to reproduce the problem.
195
+ - _Specific._ Include as much detail as possible: which version, what
196
+ environment, etc.
197
+ - _Unique._ Do not duplicate existing opened issues.
198
+ - _Scoped to a Single Bug._ One bug per report.
199
+
200
+ Please adhere to this project's [code of conduct](.github/CODE_OF_CONDUCT.md).
201
+
202
+ You can use
203
+ [markdownlint-cli](https://github.com/storm-software/stryke/markdownlint-cli) to
204
+ check for common markdown style inconsistency.
205
+
206
+ <div align="right">[ <a href="#table-of-contents">Back to top ▲</a> ]</div>
207
+ <br />
208
+
209
+ ## Contributors
210
+
211
+ Thanks goes to these wonderful people
212
+ ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
213
+
214
+ <!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
215
+
216
+ <table>
217
+ <tbody>
218
+ <tr>
219
+ <td align="center" valign="top" width="14.28%"><a href="http://www.sullypat.com/"><img src="https://avatars.githubusercontent.com/u/99053093?v=4?s=100" width="100px;" alt="Patrick Sullivan"/><br /><sub><b>Patrick Sullivan</b></sub></a><br /><a href="#design-sullivanpj" title="Design">🎨</a> <a href="https://github.com/storm-software/stryke/commits?author=sullivanpj" title="Code">💻</a> <a href="#tool-sullivanpj" title="Tools">🔧</a> <a href="https://github.com/storm-software/stryke/commits?author=sullivanpj" title="Documentation">📖</a> <a href="https://github.com/storm-software/stryke/commits?author=sullivanpj" title="Tests">⚠️</a></td>
220
+ <td align="center" valign="top" width="14.28%"><a href="https://tylerbenning.com/"><img src="https://avatars.githubusercontent.com/u/7265547?v=4?s=100" width="100px;" alt="Tyler Benning"/><br /><sub><b>Tyler Benning</b></sub></a><br /><a href="#design-tbenning" title="Design">🎨</a></td>
221
+ <td align="center" valign="top" width="14.28%"><a href="http://stormsoftware.com"><img src="https://avatars.githubusercontent.com/u/149802440?v=4?s=100" width="100px;" alt="Stormie"/><br /><sub><b>Stormie</b></sub></a><br /><a href="#maintenance-stormie-bot" title="Maintenance">🚧</a></td>
222
+ </tr>
223
+ </tbody>
224
+ <tfoot>
225
+ <tr>
226
+ <td align="center" size="13px" colspan="7">
227
+ <img src="https://raw.githubusercontent.com/all-contributors/all-contributors-cli/1b8533af435da9854653492b1327a23a4dbd0a10/assets/logo-small.svg" alt="All Contributors">
228
+ <a href="https://all-contributors.js.org/docs/en/bot/usage">Add your contributions</a>
229
+ </img>
230
+ </td>
231
+ </tr>
232
+ </tfoot>
233
+ </table>
234
+
235
+ <!-- ALL-CONTRIBUTORS-LIST:END -->
236
+
237
+ This project follows the
238
+ [all-contributors](https://github.com/all-contributors/all-contributors)
239
+ specification. Contributions of any kind welcome!
240
+
241
+ <div align="right">[ <a href="#table-of-contents">Back to top ▲</a> ]</div>
242
+ <br />
243
+
244
+ <hr />
245
+ <br />
246
+
247
+ <div align="center">
248
+ <img src="https://public.storm-cdn.com/logo-banner.png" width="100%" alt="Storm Software" />
249
+ </div>
250
+ <br />
251
+
252
+ <div align="center">
253
+ <a href="https://stormsoftware.com" target="_blank">Website</a> • <a href="https://stormsoftware.com/contact" target="_blank">Contact</a> • <a href="https://linkedin.com/in/patrick-sullivan-865526b0" target="_blank">LinkedIn</a> • <a href="https://medium.com/@pat.joseph.sullivan" target="_blank">Medium</a> • <a href="https://github.com/storm-software" target="_blank">GitHub</a> • <a href="https://keybase.io/sullivanp" target="_blank">OpenPGP Key</a>
254
+ </div>
255
+
256
+ <div align="center">
257
+ <b>Fingerprint:</b> 1BD2 7192 7770 2549 F4C9 F238 E6AD C420 DA5C 4C2D
258
+ </div>
259
+ <br />
260
+
261
+ Storm Software is an open source software development organization and creator
262
+ of Acidic, StormStack and StormCloud.
263
+
264
+ Our mission is to make software development more accessible. Our ideal future is
265
+ one where anyone can create software without years of prior development
266
+ experience serving as a barrier to entry. We hope to achieve this via LLMs,
267
+ Generative AI, and intuitive, high-level data modeling/programming languages.
268
+
269
+ Join us on [Discord](https://discord.gg/MQ6YVzakM5) to chat with the team,
270
+ receive release notifications, ask questions, and get involved.
271
+
272
+ If this sounds interesting, and you would like to help us in creating the next
273
+ generation of development tools, please reach out on our
274
+ [website](https://stormsoftware.com/contact) or join our
275
+ [Slack channel](https://join.slack.com/t/storm-software/shared_invite/zt-2gsmk04hs-i6yhK_r6urq0dkZYAwq2pA)!
276
+
277
+ <br />
278
+
279
+ <div align="center"><a href="https://stormsoftware.com" target="_blank"><img src="https://public.storm-cdn.com/icon-fill.png" alt="Storm Software" width="200px"/></a></div>
280
+ <br />
281
+ <div align="center"><a href="https://stormsoftware.com" target="_blank"><img src="https://public.storm-cdn.com/visit-us-text.svg" alt="Visit us at stormsoftware.com" height="90px"/></a></div>
282
+
283
+ <br />
284
+
285
+ <div align="right">[ <a href="#table-of-contents">Back to top ▲</a> ]</div>
286
+ <br />
287
+ <br />
288
+
289
+
290
+ <!-- markdownlint-restore -->
291
+ <!-- prettier-ignore-end -->
292
+
64
293
  <!-- END footer -->
@@ -211,9 +211,10 @@ init_cjs_shims();
211
211
 
212
212
  // ../string-format/src/lower-case-first.ts
213
213
  init_cjs_shims();
214
- var lowerCaseFirst = /* @__PURE__ */ __name((input) => {
214
+ function lowerCaseFirst(input) {
215
215
  return input ? input.charAt(0).toLowerCase() + input.slice(1) : input;
216
- }, "lowerCaseFirst");
216
+ }
217
+ __name(lowerCaseFirst, "lowerCaseFirst");
217
218
 
218
219
  // src/access-control.ts
219
220
  var USER_RESOURCES = [
@@ -226,11 +227,10 @@ var SOFT_DELETE_OPERATIONS = [
226
227
  "softDelete",
227
228
  "softDeleteMany"
228
229
  ];
229
- async function generateAccessControl(sourceFile, config, modelOperations) {
230
+ async function generateStatements(sourceFile, config, modelOperations) {
230
231
  sourceFile.addStatements(
231
232
  /* ts */
232
- `import { createAccessControl } from "better-auth/plugins/access";
233
- import {
233
+ `import {
234
234
  defaultStatements,
235
235
  } from "better-auth/plugins/admin/access";`
236
236
  );
@@ -241,13 +241,24 @@ export const statements = {
241
241
  ...defaultStatements,
242
242
  ${modelOperations.filter((modelOperation) => config.omitUserResources ? !USER_RESOURCES.includes(lowerCaseFirst(modelOperation.model)) : true).map((modelOperation) => {
243
243
  const { model, plural: _, ...operations } = modelOperation;
244
- const operationsList = Object.keys(operations).filter((operation) => !operation.endsWith("ManyAndReturn") && !operation.endsWith("OrThrow")).map((operation) => `"${operation.replace("One", "")}"`);
244
+ const operationsList = Object.keys(operations).filter((operation) => !operation.endsWith("ManyAndReturn") && !operation.endsWith("OrThrow"));
245
245
  if (config.withSoftDelete) {
246
246
  operationsList.push(...SOFT_DELETE_OPERATIONS);
247
247
  }
248
- return `${lowerCaseFirst(model)}: [${operationsList.sort().join(", ")}]`;
248
+ return `${lowerCaseFirst(model)}: [${operationsList.map((operation) => `"${operation.replace("One", "")}"`).sort().join(", ")}]`;
249
249
  }).join(",\n")}
250
250
  }`
251
+ );
252
+ sourceFile.formatText({
253
+ indentSize: 2
254
+ });
255
+ }
256
+ __name(generateStatements, "generateStatements");
257
+ async function generateAccessControl(sourceFile) {
258
+ sourceFile.addStatements(
259
+ /* ts */
260
+ `import { createAccessControl } from "better-auth/plugins/access";
261
+ import { statements } from "./statements";`
251
262
  );
252
263
  sourceFile.addStatements(
253
264
  /* ts */
@@ -4552,17 +4563,19 @@ var ACRONYMS = [
4552
4563
 
4553
4564
  // ../string-format/src/upper-case-first.ts
4554
4565
  init_cjs_shims();
4555
- var upperCaseFirst = /* @__PURE__ */ __name((input) => {
4566
+ function upperCaseFirst(input) {
4556
4567
  return input ? input.charAt(0).toUpperCase() + input.slice(1) : input;
4557
- }, "upperCaseFirst");
4568
+ }
4569
+ __name(upperCaseFirst, "upperCaseFirst");
4558
4570
 
4559
4571
  // ../string-format/src/title-case.ts
4560
- var titleCase = /* @__PURE__ */ __name((input) => {
4572
+ function titleCase(input) {
4561
4573
  if (!input) {
4562
- return "";
4574
+ return input;
4563
4575
  }
4564
4576
  return input.split(/(?=[A-Z])|[\s._-]/).map((s) => s.trim()).filter(Boolean).map((s) => ACRONYMS.includes(s) ? s.toUpperCase() : upperCaseFirst(s.toLowerCase())).join(" ");
4565
- }, "titleCase");
4577
+ }
4578
+ __name(titleCase, "titleCase");
4566
4579
 
4567
4580
  // ../type-checks/src/is-string.ts
4568
4581
  init_cjs_shims();
@@ -4662,16 +4675,16 @@ __name(getEnvPaths, "getEnvPaths");
4662
4675
  // ../path/src/get-workspace-root.ts
4663
4676
  init_cjs_shims();
4664
4677
 
4665
- // ../../node_modules/.pnpm/@storm-software+config-tools@1.160.6_@storm-software+config@1.110.6/node_modules/@storm-software/config-tools/dist/index.js
4678
+ // ../../node_modules/.pnpm/@storm-software+config-tools@1.162.12_@storm-software+config@1.112.20/node_modules/@storm-software/config-tools/dist/index.js
4666
4679
  init_cjs_shims();
4667
4680
 
4668
- // ../../node_modules/.pnpm/@storm-software+config-tools@1.160.6_@storm-software+config@1.110.6/node_modules/@storm-software/config-tools/dist/chunk-K6PUXRK3.js
4681
+ // ../../node_modules/.pnpm/@storm-software+config-tools@1.162.12_@storm-software+config@1.112.20/node_modules/@storm-software/config-tools/dist/chunk-K6PUXRK3.js
4669
4682
  init_cjs_shims();
4670
4683
 
4671
- // ../../node_modules/.pnpm/@storm-software+config-tools@1.160.6_@storm-software+config@1.110.6/node_modules/@storm-software/config-tools/dist/chunk-NQFXB5CV.js
4684
+ // ../../node_modules/.pnpm/@storm-software+config-tools@1.162.12_@storm-software+config@1.112.20/node_modules/@storm-software/config-tools/dist/chunk-NQFXB5CV.js
4672
4685
  init_cjs_shims();
4673
4686
 
4674
- // ../../node_modules/.pnpm/@storm-software+config-tools@1.160.6_@storm-software+config@1.110.6/node_modules/@storm-software/config-tools/dist/chunk-SHUYVCID.js
4687
+ // ../../node_modules/.pnpm/@storm-software+config-tools@1.162.12_@storm-software+config@1.112.20/node_modules/@storm-software/config-tools/dist/chunk-SHUYVCID.js
4675
4688
  init_cjs_shims();
4676
4689
  var __defProp2 = Object.defineProperty;
4677
4690
  var __name2 = /* @__PURE__ */ __name((target, value) => __defProp2(target, "name", {
@@ -4679,7 +4692,7 @@ var __name2 = /* @__PURE__ */ __name((target, value) => __defProp2(target, "name
4679
4692
  configurable: true
4680
4693
  }), "__name");
4681
4694
 
4682
- // ../../node_modules/.pnpm/@storm-software+config-tools@1.160.6_@storm-software+config@1.110.6/node_modules/@storm-software/config-tools/dist/chunk-NQFXB5CV.js
4695
+ // ../../node_modules/.pnpm/@storm-software+config-tools@1.162.12_@storm-software+config@1.112.20/node_modules/@storm-software/config-tools/dist/chunk-NQFXB5CV.js
4683
4696
  var import_node_fs2 = require("node:fs");
4684
4697
  var import_node_path2 = require("node:path");
4685
4698
  var MAX_PATH_SEARCH_DEPTH = 30;
@@ -4701,7 +4714,7 @@ function findFolderUp(startPath, endFileNames = [], endDirectoryNames = []) {
4701
4714
  __name(findFolderUp, "findFolderUp");
4702
4715
  __name2(findFolderUp, "findFolderUp");
4703
4716
 
4704
- // ../../node_modules/.pnpm/@storm-software+config-tools@1.160.6_@storm-software+config@1.110.6/node_modules/@storm-software/config-tools/dist/chunk-D6E6GZD2.js
4717
+ // ../../node_modules/.pnpm/@storm-software+config-tools@1.162.12_@storm-software+config@1.112.20/node_modules/@storm-software/config-tools/dist/chunk-D6E6GZD2.js
4705
4718
  init_cjs_shims();
4706
4719
  var _DRIVE_LETTER_START_RE2 = /^[A-Za-z]:\//;
4707
4720
  function normalizeWindowsPath2(input = "") {
@@ -4818,7 +4831,7 @@ var isAbsolute2 = /* @__PURE__ */ __name2(function(p) {
4818
4831
  return _IS_ABSOLUTE_RE2.test(p);
4819
4832
  }, "isAbsolute");
4820
4833
 
4821
- // ../../node_modules/.pnpm/@storm-software+config-tools@1.160.6_@storm-software+config@1.110.6/node_modules/@storm-software/config-tools/dist/chunk-K6PUXRK3.js
4834
+ // ../../node_modules/.pnpm/@storm-software+config-tools@1.162.12_@storm-software+config@1.112.20/node_modules/@storm-software/config-tools/dist/chunk-K6PUXRK3.js
4822
4835
  var rootFiles = [
4823
4836
  "storm-workspace.json",
4824
4837
  "storm-workspace.json",
@@ -5157,11 +5170,16 @@ ${JSON.stringify(config)}`);
5157
5170
  previewFeatures: prismaClientProvider?.previewFeatures
5158
5171
  });
5159
5172
  const modelOperations = prismaClientDmmf.mappings.modelOperations;
5160
- consoleLog(`Generating Better-Auth access control source file to ${outputDir}`);
5173
+ consoleLog(`Generating Better-Auth statements source file`);
5174
+ const statements = project.createSourceFile(joinPaths(outputDir, "./statements.ts"), void 0, {
5175
+ overwrite: true
5176
+ });
5177
+ await generateStatements(statements, config, modelOperations);
5178
+ consoleLog(`Generating Better-Auth access control source file`);
5161
5179
  const accessControl = project.createSourceFile(joinPaths(outputDir, "./access-control.ts"), void 0, {
5162
5180
  overwrite: true
5163
5181
  });
5164
- await generateAccessControl(accessControl, config, modelOperations);
5182
+ await generateAccessControl(accessControl);
5165
5183
  consoleLog("Saving Better-Auth router source files to disk");
5166
5184
  await project.save();
5167
5185
  consoleLog("Storm Software - Prisma Better-Auth generator completed successfully");
package/dist/generator.js CHANGED
@@ -190,9 +190,10 @@ init_esm_shims();
190
190
 
191
191
  // ../string-format/src/lower-case-first.ts
192
192
  init_esm_shims();
193
- var lowerCaseFirst = /* @__PURE__ */ __name((input) => {
193
+ function lowerCaseFirst(input) {
194
194
  return input ? input.charAt(0).toLowerCase() + input.slice(1) : input;
195
- }, "lowerCaseFirst");
195
+ }
196
+ __name(lowerCaseFirst, "lowerCaseFirst");
196
197
 
197
198
  // src/access-control.ts
198
199
  var USER_RESOURCES = [
@@ -205,11 +206,10 @@ var SOFT_DELETE_OPERATIONS = [
205
206
  "softDelete",
206
207
  "softDeleteMany"
207
208
  ];
208
- async function generateAccessControl(sourceFile, config, modelOperations) {
209
+ async function generateStatements(sourceFile, config, modelOperations) {
209
210
  sourceFile.addStatements(
210
211
  /* ts */
211
- `import { createAccessControl } from "better-auth/plugins/access";
212
- import {
212
+ `import {
213
213
  defaultStatements,
214
214
  } from "better-auth/plugins/admin/access";`
215
215
  );
@@ -220,13 +220,24 @@ export const statements = {
220
220
  ...defaultStatements,
221
221
  ${modelOperations.filter((modelOperation) => config.omitUserResources ? !USER_RESOURCES.includes(lowerCaseFirst(modelOperation.model)) : true).map((modelOperation) => {
222
222
  const { model, plural: _, ...operations } = modelOperation;
223
- const operationsList = Object.keys(operations).filter((operation) => !operation.endsWith("ManyAndReturn") && !operation.endsWith("OrThrow")).map((operation) => `"${operation.replace("One", "")}"`);
223
+ const operationsList = Object.keys(operations).filter((operation) => !operation.endsWith("ManyAndReturn") && !operation.endsWith("OrThrow"));
224
224
  if (config.withSoftDelete) {
225
225
  operationsList.push(...SOFT_DELETE_OPERATIONS);
226
226
  }
227
- return `${lowerCaseFirst(model)}: [${operationsList.sort().join(", ")}]`;
227
+ return `${lowerCaseFirst(model)}: [${operationsList.map((operation) => `"${operation.replace("One", "")}"`).sort().join(", ")}]`;
228
228
  }).join(",\n")}
229
229
  }`
230
+ );
231
+ sourceFile.formatText({
232
+ indentSize: 2
233
+ });
234
+ }
235
+ __name(generateStatements, "generateStatements");
236
+ async function generateAccessControl(sourceFile) {
237
+ sourceFile.addStatements(
238
+ /* ts */
239
+ `import { createAccessControl } from "better-auth/plugins/access";
240
+ import { statements } from "./statements";`
230
241
  );
231
242
  sourceFile.addStatements(
232
243
  /* ts */
@@ -4531,17 +4542,19 @@ var ACRONYMS = [
4531
4542
 
4532
4543
  // ../string-format/src/upper-case-first.ts
4533
4544
  init_esm_shims();
4534
- var upperCaseFirst = /* @__PURE__ */ __name((input) => {
4545
+ function upperCaseFirst(input) {
4535
4546
  return input ? input.charAt(0).toUpperCase() + input.slice(1) : input;
4536
- }, "upperCaseFirst");
4547
+ }
4548
+ __name(upperCaseFirst, "upperCaseFirst");
4537
4549
 
4538
4550
  // ../string-format/src/title-case.ts
4539
- var titleCase = /* @__PURE__ */ __name((input) => {
4551
+ function titleCase(input) {
4540
4552
  if (!input) {
4541
- return "";
4553
+ return input;
4542
4554
  }
4543
4555
  return input.split(/(?=[A-Z])|[\s._-]/).map((s) => s.trim()).filter(Boolean).map((s) => ACRONYMS.includes(s) ? s.toUpperCase() : upperCaseFirst(s.toLowerCase())).join(" ");
4544
- }, "titleCase");
4556
+ }
4557
+ __name(titleCase, "titleCase");
4545
4558
 
4546
4559
  // ../type-checks/src/is-string.ts
4547
4560
  init_esm_shims();
@@ -4641,16 +4654,16 @@ __name(getEnvPaths, "getEnvPaths");
4641
4654
  // ../path/src/get-workspace-root.ts
4642
4655
  init_esm_shims();
4643
4656
 
4644
- // ../../node_modules/.pnpm/@storm-software+config-tools@1.160.6_@storm-software+config@1.110.6/node_modules/@storm-software/config-tools/dist/index.js
4657
+ // ../../node_modules/.pnpm/@storm-software+config-tools@1.162.12_@storm-software+config@1.112.20/node_modules/@storm-software/config-tools/dist/index.js
4645
4658
  init_esm_shims();
4646
4659
 
4647
- // ../../node_modules/.pnpm/@storm-software+config-tools@1.160.6_@storm-software+config@1.110.6/node_modules/@storm-software/config-tools/dist/chunk-K6PUXRK3.js
4660
+ // ../../node_modules/.pnpm/@storm-software+config-tools@1.162.12_@storm-software+config@1.112.20/node_modules/@storm-software/config-tools/dist/chunk-K6PUXRK3.js
4648
4661
  init_esm_shims();
4649
4662
 
4650
- // ../../node_modules/.pnpm/@storm-software+config-tools@1.160.6_@storm-software+config@1.110.6/node_modules/@storm-software/config-tools/dist/chunk-NQFXB5CV.js
4663
+ // ../../node_modules/.pnpm/@storm-software+config-tools@1.162.12_@storm-software+config@1.112.20/node_modules/@storm-software/config-tools/dist/chunk-NQFXB5CV.js
4651
4664
  init_esm_shims();
4652
4665
 
4653
- // ../../node_modules/.pnpm/@storm-software+config-tools@1.160.6_@storm-software+config@1.110.6/node_modules/@storm-software/config-tools/dist/chunk-SHUYVCID.js
4666
+ // ../../node_modules/.pnpm/@storm-software+config-tools@1.162.12_@storm-software+config@1.112.20/node_modules/@storm-software/config-tools/dist/chunk-SHUYVCID.js
4654
4667
  init_esm_shims();
4655
4668
  var __defProp2 = Object.defineProperty;
4656
4669
  var __name2 = /* @__PURE__ */ __name((target, value) => __defProp2(target, "name", {
@@ -4658,7 +4671,7 @@ var __name2 = /* @__PURE__ */ __name((target, value) => __defProp2(target, "name
4658
4671
  configurable: true
4659
4672
  }), "__name");
4660
4673
 
4661
- // ../../node_modules/.pnpm/@storm-software+config-tools@1.160.6_@storm-software+config@1.110.6/node_modules/@storm-software/config-tools/dist/chunk-NQFXB5CV.js
4674
+ // ../../node_modules/.pnpm/@storm-software+config-tools@1.162.12_@storm-software+config@1.112.20/node_modules/@storm-software/config-tools/dist/chunk-NQFXB5CV.js
4662
4675
  import { existsSync as existsSync2 } from "node:fs";
4663
4676
  import { join } from "node:path";
4664
4677
  var MAX_PATH_SEARCH_DEPTH = 30;
@@ -4680,7 +4693,7 @@ function findFolderUp(startPath, endFileNames = [], endDirectoryNames = []) {
4680
4693
  __name(findFolderUp, "findFolderUp");
4681
4694
  __name2(findFolderUp, "findFolderUp");
4682
4695
 
4683
- // ../../node_modules/.pnpm/@storm-software+config-tools@1.160.6_@storm-software+config@1.110.6/node_modules/@storm-software/config-tools/dist/chunk-D6E6GZD2.js
4696
+ // ../../node_modules/.pnpm/@storm-software+config-tools@1.162.12_@storm-software+config@1.112.20/node_modules/@storm-software/config-tools/dist/chunk-D6E6GZD2.js
4684
4697
  init_esm_shims();
4685
4698
  var _DRIVE_LETTER_START_RE2 = /^[A-Za-z]:\//;
4686
4699
  function normalizeWindowsPath2(input = "") {
@@ -4797,7 +4810,7 @@ var isAbsolute2 = /* @__PURE__ */ __name2(function(p) {
4797
4810
  return _IS_ABSOLUTE_RE2.test(p);
4798
4811
  }, "isAbsolute");
4799
4812
 
4800
- // ../../node_modules/.pnpm/@storm-software+config-tools@1.160.6_@storm-software+config@1.110.6/node_modules/@storm-software/config-tools/dist/chunk-K6PUXRK3.js
4813
+ // ../../node_modules/.pnpm/@storm-software+config-tools@1.162.12_@storm-software+config@1.112.20/node_modules/@storm-software/config-tools/dist/chunk-K6PUXRK3.js
4801
4814
  var rootFiles = [
4802
4815
  "storm-workspace.json",
4803
4816
  "storm-workspace.json",
@@ -5136,11 +5149,16 @@ ${JSON.stringify(config)}`);
5136
5149
  previewFeatures: prismaClientProvider?.previewFeatures
5137
5150
  });
5138
5151
  const modelOperations = prismaClientDmmf.mappings.modelOperations;
5139
- consoleLog(`Generating Better-Auth access control source file to ${outputDir}`);
5152
+ consoleLog(`Generating Better-Auth statements source file`);
5153
+ const statements = project.createSourceFile(joinPaths(outputDir, "./statements.ts"), void 0, {
5154
+ overwrite: true
5155
+ });
5156
+ await generateStatements(statements, config, modelOperations);
5157
+ consoleLog(`Generating Better-Auth access control source file`);
5140
5158
  const accessControl = project.createSourceFile(joinPaths(outputDir, "./access-control.ts"), void 0, {
5141
5159
  overwrite: true
5142
5160
  });
5143
- await generateAccessControl(accessControl, config, modelOperations);
5161
+ await generateAccessControl(accessControl);
5144
5162
  consoleLog("Saving Better-Auth router source files to disk");
5145
5163
  await project.save();
5146
5164
  consoleLog("Storm Software - Prisma Better-Auth generator completed successfully");
package/dist/index.cjs CHANGED
@@ -207,9 +207,10 @@ init_cjs_shims();
207
207
 
208
208
  // ../string-format/src/lower-case-first.ts
209
209
  init_cjs_shims();
210
- var lowerCaseFirst = /* @__PURE__ */ __name((input) => {
210
+ function lowerCaseFirst(input) {
211
211
  return input ? input.charAt(0).toLowerCase() + input.slice(1) : input;
212
- }, "lowerCaseFirst");
212
+ }
213
+ __name(lowerCaseFirst, "lowerCaseFirst");
213
214
 
214
215
  // src/access-control.ts
215
216
  var USER_RESOURCES = [
@@ -222,11 +223,10 @@ var SOFT_DELETE_OPERATIONS = [
222
223
  "softDelete",
223
224
  "softDeleteMany"
224
225
  ];
225
- async function generateAccessControl(sourceFile, config, modelOperations) {
226
+ async function generateStatements(sourceFile, config, modelOperations) {
226
227
  sourceFile.addStatements(
227
228
  /* ts */
228
- `import { createAccessControl } from "better-auth/plugins/access";
229
- import {
229
+ `import {
230
230
  defaultStatements,
231
231
  } from "better-auth/plugins/admin/access";`
232
232
  );
@@ -237,13 +237,24 @@ export const statements = {
237
237
  ...defaultStatements,
238
238
  ${modelOperations.filter((modelOperation) => config.omitUserResources ? !USER_RESOURCES.includes(lowerCaseFirst(modelOperation.model)) : true).map((modelOperation) => {
239
239
  const { model, plural: _, ...operations } = modelOperation;
240
- const operationsList = Object.keys(operations).filter((operation) => !operation.endsWith("ManyAndReturn") && !operation.endsWith("OrThrow")).map((operation) => `"${operation.replace("One", "")}"`);
240
+ const operationsList = Object.keys(operations).filter((operation) => !operation.endsWith("ManyAndReturn") && !operation.endsWith("OrThrow"));
241
241
  if (config.withSoftDelete) {
242
242
  operationsList.push(...SOFT_DELETE_OPERATIONS);
243
243
  }
244
- return `${lowerCaseFirst(model)}: [${operationsList.sort().join(", ")}]`;
244
+ return `${lowerCaseFirst(model)}: [${operationsList.map((operation) => `"${operation.replace("One", "")}"`).sort().join(", ")}]`;
245
245
  }).join(",\n")}
246
246
  }`
247
+ );
248
+ sourceFile.formatText({
249
+ indentSize: 2
250
+ });
251
+ }
252
+ __name(generateStatements, "generateStatements");
253
+ async function generateAccessControl(sourceFile) {
254
+ sourceFile.addStatements(
255
+ /* ts */
256
+ `import { createAccessControl } from "better-auth/plugins/access";
257
+ import { statements } from "./statements";`
247
258
  );
248
259
  sourceFile.addStatements(
249
260
  /* ts */
@@ -4548,17 +4559,19 @@ var ACRONYMS = [
4548
4559
 
4549
4560
  // ../string-format/src/upper-case-first.ts
4550
4561
  init_cjs_shims();
4551
- var upperCaseFirst = /* @__PURE__ */ __name((input) => {
4562
+ function upperCaseFirst(input) {
4552
4563
  return input ? input.charAt(0).toUpperCase() + input.slice(1) : input;
4553
- }, "upperCaseFirst");
4564
+ }
4565
+ __name(upperCaseFirst, "upperCaseFirst");
4554
4566
 
4555
4567
  // ../string-format/src/title-case.ts
4556
- var titleCase = /* @__PURE__ */ __name((input) => {
4568
+ function titleCase(input) {
4557
4569
  if (!input) {
4558
- return "";
4570
+ return input;
4559
4571
  }
4560
4572
  return input.split(/(?=[A-Z])|[\s._-]/).map((s) => s.trim()).filter(Boolean).map((s) => ACRONYMS.includes(s) ? s.toUpperCase() : upperCaseFirst(s.toLowerCase())).join(" ");
4561
- }, "titleCase");
4573
+ }
4574
+ __name(titleCase, "titleCase");
4562
4575
 
4563
4576
  // ../type-checks/src/is-string.ts
4564
4577
  init_cjs_shims();
@@ -4658,16 +4671,16 @@ __name(getEnvPaths, "getEnvPaths");
4658
4671
  // ../path/src/get-workspace-root.ts
4659
4672
  init_cjs_shims();
4660
4673
 
4661
- // ../../node_modules/.pnpm/@storm-software+config-tools@1.160.6_@storm-software+config@1.110.6/node_modules/@storm-software/config-tools/dist/index.js
4674
+ // ../../node_modules/.pnpm/@storm-software+config-tools@1.162.12_@storm-software+config@1.112.20/node_modules/@storm-software/config-tools/dist/index.js
4662
4675
  init_cjs_shims();
4663
4676
 
4664
- // ../../node_modules/.pnpm/@storm-software+config-tools@1.160.6_@storm-software+config@1.110.6/node_modules/@storm-software/config-tools/dist/chunk-K6PUXRK3.js
4677
+ // ../../node_modules/.pnpm/@storm-software+config-tools@1.162.12_@storm-software+config@1.112.20/node_modules/@storm-software/config-tools/dist/chunk-K6PUXRK3.js
4665
4678
  init_cjs_shims();
4666
4679
 
4667
- // ../../node_modules/.pnpm/@storm-software+config-tools@1.160.6_@storm-software+config@1.110.6/node_modules/@storm-software/config-tools/dist/chunk-NQFXB5CV.js
4680
+ // ../../node_modules/.pnpm/@storm-software+config-tools@1.162.12_@storm-software+config@1.112.20/node_modules/@storm-software/config-tools/dist/chunk-NQFXB5CV.js
4668
4681
  init_cjs_shims();
4669
4682
 
4670
- // ../../node_modules/.pnpm/@storm-software+config-tools@1.160.6_@storm-software+config@1.110.6/node_modules/@storm-software/config-tools/dist/chunk-SHUYVCID.js
4683
+ // ../../node_modules/.pnpm/@storm-software+config-tools@1.162.12_@storm-software+config@1.112.20/node_modules/@storm-software/config-tools/dist/chunk-SHUYVCID.js
4671
4684
  init_cjs_shims();
4672
4685
  var __defProp2 = Object.defineProperty;
4673
4686
  var __name2 = /* @__PURE__ */ __name((target, value) => __defProp2(target, "name", {
@@ -4675,7 +4688,7 @@ var __name2 = /* @__PURE__ */ __name((target, value) => __defProp2(target, "name
4675
4688
  configurable: true
4676
4689
  }), "__name");
4677
4690
 
4678
- // ../../node_modules/.pnpm/@storm-software+config-tools@1.160.6_@storm-software+config@1.110.6/node_modules/@storm-software/config-tools/dist/chunk-NQFXB5CV.js
4691
+ // ../../node_modules/.pnpm/@storm-software+config-tools@1.162.12_@storm-software+config@1.112.20/node_modules/@storm-software/config-tools/dist/chunk-NQFXB5CV.js
4679
4692
  var import_node_fs2 = require("node:fs");
4680
4693
  var import_node_path2 = require("node:path");
4681
4694
  var MAX_PATH_SEARCH_DEPTH = 30;
@@ -4697,7 +4710,7 @@ function findFolderUp(startPath, endFileNames = [], endDirectoryNames = []) {
4697
4710
  __name(findFolderUp, "findFolderUp");
4698
4711
  __name2(findFolderUp, "findFolderUp");
4699
4712
 
4700
- // ../../node_modules/.pnpm/@storm-software+config-tools@1.160.6_@storm-software+config@1.110.6/node_modules/@storm-software/config-tools/dist/chunk-D6E6GZD2.js
4713
+ // ../../node_modules/.pnpm/@storm-software+config-tools@1.162.12_@storm-software+config@1.112.20/node_modules/@storm-software/config-tools/dist/chunk-D6E6GZD2.js
4701
4714
  init_cjs_shims();
4702
4715
  var _DRIVE_LETTER_START_RE2 = /^[A-Za-z]:\//;
4703
4716
  function normalizeWindowsPath2(input = "") {
@@ -4814,7 +4827,7 @@ var isAbsolute2 = /* @__PURE__ */ __name2(function(p) {
4814
4827
  return _IS_ABSOLUTE_RE2.test(p);
4815
4828
  }, "isAbsolute");
4816
4829
 
4817
- // ../../node_modules/.pnpm/@storm-software+config-tools@1.160.6_@storm-software+config@1.110.6/node_modules/@storm-software/config-tools/dist/chunk-K6PUXRK3.js
4830
+ // ../../node_modules/.pnpm/@storm-software+config-tools@1.162.12_@storm-software+config@1.112.20/node_modules/@storm-software/config-tools/dist/chunk-K6PUXRK3.js
4818
4831
  var rootFiles = [
4819
4832
  "storm-workspace.json",
4820
4833
  "storm-workspace.json",
@@ -5153,11 +5166,16 @@ ${JSON.stringify(config)}`);
5153
5166
  previewFeatures: prismaClientProvider?.previewFeatures
5154
5167
  });
5155
5168
  const modelOperations = prismaClientDmmf.mappings.modelOperations;
5156
- consoleLog(`Generating Better-Auth access control source file to ${outputDir}`);
5169
+ consoleLog(`Generating Better-Auth statements source file`);
5170
+ const statements = project.createSourceFile(joinPaths(outputDir, "./statements.ts"), void 0, {
5171
+ overwrite: true
5172
+ });
5173
+ await generateStatements(statements, config, modelOperations);
5174
+ consoleLog(`Generating Better-Auth access control source file`);
5157
5175
  const accessControl = project.createSourceFile(joinPaths(outputDir, "./access-control.ts"), void 0, {
5158
5176
  overwrite: true
5159
5177
  });
5160
- await generateAccessControl(accessControl, config, modelOperations);
5178
+ await generateAccessControl(accessControl);
5161
5179
  consoleLog("Saving Better-Auth router source files to disk");
5162
5180
  await project.save();
5163
5181
  consoleLog("Storm Software - Prisma Better-Auth generator completed successfully");
package/dist/index.js CHANGED
@@ -186,9 +186,10 @@ init_esm_shims();
186
186
 
187
187
  // ../string-format/src/lower-case-first.ts
188
188
  init_esm_shims();
189
- var lowerCaseFirst = /* @__PURE__ */ __name((input) => {
189
+ function lowerCaseFirst(input) {
190
190
  return input ? input.charAt(0).toLowerCase() + input.slice(1) : input;
191
- }, "lowerCaseFirst");
191
+ }
192
+ __name(lowerCaseFirst, "lowerCaseFirst");
192
193
 
193
194
  // src/access-control.ts
194
195
  var USER_RESOURCES = [
@@ -201,11 +202,10 @@ var SOFT_DELETE_OPERATIONS = [
201
202
  "softDelete",
202
203
  "softDeleteMany"
203
204
  ];
204
- async function generateAccessControl(sourceFile, config, modelOperations) {
205
+ async function generateStatements(sourceFile, config, modelOperations) {
205
206
  sourceFile.addStatements(
206
207
  /* ts */
207
- `import { createAccessControl } from "better-auth/plugins/access";
208
- import {
208
+ `import {
209
209
  defaultStatements,
210
210
  } from "better-auth/plugins/admin/access";`
211
211
  );
@@ -216,13 +216,24 @@ export const statements = {
216
216
  ...defaultStatements,
217
217
  ${modelOperations.filter((modelOperation) => config.omitUserResources ? !USER_RESOURCES.includes(lowerCaseFirst(modelOperation.model)) : true).map((modelOperation) => {
218
218
  const { model, plural: _, ...operations } = modelOperation;
219
- const operationsList = Object.keys(operations).filter((operation) => !operation.endsWith("ManyAndReturn") && !operation.endsWith("OrThrow")).map((operation) => `"${operation.replace("One", "")}"`);
219
+ const operationsList = Object.keys(operations).filter((operation) => !operation.endsWith("ManyAndReturn") && !operation.endsWith("OrThrow"));
220
220
  if (config.withSoftDelete) {
221
221
  operationsList.push(...SOFT_DELETE_OPERATIONS);
222
222
  }
223
- return `${lowerCaseFirst(model)}: [${operationsList.sort().join(", ")}]`;
223
+ return `${lowerCaseFirst(model)}: [${operationsList.map((operation) => `"${operation.replace("One", "")}"`).sort().join(", ")}]`;
224
224
  }).join(",\n")}
225
225
  }`
226
+ );
227
+ sourceFile.formatText({
228
+ indentSize: 2
229
+ });
230
+ }
231
+ __name(generateStatements, "generateStatements");
232
+ async function generateAccessControl(sourceFile) {
233
+ sourceFile.addStatements(
234
+ /* ts */
235
+ `import { createAccessControl } from "better-auth/plugins/access";
236
+ import { statements } from "./statements";`
226
237
  );
227
238
  sourceFile.addStatements(
228
239
  /* ts */
@@ -4527,17 +4538,19 @@ var ACRONYMS = [
4527
4538
 
4528
4539
  // ../string-format/src/upper-case-first.ts
4529
4540
  init_esm_shims();
4530
- var upperCaseFirst = /* @__PURE__ */ __name((input) => {
4541
+ function upperCaseFirst(input) {
4531
4542
  return input ? input.charAt(0).toUpperCase() + input.slice(1) : input;
4532
- }, "upperCaseFirst");
4543
+ }
4544
+ __name(upperCaseFirst, "upperCaseFirst");
4533
4545
 
4534
4546
  // ../string-format/src/title-case.ts
4535
- var titleCase = /* @__PURE__ */ __name((input) => {
4547
+ function titleCase(input) {
4536
4548
  if (!input) {
4537
- return "";
4549
+ return input;
4538
4550
  }
4539
4551
  return input.split(/(?=[A-Z])|[\s._-]/).map((s) => s.trim()).filter(Boolean).map((s) => ACRONYMS.includes(s) ? s.toUpperCase() : upperCaseFirst(s.toLowerCase())).join(" ");
4540
- }, "titleCase");
4552
+ }
4553
+ __name(titleCase, "titleCase");
4541
4554
 
4542
4555
  // ../type-checks/src/is-string.ts
4543
4556
  init_esm_shims();
@@ -4637,16 +4650,16 @@ __name(getEnvPaths, "getEnvPaths");
4637
4650
  // ../path/src/get-workspace-root.ts
4638
4651
  init_esm_shims();
4639
4652
 
4640
- // ../../node_modules/.pnpm/@storm-software+config-tools@1.160.6_@storm-software+config@1.110.6/node_modules/@storm-software/config-tools/dist/index.js
4653
+ // ../../node_modules/.pnpm/@storm-software+config-tools@1.162.12_@storm-software+config@1.112.20/node_modules/@storm-software/config-tools/dist/index.js
4641
4654
  init_esm_shims();
4642
4655
 
4643
- // ../../node_modules/.pnpm/@storm-software+config-tools@1.160.6_@storm-software+config@1.110.6/node_modules/@storm-software/config-tools/dist/chunk-K6PUXRK3.js
4656
+ // ../../node_modules/.pnpm/@storm-software+config-tools@1.162.12_@storm-software+config@1.112.20/node_modules/@storm-software/config-tools/dist/chunk-K6PUXRK3.js
4644
4657
  init_esm_shims();
4645
4658
 
4646
- // ../../node_modules/.pnpm/@storm-software+config-tools@1.160.6_@storm-software+config@1.110.6/node_modules/@storm-software/config-tools/dist/chunk-NQFXB5CV.js
4659
+ // ../../node_modules/.pnpm/@storm-software+config-tools@1.162.12_@storm-software+config@1.112.20/node_modules/@storm-software/config-tools/dist/chunk-NQFXB5CV.js
4647
4660
  init_esm_shims();
4648
4661
 
4649
- // ../../node_modules/.pnpm/@storm-software+config-tools@1.160.6_@storm-software+config@1.110.6/node_modules/@storm-software/config-tools/dist/chunk-SHUYVCID.js
4662
+ // ../../node_modules/.pnpm/@storm-software+config-tools@1.162.12_@storm-software+config@1.112.20/node_modules/@storm-software/config-tools/dist/chunk-SHUYVCID.js
4650
4663
  init_esm_shims();
4651
4664
  var __defProp2 = Object.defineProperty;
4652
4665
  var __name2 = /* @__PURE__ */ __name((target, value) => __defProp2(target, "name", {
@@ -4654,7 +4667,7 @@ var __name2 = /* @__PURE__ */ __name((target, value) => __defProp2(target, "name
4654
4667
  configurable: true
4655
4668
  }), "__name");
4656
4669
 
4657
- // ../../node_modules/.pnpm/@storm-software+config-tools@1.160.6_@storm-software+config@1.110.6/node_modules/@storm-software/config-tools/dist/chunk-NQFXB5CV.js
4670
+ // ../../node_modules/.pnpm/@storm-software+config-tools@1.162.12_@storm-software+config@1.112.20/node_modules/@storm-software/config-tools/dist/chunk-NQFXB5CV.js
4658
4671
  import { existsSync as existsSync2 } from "node:fs";
4659
4672
  import { join } from "node:path";
4660
4673
  var MAX_PATH_SEARCH_DEPTH = 30;
@@ -4676,7 +4689,7 @@ function findFolderUp(startPath, endFileNames = [], endDirectoryNames = []) {
4676
4689
  __name(findFolderUp, "findFolderUp");
4677
4690
  __name2(findFolderUp, "findFolderUp");
4678
4691
 
4679
- // ../../node_modules/.pnpm/@storm-software+config-tools@1.160.6_@storm-software+config@1.110.6/node_modules/@storm-software/config-tools/dist/chunk-D6E6GZD2.js
4692
+ // ../../node_modules/.pnpm/@storm-software+config-tools@1.162.12_@storm-software+config@1.112.20/node_modules/@storm-software/config-tools/dist/chunk-D6E6GZD2.js
4680
4693
  init_esm_shims();
4681
4694
  var _DRIVE_LETTER_START_RE2 = /^[A-Za-z]:\//;
4682
4695
  function normalizeWindowsPath2(input = "") {
@@ -4793,7 +4806,7 @@ var isAbsolute2 = /* @__PURE__ */ __name2(function(p) {
4793
4806
  return _IS_ABSOLUTE_RE2.test(p);
4794
4807
  }, "isAbsolute");
4795
4808
 
4796
- // ../../node_modules/.pnpm/@storm-software+config-tools@1.160.6_@storm-software+config@1.110.6/node_modules/@storm-software/config-tools/dist/chunk-K6PUXRK3.js
4809
+ // ../../node_modules/.pnpm/@storm-software+config-tools@1.162.12_@storm-software+config@1.112.20/node_modules/@storm-software/config-tools/dist/chunk-K6PUXRK3.js
4797
4810
  var rootFiles = [
4798
4811
  "storm-workspace.json",
4799
4812
  "storm-workspace.json",
@@ -5132,11 +5145,16 @@ ${JSON.stringify(config)}`);
5132
5145
  previewFeatures: prismaClientProvider?.previewFeatures
5133
5146
  });
5134
5147
  const modelOperations = prismaClientDmmf.mappings.modelOperations;
5135
- consoleLog(`Generating Better-Auth access control source file to ${outputDir}`);
5148
+ consoleLog(`Generating Better-Auth statements source file`);
5149
+ const statements = project.createSourceFile(joinPaths(outputDir, "./statements.ts"), void 0, {
5150
+ overwrite: true
5151
+ });
5152
+ await generateStatements(statements, config, modelOperations);
5153
+ consoleLog(`Generating Better-Auth access control source file`);
5136
5154
  const accessControl = project.createSourceFile(joinPaths(outputDir, "./access-control.ts"), void 0, {
5137
5155
  overwrite: true
5138
5156
  });
5139
- await generateAccessControl(accessControl, config, modelOperations);
5157
+ await generateAccessControl(accessControl);
5140
5158
  consoleLog("Saving Better-Auth router source files to disk");
5141
5159
  await project.save();
5142
5160
  consoleLog("Storm Software - Prisma Better-Auth generator completed successfully");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stryke/prisma-better-auth-generator",
3
- "version": "0.12.0",
3
+ "version": "0.12.2",
4
4
  "type": "module",
5
5
  "description": "A package containing a Prisma v6 generator for Better-Auth authentication.",
6
6
  "repository": {