@stryke/prisma-better-auth-generator 0.14.104 → 0.14.105
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 +3 -3
- package/dist/_virtual/_rolldown/runtime.cjs +31 -0
- package/dist/_virtual/_rolldown/runtime.mjs +8 -0
- package/dist/access-control.cjs +37 -0
- package/dist/access-control.mjs +37 -0
- package/dist/access-control.mjs.map +1 -0
- package/dist/config.cjs +14 -0
- package/dist/config.mjs +13 -0
- package/dist/config.mjs.map +1 -0
- package/dist/generator.cjs +2 -0
- package/dist/generator.d.cts +1 -0
- package/dist/generator.d.mts +1 -0
- package/dist/generator.mjs +4 -0
- package/dist/index.cjs +26 -0
- package/dist/index.d.cts +1 -0
- package/dist/index.d.mts +1 -0
- package/dist/index.mjs +28 -0
- package/dist/index.mjs.map +1 -0
- package/dist/packages/env/src/ci-checks.cjs +13 -0
- package/dist/packages/env/src/ci-checks.mjs +13 -0
- package/dist/packages/env/src/ci-checks.mjs.map +1 -0
- package/dist/packages/env/src/environment-checks.cjs +96 -0
- package/dist/packages/env/src/environment-checks.mjs +88 -0
- package/dist/packages/env/src/environment-checks.mjs.map +1 -0
- package/dist/packages/env/src/get-env-paths.cjs +87 -0
- package/dist/packages/env/src/get-env-paths.mjs +85 -0
- package/dist/packages/env/src/get-env-paths.mjs.map +1 -0
- package/dist/packages/env/src/index.cjs +6 -0
- package/dist/packages/env/src/index.mjs +8 -0
- package/dist/packages/env/src/load-env.cjs +10 -0
- package/dist/packages/env/src/load-env.mjs +12 -0
- package/dist/packages/env/src/load-env.mjs.map +1 -0
- package/dist/packages/env/src/providers.cjs +111 -0
- package/dist/packages/env/src/providers.mjs +111 -0
- package/dist/packages/env/src/providers.mjs.map +1 -0
- package/dist/packages/env/src/runtime-checks.cjs +60 -0
- package/dist/packages/env/src/runtime-checks.mjs +53 -0
- package/dist/packages/env/src/runtime-checks.mjs.map +1 -0
- package/dist/packages/string-format/src/acronyms.cjs +414 -0
- package/dist/packages/string-format/src/acronyms.mjs +414 -0
- package/dist/packages/string-format/src/acronyms.mjs.map +1 -0
- package/dist/packages/string-format/src/articles.cjs +10 -0
- package/dist/packages/string-format/src/articles.mjs +10 -0
- package/dist/packages/string-format/src/articles.mjs.map +1 -0
- package/dist/packages/string-format/src/combine.cjs +15 -0
- package/dist/packages/string-format/src/combine.mjs +15 -0
- package/dist/packages/string-format/src/combine.mjs.map +1 -0
- package/dist/packages/string-format/src/conjunctions.cjs +32 -0
- package/dist/packages/string-format/src/conjunctions.mjs +32 -0
- package/dist/packages/string-format/src/conjunctions.mjs.map +1 -0
- package/dist/packages/string-format/src/decamelize.cjs +14 -0
- package/dist/packages/string-format/src/decamelize.mjs +14 -0
- package/dist/packages/string-format/src/decamelize.mjs.map +1 -0
- package/dist/packages/string-format/src/format-special-cases.cjs +33 -0
- package/dist/packages/string-format/src/format-special-cases.mjs +34 -0
- package/dist/packages/string-format/src/format-special-cases.mjs.map +1 -0
- package/dist/packages/string-format/src/lower-case-first.cjs +17 -0
- package/dist/packages/string-format/src/lower-case-first.mjs +17 -0
- package/dist/packages/string-format/src/lower-case-first.mjs.map +1 -0
- package/dist/packages/string-format/src/prepositions.cjs +68 -0
- package/dist/packages/string-format/src/prepositions.mjs +68 -0
- package/dist/packages/string-format/src/prepositions.mjs.map +1 -0
- package/dist/packages/string-format/src/special-cases.cjs +53 -0
- package/dist/packages/string-format/src/special-cases.mjs +53 -0
- package/dist/packages/string-format/src/special-cases.mjs.map +1 -0
- package/dist/packages/string-format/src/title-case.cjs +20 -0
- package/dist/packages/string-format/src/title-case.mjs +21 -0
- package/dist/packages/string-format/src/title-case.mjs.map +1 -0
- package/dist/packages/string-format/src/upper-case-first.cjs +17 -0
- package/dist/packages/string-format/src/upper-case-first.mjs +17 -0
- package/dist/packages/string-format/src/upper-case-first.mjs.map +1 -0
- package/dist/prisma-generator.cjs +47 -0
- package/dist/prisma-generator.mjs +47 -0
- package/dist/prisma-generator.mjs.map +1 -0
- package/dist/project.cjs +15 -0
- package/dist/project.mjs +15 -0
- package/dist/project.mjs.map +1 -0
- package/dist/utils/get-jiti.cjs +22 -0
- package/dist/utils/get-jiti.mjs +22 -0
- package/dist/utils/get-jiti.mjs.map +1 -0
- package/dist/utils/get-prisma-internals.cjs +13 -0
- package/dist/utils/get-prisma-internals.mjs +13 -0
- package/dist/utils/get-prisma-internals.mjs.map +1 -0
- package/package.json +26 -53
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decamelize.mjs","names":[],"sources":["../../../../../string-format/src/decamelize.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n 🗲 Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\n/**\n * Convert a camelCase or PascalCase string to a snake_case string.\n *\n * @param value - The camelCase or PascalCase string to convert.\n * @returns The converted snake_case string.\n */\nexport function decamelize(value: string): string {\n return value\n .replace(/([a-z\\d])([A-Z])/g, \"$1_$2\")\n .replace(/([A-Z]+)([A-Z][a-z\\d]+)/g, \"$1_$2\")\n .toLowerCase();\n}\n"],"mappings":";;;;;;;AAwBA,SAAgB,WAAW,OAAuB;AAChD,QAAO,MACJ,QAAQ,qBAAqB,QAAQ,CACrC,QAAQ,4BAA4B,QAAQ,CAC5C,aAAa"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
const require_acronyms = require('./acronyms.cjs');
|
|
2
|
+
const require_articles = require('./articles.cjs');
|
|
3
|
+
const require_conjunctions = require('./conjunctions.cjs');
|
|
4
|
+
const require_prepositions = require('./prepositions.cjs');
|
|
5
|
+
const require_special_cases = require('./special-cases.cjs');
|
|
6
|
+
|
|
7
|
+
//#region ../string-format/src/format-special-cases.ts
|
|
8
|
+
/**
|
|
9
|
+
* Handle special words in a title.
|
|
10
|
+
*
|
|
11
|
+
* @see https://apastyle.apa.org/style-grammar-guidelines/capitalization/title-case
|
|
12
|
+
*
|
|
13
|
+
* @param value - The word to handle
|
|
14
|
+
* @param index - The index of the word in the title
|
|
15
|
+
* @param words - The full title as an array of words
|
|
16
|
+
* @returns The formatted word
|
|
17
|
+
*/
|
|
18
|
+
function formatSpecialCases(value, index, words, options) {
|
|
19
|
+
const lowercaseStr = value.toLowerCase();
|
|
20
|
+
const uppercaseStr = value.toUpperCase();
|
|
21
|
+
for (const special of require_special_cases.SPECIAL_CASES) if (special.toLowerCase() === lowercaseStr) return special;
|
|
22
|
+
if (require_acronyms.ACRONYMS[uppercaseStr]) return options?.useDescriptions !== false ? require_acronyms.ACRONYMS[uppercaseStr].description : require_acronyms.ACRONYMS[uppercaseStr].display || uppercaseStr;
|
|
23
|
+
if (index === 0) return value;
|
|
24
|
+
if (index === words.length - 1) return value;
|
|
25
|
+
if (value.length >= 4) return value;
|
|
26
|
+
if (require_prepositions.PREPOSITIONS.includes(lowercaseStr)) return lowercaseStr;
|
|
27
|
+
if (require_conjunctions.CONJUNCTIONS.includes(lowercaseStr)) return lowercaseStr;
|
|
28
|
+
if (require_articles.ARTICLES.includes(lowercaseStr)) return lowercaseStr;
|
|
29
|
+
return value;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
//#endregion
|
|
33
|
+
exports.formatSpecialCases = formatSpecialCases;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { ACRONYMS } from "./acronyms.mjs";
|
|
2
|
+
import { ARTICLES } from "./articles.mjs";
|
|
3
|
+
import { CONJUNCTIONS } from "./conjunctions.mjs";
|
|
4
|
+
import { PREPOSITIONS } from "./prepositions.mjs";
|
|
5
|
+
import { SPECIAL_CASES } from "./special-cases.mjs";
|
|
6
|
+
|
|
7
|
+
//#region ../string-format/src/format-special-cases.ts
|
|
8
|
+
/**
|
|
9
|
+
* Handle special words in a title.
|
|
10
|
+
*
|
|
11
|
+
* @see https://apastyle.apa.org/style-grammar-guidelines/capitalization/title-case
|
|
12
|
+
*
|
|
13
|
+
* @param value - The word to handle
|
|
14
|
+
* @param index - The index of the word in the title
|
|
15
|
+
* @param words - The full title as an array of words
|
|
16
|
+
* @returns The formatted word
|
|
17
|
+
*/
|
|
18
|
+
function formatSpecialCases(value, index, words, options) {
|
|
19
|
+
const lowercaseStr = value.toLowerCase();
|
|
20
|
+
const uppercaseStr = value.toUpperCase();
|
|
21
|
+
for (const special of SPECIAL_CASES) if (special.toLowerCase() === lowercaseStr) return special;
|
|
22
|
+
if (ACRONYMS[uppercaseStr]) return options?.useDescriptions !== false ? ACRONYMS[uppercaseStr].description : ACRONYMS[uppercaseStr].display || uppercaseStr;
|
|
23
|
+
if (index === 0) return value;
|
|
24
|
+
if (index === words.length - 1) return value;
|
|
25
|
+
if (value.length >= 4) return value;
|
|
26
|
+
if (PREPOSITIONS.includes(lowercaseStr)) return lowercaseStr;
|
|
27
|
+
if (CONJUNCTIONS.includes(lowercaseStr)) return lowercaseStr;
|
|
28
|
+
if (ARTICLES.includes(lowercaseStr)) return lowercaseStr;
|
|
29
|
+
return value;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
//#endregion
|
|
33
|
+
export { formatSpecialCases };
|
|
34
|
+
//# sourceMappingURL=format-special-cases.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format-special-cases.mjs","names":[],"sources":["../../../../../string-format/src/format-special-cases.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n 🗲 Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { ACRONYMS } from \"./acronyms\";\nimport { ARTICLES } from \"./articles\";\nimport { CONJUNCTIONS } from \"./conjunctions\";\nimport { PREPOSITIONS } from \"./prepositions\";\nimport { SPECIAL_CASES } from \"./special-cases\";\n\nexport interface FormatSpecialCasesOptions {\n /**\n * If true, use the descriptions from the acronym list instead of the display names.\n *\n * @defaultValue true\n */\n useDescriptions?: boolean;\n}\n\n/**\n * Handle special words in a title.\n *\n * @see https://apastyle.apa.org/style-grammar-guidelines/capitalization/title-case\n *\n * @param value - The word to handle\n * @param index - The index of the word in the title\n * @param words - The full title as an array of words\n * @returns The formatted word\n */\nexport function formatSpecialCases(\n value: string,\n index: number,\n words: string[],\n options?: FormatSpecialCasesOptions\n): string {\n const lowercaseStr = value.toLowerCase();\n const uppercaseStr = value.toUpperCase();\n\n for (const special of SPECIAL_CASES) {\n if (special.toLowerCase() === lowercaseStr) {\n return special;\n }\n }\n\n if (ACRONYMS[uppercaseStr]) {\n return options?.useDescriptions !== false\n ? ACRONYMS[uppercaseStr].description\n : ACRONYMS[uppercaseStr].display || uppercaseStr;\n }\n\n // If the word is the first word in the sentence, but it's not a specially\n // cased word or an acronym, return the capitalized string\n if (index === 0) {\n return value;\n }\n\n // If the word is the last word in the sentence, but it's not a specially\n // cased word or an acronym, return the capitalized string\n if (index === words.length - 1) {\n return value;\n }\n\n // Return the word capitalized if it's 4 characters or more\n if (value.length >= 4) {\n return value;\n }\n\n if (PREPOSITIONS.includes(lowercaseStr)) {\n return lowercaseStr;\n }\n if (CONJUNCTIONS.includes(lowercaseStr)) {\n return lowercaseStr;\n }\n if (ARTICLES.includes(lowercaseStr)) {\n return lowercaseStr;\n }\n\n return value;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AA2CA,SAAgB,mBACd,OACA,OACA,OACA,SACQ;CACR,MAAM,eAAe,MAAM,aAAa;CACxC,MAAM,eAAe,MAAM,aAAa;AAExC,MAAK,MAAM,WAAW,cACpB,KAAI,QAAQ,aAAa,KAAK,aAC5B,QAAO;AAIX,KAAI,SAAS,cACX,QAAO,SAAS,oBAAoB,QAChC,SAAS,cAAc,cACvB,SAAS,cAAc,WAAW;AAKxC,KAAI,UAAU,EACZ,QAAO;AAKT,KAAI,UAAU,MAAM,SAAS,EAC3B,QAAO;AAIT,KAAI,MAAM,UAAU,EAClB,QAAO;AAGT,KAAI,aAAa,SAAS,aAAa,CACrC,QAAO;AAET,KAAI,aAAa,SAAS,aAAa,CACrC,QAAO;AAET,KAAI,SAAS,SAAS,aAAa,CACjC,QAAO;AAGT,QAAO"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
|
|
2
|
+
//#region ../string-format/src/lower-case-first.ts
|
|
3
|
+
/**
|
|
4
|
+
* Lower case the first character of an input string.
|
|
5
|
+
*
|
|
6
|
+
* @remarks
|
|
7
|
+
* "tHISISANEXAMPLE"
|
|
8
|
+
*
|
|
9
|
+
* @param input - The input string.
|
|
10
|
+
* @returns The lower-cased string.
|
|
11
|
+
*/
|
|
12
|
+
function lowerCaseFirst(input) {
|
|
13
|
+
return input ? input.charAt(0).toLowerCase() + input.slice(1) : input;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
//#endregion
|
|
17
|
+
exports.lowerCaseFirst = lowerCaseFirst;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
//#region ../string-format/src/lower-case-first.ts
|
|
2
|
+
/**
|
|
3
|
+
* Lower case the first character of an input string.
|
|
4
|
+
*
|
|
5
|
+
* @remarks
|
|
6
|
+
* "tHISISANEXAMPLE"
|
|
7
|
+
*
|
|
8
|
+
* @param input - The input string.
|
|
9
|
+
* @returns The lower-cased string.
|
|
10
|
+
*/
|
|
11
|
+
function lowerCaseFirst(input) {
|
|
12
|
+
return input ? input.charAt(0).toLowerCase() + input.slice(1) : input;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
//#endregion
|
|
16
|
+
export { lowerCaseFirst };
|
|
17
|
+
//# sourceMappingURL=lower-case-first.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lower-case-first.mjs","names":[],"sources":["../../../../../string-format/src/lower-case-first.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n 🗲 Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\n/**\n * Lower case the first character of an input string.\n *\n * @remarks\n * \"tHISISANEXAMPLE\"\n *\n * @param input - The input string.\n * @returns The lower-cased string.\n */\nexport function lowerCaseFirst<T extends string | undefined>(input?: T): T {\n return (input ? input.charAt(0).toLowerCase() + input.slice(1) : input) as T;\n}\n"],"mappings":";;;;;;;;;;AA2BA,SAAgB,eAA6C,OAAc;AACzE,QAAQ,QAAQ,MAAM,OAAO,EAAE,CAAC,aAAa,GAAG,MAAM,MAAM,EAAE,GAAG"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
|
|
2
|
+
//#region ../string-format/src/prepositions.ts
|
|
3
|
+
const PREPOSITIONS = [
|
|
4
|
+
"about",
|
|
5
|
+
"above",
|
|
6
|
+
"across",
|
|
7
|
+
"after",
|
|
8
|
+
"against",
|
|
9
|
+
"along",
|
|
10
|
+
"among",
|
|
11
|
+
"around",
|
|
12
|
+
"at",
|
|
13
|
+
"because of",
|
|
14
|
+
"before",
|
|
15
|
+
"behind",
|
|
16
|
+
"below",
|
|
17
|
+
"beneath",
|
|
18
|
+
"beside",
|
|
19
|
+
"besides",
|
|
20
|
+
"between",
|
|
21
|
+
"beyond",
|
|
22
|
+
"but",
|
|
23
|
+
"by",
|
|
24
|
+
"concerning",
|
|
25
|
+
"despite",
|
|
26
|
+
"down",
|
|
27
|
+
"during",
|
|
28
|
+
"except",
|
|
29
|
+
"excepting",
|
|
30
|
+
"for",
|
|
31
|
+
"from",
|
|
32
|
+
"in",
|
|
33
|
+
"in front of",
|
|
34
|
+
"inside",
|
|
35
|
+
"in spite of",
|
|
36
|
+
"instead of",
|
|
37
|
+
"into",
|
|
38
|
+
"like",
|
|
39
|
+
"near",
|
|
40
|
+
"of",
|
|
41
|
+
"off",
|
|
42
|
+
"on",
|
|
43
|
+
"onto",
|
|
44
|
+
"out",
|
|
45
|
+
"outside",
|
|
46
|
+
"over",
|
|
47
|
+
"past",
|
|
48
|
+
"regarding",
|
|
49
|
+
"since",
|
|
50
|
+
"through",
|
|
51
|
+
"throughout",
|
|
52
|
+
"to",
|
|
53
|
+
"toward",
|
|
54
|
+
"under",
|
|
55
|
+
"underneath",
|
|
56
|
+
"until",
|
|
57
|
+
"up",
|
|
58
|
+
"upon",
|
|
59
|
+
"up to",
|
|
60
|
+
"with",
|
|
61
|
+
"within",
|
|
62
|
+
"without",
|
|
63
|
+
"with regard to",
|
|
64
|
+
"with respect to"
|
|
65
|
+
];
|
|
66
|
+
|
|
67
|
+
//#endregion
|
|
68
|
+
exports.PREPOSITIONS = PREPOSITIONS;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
//#region ../string-format/src/prepositions.ts
|
|
2
|
+
const PREPOSITIONS = [
|
|
3
|
+
"about",
|
|
4
|
+
"above",
|
|
5
|
+
"across",
|
|
6
|
+
"after",
|
|
7
|
+
"against",
|
|
8
|
+
"along",
|
|
9
|
+
"among",
|
|
10
|
+
"around",
|
|
11
|
+
"at",
|
|
12
|
+
"because of",
|
|
13
|
+
"before",
|
|
14
|
+
"behind",
|
|
15
|
+
"below",
|
|
16
|
+
"beneath",
|
|
17
|
+
"beside",
|
|
18
|
+
"besides",
|
|
19
|
+
"between",
|
|
20
|
+
"beyond",
|
|
21
|
+
"but",
|
|
22
|
+
"by",
|
|
23
|
+
"concerning",
|
|
24
|
+
"despite",
|
|
25
|
+
"down",
|
|
26
|
+
"during",
|
|
27
|
+
"except",
|
|
28
|
+
"excepting",
|
|
29
|
+
"for",
|
|
30
|
+
"from",
|
|
31
|
+
"in",
|
|
32
|
+
"in front of",
|
|
33
|
+
"inside",
|
|
34
|
+
"in spite of",
|
|
35
|
+
"instead of",
|
|
36
|
+
"into",
|
|
37
|
+
"like",
|
|
38
|
+
"near",
|
|
39
|
+
"of",
|
|
40
|
+
"off",
|
|
41
|
+
"on",
|
|
42
|
+
"onto",
|
|
43
|
+
"out",
|
|
44
|
+
"outside",
|
|
45
|
+
"over",
|
|
46
|
+
"past",
|
|
47
|
+
"regarding",
|
|
48
|
+
"since",
|
|
49
|
+
"through",
|
|
50
|
+
"throughout",
|
|
51
|
+
"to",
|
|
52
|
+
"toward",
|
|
53
|
+
"under",
|
|
54
|
+
"underneath",
|
|
55
|
+
"until",
|
|
56
|
+
"up",
|
|
57
|
+
"upon",
|
|
58
|
+
"up to",
|
|
59
|
+
"with",
|
|
60
|
+
"within",
|
|
61
|
+
"without",
|
|
62
|
+
"with regard to",
|
|
63
|
+
"with respect to"
|
|
64
|
+
];
|
|
65
|
+
|
|
66
|
+
//#endregion
|
|
67
|
+
export { PREPOSITIONS };
|
|
68
|
+
//# sourceMappingURL=prepositions.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prepositions.mjs","names":[],"sources":["../../../../../string-format/src/prepositions.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n 🗲 Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nexport const PREPOSITIONS = [\n \"about\",\n \"above\",\n \"across\",\n \"after\",\n \"against\",\n \"along\",\n \"among\",\n \"around\",\n \"at\",\n \"because of\",\n \"before\",\n \"behind\",\n \"below\",\n \"beneath\",\n \"beside\",\n \"besides\",\n \"between\",\n \"beyond\",\n \"but\",\n \"by\",\n \"concerning\",\n \"despite\",\n \"down\",\n \"during\",\n \"except\",\n \"excepting\",\n \"for\",\n \"from\",\n \"in\",\n \"in front of\",\n \"inside\",\n \"in spite of\",\n \"instead of\",\n \"into\",\n \"like\",\n \"near\",\n \"of\",\n \"off\",\n \"on\",\n \"onto\",\n \"out\",\n \"outside\",\n \"over\",\n \"past\",\n \"regarding\",\n \"since\",\n \"through\",\n \"throughout\",\n \"to\",\n \"toward\",\n \"under\",\n \"underneath\",\n \"until\",\n \"up\",\n \"upon\",\n \"up to\",\n \"with\",\n \"within\",\n \"without\",\n \"with regard to\",\n \"with respect to\"\n];\n"],"mappings":";AAkBA,MAAa,eAAe;CAC1B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
|
|
2
|
+
//#region ../string-format/src/special-cases.ts
|
|
3
|
+
const SPECIAL_CASES = [
|
|
4
|
+
"2FA",
|
|
5
|
+
"4K",
|
|
6
|
+
"5K",
|
|
7
|
+
"8K",
|
|
8
|
+
"AGI",
|
|
9
|
+
"BI",
|
|
10
|
+
"ChatGPT",
|
|
11
|
+
"CTA",
|
|
12
|
+
"DateTime",
|
|
13
|
+
"FMS",
|
|
14
|
+
"GitHub",
|
|
15
|
+
"GPT",
|
|
16
|
+
"HD",
|
|
17
|
+
"IBMid",
|
|
18
|
+
"IDs",
|
|
19
|
+
"iMac",
|
|
20
|
+
"IMAX",
|
|
21
|
+
"iOS",
|
|
22
|
+
"iPad",
|
|
23
|
+
"iPhone",
|
|
24
|
+
"iPod",
|
|
25
|
+
"LDAP",
|
|
26
|
+
"LinkedIn",
|
|
27
|
+
"LLM",
|
|
28
|
+
"macOS",
|
|
29
|
+
"McDonalds",
|
|
30
|
+
"MCP",
|
|
31
|
+
"ML",
|
|
32
|
+
"MySQL",
|
|
33
|
+
"NLG",
|
|
34
|
+
"NLP",
|
|
35
|
+
"NLU",
|
|
36
|
+
"OpenAI",
|
|
37
|
+
"PDFs",
|
|
38
|
+
"PIM",
|
|
39
|
+
"PEFT",
|
|
40
|
+
"pH",
|
|
41
|
+
"PostgreSQL",
|
|
42
|
+
"SEO",
|
|
43
|
+
"TTS",
|
|
44
|
+
"UHD",
|
|
45
|
+
"UUID",
|
|
46
|
+
"XSS",
|
|
47
|
+
"YouTube",
|
|
48
|
+
"CSpell",
|
|
49
|
+
"ESLint"
|
|
50
|
+
];
|
|
51
|
+
|
|
52
|
+
//#endregion
|
|
53
|
+
exports.SPECIAL_CASES = SPECIAL_CASES;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
//#region ../string-format/src/special-cases.ts
|
|
2
|
+
const SPECIAL_CASES = [
|
|
3
|
+
"2FA",
|
|
4
|
+
"4K",
|
|
5
|
+
"5K",
|
|
6
|
+
"8K",
|
|
7
|
+
"AGI",
|
|
8
|
+
"BI",
|
|
9
|
+
"ChatGPT",
|
|
10
|
+
"CTA",
|
|
11
|
+
"DateTime",
|
|
12
|
+
"FMS",
|
|
13
|
+
"GitHub",
|
|
14
|
+
"GPT",
|
|
15
|
+
"HD",
|
|
16
|
+
"IBMid",
|
|
17
|
+
"IDs",
|
|
18
|
+
"iMac",
|
|
19
|
+
"IMAX",
|
|
20
|
+
"iOS",
|
|
21
|
+
"iPad",
|
|
22
|
+
"iPhone",
|
|
23
|
+
"iPod",
|
|
24
|
+
"LDAP",
|
|
25
|
+
"LinkedIn",
|
|
26
|
+
"LLM",
|
|
27
|
+
"macOS",
|
|
28
|
+
"McDonalds",
|
|
29
|
+
"MCP",
|
|
30
|
+
"ML",
|
|
31
|
+
"MySQL",
|
|
32
|
+
"NLG",
|
|
33
|
+
"NLP",
|
|
34
|
+
"NLU",
|
|
35
|
+
"OpenAI",
|
|
36
|
+
"PDFs",
|
|
37
|
+
"PIM",
|
|
38
|
+
"PEFT",
|
|
39
|
+
"pH",
|
|
40
|
+
"PostgreSQL",
|
|
41
|
+
"SEO",
|
|
42
|
+
"TTS",
|
|
43
|
+
"UHD",
|
|
44
|
+
"UUID",
|
|
45
|
+
"XSS",
|
|
46
|
+
"YouTube",
|
|
47
|
+
"CSpell",
|
|
48
|
+
"ESLint"
|
|
49
|
+
];
|
|
50
|
+
|
|
51
|
+
//#endregion
|
|
52
|
+
export { SPECIAL_CASES };
|
|
53
|
+
//# sourceMappingURL=special-cases.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"special-cases.mjs","names":[],"sources":["../../../../../string-format/src/special-cases.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n 🗲 Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nexport const SPECIAL_CASES = [\n \"2FA\",\n \"4K\",\n \"5K\",\n \"8K\",\n \"AGI\",\n \"BI\",\n \"ChatGPT\",\n \"CTA\",\n \"DateTime\",\n \"FMS\",\n \"GitHub\",\n \"GPT\",\n \"HD\",\n \"IBMid\",\n \"IDs\",\n \"iMac\",\n \"IMAX\",\n \"iOS\",\n \"iPad\",\n \"iPhone\",\n \"iPod\",\n \"LDAP\",\n \"LinkedIn\",\n \"LLM\",\n \"macOS\",\n \"McDonalds\",\n \"MCP\",\n \"ML\",\n \"MySQL\",\n \"NLG\",\n \"NLP\",\n \"NLU\",\n \"OpenAI\",\n \"PDFs\",\n \"PIM\",\n \"PEFT\",\n \"pH\",\n \"PostgreSQL\",\n \"SEO\",\n \"TTS\",\n \"UHD\",\n \"UUID\",\n \"XSS\",\n \"YouTube\",\n \"CSpell\",\n \"ESLint\"\n];\n"],"mappings":";AAkBA,MAAa,gBAAgB;CAC3B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
const require_acronyms = require('./acronyms.cjs');
|
|
2
|
+
const require_combine = require('./combine.cjs');
|
|
3
|
+
const require_decamelize = require('./decamelize.cjs');
|
|
4
|
+
const require_format_special_cases = require('./format-special-cases.cjs');
|
|
5
|
+
const require_upper_case_first = require('./upper-case-first.cjs');
|
|
6
|
+
|
|
7
|
+
//#region ../string-format/src/title-case.ts
|
|
8
|
+
/**
|
|
9
|
+
* Convert a string to title case.
|
|
10
|
+
*
|
|
11
|
+
* @param input - The input string to convert.
|
|
12
|
+
* @param options - Options for formatting special cases.
|
|
13
|
+
* @returns The title cased string.
|
|
14
|
+
*/
|
|
15
|
+
function titleCase(input, options) {
|
|
16
|
+
return input?.replaceAll(":", " - ")?.replaceAll("+", " + ")?.replaceAll("/", " / ")?.split(/\s+-\s+/).map((segment) => require_decamelize.decamelize(segment).split(/[\s\-_]/).map(require_upper_case_first.upperCaseFirst).map((value) => options?.expandAcronyms ? require_acronyms.ACRONYMS[value]?.description || value : value).map((value, index, array) => require_format_special_cases.formatSpecialCases(value, index, array, options)).reduce(require_combine.combine)).join(" - ");
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
//#endregion
|
|
20
|
+
exports.titleCase = titleCase;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ACRONYMS } from "./acronyms.mjs";
|
|
2
|
+
import { combine } from "./combine.mjs";
|
|
3
|
+
import { decamelize } from "./decamelize.mjs";
|
|
4
|
+
import { formatSpecialCases } from "./format-special-cases.mjs";
|
|
5
|
+
import { upperCaseFirst } from "./upper-case-first.mjs";
|
|
6
|
+
|
|
7
|
+
//#region ../string-format/src/title-case.ts
|
|
8
|
+
/**
|
|
9
|
+
* Convert a string to title case.
|
|
10
|
+
*
|
|
11
|
+
* @param input - The input string to convert.
|
|
12
|
+
* @param options - Options for formatting special cases.
|
|
13
|
+
* @returns The title cased string.
|
|
14
|
+
*/
|
|
15
|
+
function titleCase(input, options) {
|
|
16
|
+
return input?.replaceAll(":", " - ")?.replaceAll("+", " + ")?.replaceAll("/", " / ")?.split(/\s+-\s+/).map((segment) => decamelize(segment).split(/[\s\-_]/).map(upperCaseFirst).map((value) => options?.expandAcronyms ? ACRONYMS[value]?.description || value : value).map((value, index, array) => formatSpecialCases(value, index, array, options)).reduce(combine)).join(" - ");
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
//#endregion
|
|
20
|
+
export { titleCase };
|
|
21
|
+
//# sourceMappingURL=title-case.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"title-case.mjs","names":[],"sources":["../../../../../string-format/src/title-case.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n 🗲 Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { ACRONYMS } from \"./acronyms\";\nimport { combine } from \"./combine\";\nimport { decamelize } from \"./decamelize\";\nimport type { FormatSpecialCasesOptions } from \"./format-special-cases\";\nimport { formatSpecialCases } from \"./format-special-cases\";\nimport { upperCaseFirst } from \"./upper-case-first\";\n\nexport interface TitleCaseOptions extends FormatSpecialCasesOptions {\n /**\n * Whether to expand acronyms in the input string.\n *\n * @remarks\n * If true, acronyms will be expanded to their full form before being converted to title case. For example, \"NASA\" would be expanded to \"National Aeronautics and Space Administration\".\n *\n * @defaultValue false\n */\n expandAcronyms?: boolean;\n}\n\n/**\n * Convert a string to title case.\n *\n * @param input - The input string to convert.\n * @param options - Options for formatting special cases.\n * @returns The title cased string.\n */\nexport function titleCase<T extends string | undefined>(\n input: T,\n options?: TitleCaseOptions\n): T {\n return input\n ?.replaceAll(\":\", \" - \")\n ?.replaceAll(\"+\", \" + \")\n ?.replaceAll(\"/\", \" / \")\n ?.split(/\\s+-\\s+/)\n .map(segment =>\n decamelize(segment)\n .split(/[\\s\\-_]/)\n .map(upperCaseFirst)\n .map(value =>\n options?.expandAcronyms\n ? ACRONYMS[value]?.description || value\n : value\n )\n .map((value: string, index: number, array: string[]) =>\n formatSpecialCases(value, index, array, options)\n )\n .reduce(combine)\n )\n .join(\" - \") as T;\n}\n"],"mappings":";;;;;;;;;;;;;;AA4CA,SAAgB,UACd,OACA,SACG;AACH,QAAO,OACH,WAAW,KAAK,MAAM,EACtB,WAAW,KAAK,MAAM,EACtB,WAAW,KAAK,MAAM,EACtB,MAAM,UAAU,CACjB,KAAI,YACH,WAAW,QAAQ,CAChB,MAAM,UAAU,CAChB,IAAI,eAAe,CACnB,KAAI,UACH,SAAS,iBACL,SAAS,QAAQ,eAAe,QAChC,MACL,CACA,KAAK,OAAe,OAAe,UAClC,mBAAmB,OAAO,OAAO,OAAO,QAAQ,CACjD,CACA,OAAO,QAAQ,CACnB,CACA,KAAK,MAAM"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
|
|
2
|
+
//#region ../string-format/src/upper-case-first.ts
|
|
3
|
+
/**
|
|
4
|
+
* Upper case the first character of an input string.
|
|
5
|
+
*
|
|
6
|
+
* @remarks
|
|
7
|
+
* "Thisisanexample"
|
|
8
|
+
*
|
|
9
|
+
* @param input - The input string.
|
|
10
|
+
* @returns The capitalized string.
|
|
11
|
+
*/
|
|
12
|
+
function upperCaseFirst(input) {
|
|
13
|
+
return input ? input.charAt(0).toUpperCase() + input.slice(1) : input;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
//#endregion
|
|
17
|
+
exports.upperCaseFirst = upperCaseFirst;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
//#region ../string-format/src/upper-case-first.ts
|
|
2
|
+
/**
|
|
3
|
+
* Upper case the first character of an input string.
|
|
4
|
+
*
|
|
5
|
+
* @remarks
|
|
6
|
+
* "Thisisanexample"
|
|
7
|
+
*
|
|
8
|
+
* @param input - The input string.
|
|
9
|
+
* @returns The capitalized string.
|
|
10
|
+
*/
|
|
11
|
+
function upperCaseFirst(input) {
|
|
12
|
+
return input ? input.charAt(0).toUpperCase() + input.slice(1) : input;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
//#endregion
|
|
16
|
+
export { upperCaseFirst };
|
|
17
|
+
//# sourceMappingURL=upper-case-first.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upper-case-first.mjs","names":[],"sources":["../../../../../string-format/src/upper-case-first.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n 🗲 Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\n/**\n * Upper case the first character of an input string.\n *\n * @remarks\n * \"Thisisanexample\"\n *\n * @param input - The input string.\n * @returns The capitalized string.\n */\nexport function upperCaseFirst<T extends string | undefined>(input?: T): T {\n return (input ? input.charAt(0).toUpperCase() + input.slice(1) : input) as T;\n}\n"],"mappings":";;;;;;;;;;AA2BA,SAAgB,eAA6C,OAAc;AACzE,QAAQ,QAAQ,MAAM,OAAO,EAAE,CAAC,aAAa,GAAG,MAAM,MAAM,EAAE,GAAG"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
|
|
2
|
+
const require_access_control = require('./access-control.cjs');
|
|
3
|
+
const require_config = require('./config.cjs');
|
|
4
|
+
const require_project = require('./project.cjs');
|
|
5
|
+
const require_get_prisma_internals = require('./utils/get-prisma-internals.cjs');
|
|
6
|
+
let _stryke_fs_helpers = require("@stryke/fs/helpers");
|
|
7
|
+
let _stryke_path_join_paths = require("@stryke/path/join-paths");
|
|
8
|
+
|
|
9
|
+
//#region src/prisma-generator.ts
|
|
10
|
+
async function generate(options) {
|
|
11
|
+
console.log("[STORM]: Running the Storm Software - Prisma Better-Auth generator \n");
|
|
12
|
+
const internals = await require_get_prisma_internals.getPrismaInternals();
|
|
13
|
+
console.log(`[STORM]: Validating configuration options \n`);
|
|
14
|
+
const outputDir = internals.parseEnvValue(options.generator.output);
|
|
15
|
+
const results = await require_config.configSchema.safeParseAsync(options.generator.config);
|
|
16
|
+
if (!results.success) throw new Error("Invalid options passed");
|
|
17
|
+
const config = results.data;
|
|
18
|
+
const consoleLog = (message) => {
|
|
19
|
+
if (config.debug) console.log(`[STORM]: ${message} \n`);
|
|
20
|
+
};
|
|
21
|
+
consoleLog(`Using configuration parameters: \n${JSON.stringify(config)}`);
|
|
22
|
+
consoleLog(`Preparing output directory: ${outputDir}`);
|
|
23
|
+
await (0, _stryke_fs_helpers.removeDirectory)(outputDir);
|
|
24
|
+
await (0, _stryke_fs_helpers.createDirectory)(outputDir);
|
|
25
|
+
consoleLog("Finding Prisma Client generator");
|
|
26
|
+
const prismaClientProvider = options.otherGenerators.find((it) => [
|
|
27
|
+
"prisma-client",
|
|
28
|
+
"prisma-client-js",
|
|
29
|
+
"prisma-client-ts"
|
|
30
|
+
].includes(internals.parseEnvValue(it.provider)));
|
|
31
|
+
if (!prismaClientProvider) throw new Error("No Prisma Client generator found. Please add `prisma-client` to your generator list.");
|
|
32
|
+
consoleLog("Generating Prisma Client DMMF");
|
|
33
|
+
const modelOperations = (await internals.getDMMF({
|
|
34
|
+
datamodel: options.datamodel,
|
|
35
|
+
previewFeatures: prismaClientProvider?.previewFeatures
|
|
36
|
+
})).mappings.modelOperations;
|
|
37
|
+
consoleLog(`Generating Better-Auth statements source file`);
|
|
38
|
+
await require_access_control.generateStatements(require_project.project.createSourceFile((0, _stryke_path_join_paths.joinPaths)(outputDir, "./statements.ts"), void 0, { overwrite: true }), config, modelOperations);
|
|
39
|
+
consoleLog(`Generating Better-Auth access control source file`);
|
|
40
|
+
await require_access_control.generateAccessControl(require_project.project.createSourceFile((0, _stryke_path_join_paths.joinPaths)(outputDir, "./access-control.ts"), void 0, { overwrite: true }));
|
|
41
|
+
consoleLog("Saving Better-Auth router source files to disk");
|
|
42
|
+
await require_project.project.save();
|
|
43
|
+
consoleLog("Storm Software - Prisma Better-Auth generator completed successfully");
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
//#endregion
|
|
47
|
+
exports.generate = generate;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { generateAccessControl, generateStatements } from "./access-control.mjs";
|
|
2
|
+
import { configSchema } from "./config.mjs";
|
|
3
|
+
import { project } from "./project.mjs";
|
|
4
|
+
import { getPrismaInternals } from "./utils/get-prisma-internals.mjs";
|
|
5
|
+
import { createDirectory, removeDirectory } from "@stryke/fs/helpers";
|
|
6
|
+
import { joinPaths } from "@stryke/path/join-paths";
|
|
7
|
+
|
|
8
|
+
//#region src/prisma-generator.ts
|
|
9
|
+
async function generate(options) {
|
|
10
|
+
console.log("[STORM]: Running the Storm Software - Prisma Better-Auth generator \n");
|
|
11
|
+
const internals = await getPrismaInternals();
|
|
12
|
+
console.log(`[STORM]: Validating configuration options \n`);
|
|
13
|
+
const outputDir = internals.parseEnvValue(options.generator.output);
|
|
14
|
+
const results = await configSchema.safeParseAsync(options.generator.config);
|
|
15
|
+
if (!results.success) throw new Error("Invalid options passed");
|
|
16
|
+
const config = results.data;
|
|
17
|
+
const consoleLog = (message) => {
|
|
18
|
+
if (config.debug) console.log(`[STORM]: ${message} \n`);
|
|
19
|
+
};
|
|
20
|
+
consoleLog(`Using configuration parameters: \n${JSON.stringify(config)}`);
|
|
21
|
+
consoleLog(`Preparing output directory: ${outputDir}`);
|
|
22
|
+
await removeDirectory(outputDir);
|
|
23
|
+
await createDirectory(outputDir);
|
|
24
|
+
consoleLog("Finding Prisma Client generator");
|
|
25
|
+
const prismaClientProvider = options.otherGenerators.find((it) => [
|
|
26
|
+
"prisma-client",
|
|
27
|
+
"prisma-client-js",
|
|
28
|
+
"prisma-client-ts"
|
|
29
|
+
].includes(internals.parseEnvValue(it.provider)));
|
|
30
|
+
if (!prismaClientProvider) throw new Error("No Prisma Client generator found. Please add `prisma-client` to your generator list.");
|
|
31
|
+
consoleLog("Generating Prisma Client DMMF");
|
|
32
|
+
const modelOperations = (await internals.getDMMF({
|
|
33
|
+
datamodel: options.datamodel,
|
|
34
|
+
previewFeatures: prismaClientProvider?.previewFeatures
|
|
35
|
+
})).mappings.modelOperations;
|
|
36
|
+
consoleLog(`Generating Better-Auth statements source file`);
|
|
37
|
+
await generateStatements(project.createSourceFile(joinPaths(outputDir, "./statements.ts"), void 0, { overwrite: true }), config, modelOperations);
|
|
38
|
+
consoleLog(`Generating Better-Auth access control source file`);
|
|
39
|
+
await generateAccessControl(project.createSourceFile(joinPaths(outputDir, "./access-control.ts"), void 0, { overwrite: true }));
|
|
40
|
+
consoleLog("Saving Better-Auth router source files to disk");
|
|
41
|
+
await project.save();
|
|
42
|
+
consoleLog("Storm Software - Prisma Better-Auth generator completed successfully");
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
//#endregion
|
|
46
|
+
export { generate };
|
|
47
|
+
//# sourceMappingURL=prisma-generator.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prisma-generator.mjs","names":[],"sources":["../src/prisma-generator.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n 🗲 Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type {\n DMMF,\n EnvValue,\n GeneratorOptions\n} from \"@prisma/generator-helper\";\nimport { createDirectory, removeDirectory } from \"@stryke/fs/helpers\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { generateAccessControl, generateStatements } from \"./access-control\";\nimport { configSchema } from \"./config\";\nimport { project } from \"./project\";\nimport type { Writeable } from \"./types\";\nimport { getPrismaInternals } from \"./utils/get-prisma-internals\";\n\nexport async function generate(options: GeneratorOptions) {\n // eslint-disable-next-line no-console\n console.log(\n \"[STORM]: Running the Storm Software - Prisma Better-Auth generator \\n\"\n );\n\n const internals = await getPrismaInternals();\n\n // eslint-disable-next-line no-console\n console.log(`[STORM]: Validating configuration options \\n`);\n\n const outputDir = internals.parseEnvValue(\n options.generator.output as EnvValue\n );\n const results = await configSchema.safeParseAsync(options.generator.config);\n if (!results.success) {\n throw new Error(\"Invalid options passed\");\n }\n\n const config = results.data;\n const consoleLog = (message: string) => {\n if (config.debug) {\n // eslint-disable-next-line no-console\n console.log(`[STORM]: ${message} \\n`);\n }\n };\n\n consoleLog(`Using configuration parameters: \\n${JSON.stringify(config)}`);\n\n consoleLog(`Preparing output directory: ${outputDir}`);\n\n await removeDirectory(outputDir);\n await createDirectory(outputDir);\n\n consoleLog(\"Finding Prisma Client generator\");\n\n const prismaClientProvider = options.otherGenerators.find(it =>\n [\"prisma-client\", \"prisma-client-js\", \"prisma-client-ts\"].includes(\n internals.parseEnvValue(it.provider)\n )\n );\n if (!prismaClientProvider) {\n throw new Error(\n \"No Prisma Client generator found. Please add `prisma-client` to your generator list.\"\n );\n }\n\n consoleLog(\"Generating Prisma Client DMMF\");\n\n const prismaClientDmmf = (await internals.getDMMF({\n datamodel: options.datamodel,\n previewFeatures: prismaClientProvider?.previewFeatures\n })) as Writeable<DMMF.Document>;\n\n const modelOperations = prismaClientDmmf.mappings\n .modelOperations as DMMF.ModelMapping[];\n\n consoleLog(`Generating Better-Auth statements source file`);\n\n const statements = project.createSourceFile(\n joinPaths(outputDir, \"./statements.ts\"),\n undefined,\n { overwrite: true }\n );\n await generateStatements(statements, config, modelOperations);\n\n consoleLog(`Generating Better-Auth access control source file`);\n\n const accessControl = project.createSourceFile(\n joinPaths(outputDir, \"./access-control.ts\"),\n undefined,\n { overwrite: true }\n );\n await generateAccessControl(accessControl);\n\n consoleLog(\"Saving Better-Auth router source files to disk\");\n\n await project.save();\n\n consoleLog(\n \"Storm Software - Prisma Better-Auth generator completed successfully\"\n );\n}\n"],"mappings":";;;;;;;;AA+BA,eAAsB,SAAS,SAA2B;AAExD,SAAQ,IACN,wEACD;CAED,MAAM,YAAY,MAAM,oBAAoB;AAG5C,SAAQ,IAAI,+CAA+C;CAE3D,MAAM,YAAY,UAAU,cAC1B,QAAQ,UAAU,OACnB;CACD,MAAM,UAAU,MAAM,aAAa,eAAe,QAAQ,UAAU,OAAO;AAC3E,KAAI,CAAC,QAAQ,QACX,OAAM,IAAI,MAAM,yBAAyB;CAG3C,MAAM,SAAS,QAAQ;CACvB,MAAM,cAAc,YAAoB;AACtC,MAAI,OAAO,MAET,SAAQ,IAAI,YAAY,QAAQ,KAAK;;AAIzC,YAAW,qCAAqC,KAAK,UAAU,OAAO,GAAG;AAEzE,YAAW,+BAA+B,YAAY;AAEtD,OAAM,gBAAgB,UAAU;AAChC,OAAM,gBAAgB,UAAU;AAEhC,YAAW,kCAAkC;CAE7C,MAAM,uBAAuB,QAAQ,gBAAgB,MAAK,OACxD;EAAC;EAAiB;EAAoB;EAAmB,CAAC,SACxD,UAAU,cAAc,GAAG,SAAS,CACrC,CACF;AACD,KAAI,CAAC,qBACH,OAAM,IAAI,MACR,uFACD;AAGH,YAAW,gCAAgC;CAO3C,MAAM,mBAAkB,MALQ,UAAU,QAAQ;EAChD,WAAW,QAAQ;EACnB,iBAAiB,sBAAsB;EACxC,CAAC,EAEuC,SACtC;AAEH,YAAW,gDAAgD;AAO3D,OAAM,mBALa,QAAQ,iBACzB,UAAU,WAAW,kBAAkB,EACvC,QACA,EAAE,WAAW,MAAM,CAEc,EAAE,QAAQ,gBAAgB;AAE7D,YAAW,oDAAoD;AAO/D,OAAM,sBALgB,QAAQ,iBAC5B,UAAU,WAAW,sBAAsB,EAC3C,QACA,EAAE,WAAW,MAAM,CAEoB,CAAC;AAE1C,YAAW,iDAAiD;AAE5D,OAAM,QAAQ,MAAM;AAEpB,YACE,uEACD"}
|
package/dist/project.cjs
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
|
|
2
|
+
let ts_morph = require("ts-morph");
|
|
3
|
+
|
|
4
|
+
//#region src/project.ts
|
|
5
|
+
const compilerOptions = {
|
|
6
|
+
target: ts_morph.ScriptTarget.ESNext,
|
|
7
|
+
module: ts_morph.ModuleKind.ESNext,
|
|
8
|
+
emitDecoratorMetadata: true,
|
|
9
|
+
experimentalDecorators: true,
|
|
10
|
+
esModuleInterop: true
|
|
11
|
+
};
|
|
12
|
+
const project = new ts_morph.Project({ compilerOptions: { ...compilerOptions } });
|
|
13
|
+
|
|
14
|
+
//#endregion
|
|
15
|
+
exports.project = project;
|
package/dist/project.mjs
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ModuleKind, Project, ScriptTarget } from "ts-morph";
|
|
2
|
+
|
|
3
|
+
//#region src/project.ts
|
|
4
|
+
const compilerOptions = {
|
|
5
|
+
target: ScriptTarget.ESNext,
|
|
6
|
+
module: ModuleKind.ESNext,
|
|
7
|
+
emitDecoratorMetadata: true,
|
|
8
|
+
experimentalDecorators: true,
|
|
9
|
+
esModuleInterop: true
|
|
10
|
+
};
|
|
11
|
+
const project = new Project({ compilerOptions: { ...compilerOptions } });
|
|
12
|
+
|
|
13
|
+
//#endregion
|
|
14
|
+
export { project };
|
|
15
|
+
//# sourceMappingURL=project.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"project.mjs","names":[],"sources":["../src/project.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n 🗲 Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { CompilerOptions } from \"ts-morph\";\nimport { ModuleKind, Project, ScriptTarget } from \"ts-morph\";\n\nconst compilerOptions: CompilerOptions = {\n target: ScriptTarget.ESNext,\n module: ModuleKind.ESNext,\n emitDecoratorMetadata: true,\n experimentalDecorators: true,\n esModuleInterop: true\n};\n\nexport const project = new Project({\n compilerOptions: {\n ...compilerOptions\n }\n});\n"],"mappings":";;;AAqBA,MAAM,kBAAmC;CACvC,QAAQ,aAAa;CACrB,QAAQ,WAAW;CACnB,uBAAuB;CACvB,wBAAwB;CACxB,iBAAiB;CAClB;AAED,MAAa,UAAU,IAAI,QAAQ,EACjC,iBAAiB,EACf,GAAG,iBACJ,EACF,CAAC"}
|