prisma-kysely 1.0.1 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +18 -1
- package/dist/bin.js +5 -0
- package/dist/bin.js.map +1 -0
- package/dist/constants.js +5 -0
- package/dist/constants.js.map +1 -0
- package/dist/generator.js.map +1 -0
- package/dist/helpers/generateDatabaseType.js +15 -0
- package/dist/helpers/generateDatabaseType.js.map +1 -0
- package/dist/helpers/generateField.js +22 -0
- package/dist/helpers/generateField.js.map +1 -0
- package/dist/helpers/generateFieldType.js +82 -0
- package/dist/helpers/generateFieldType.js.map +1 -0
- package/dist/helpers/generateFile.js +20 -0
- package/dist/helpers/generateFile.js.map +1 -0
- package/dist/helpers/generateImplicitManyToManyModels.js +86 -0
- package/dist/helpers/generateImplicitManyToManyModels.js.map +1 -0
- package/dist/helpers/generateModel.js +29 -0
- package/dist/helpers/generateModel.js.map +1 -0
- package/dist/helpers/generateStringLiteralUnion.js +16 -0
- package/dist/helpers/generateStringLiteralUnion.js.map +1 -0
- package/dist/helpers/generateTypedAliasDeclaration.js +12 -0
- package/dist/helpers/generateTypedAliasDeclaration.js.map +1 -0
- package/dist/utils/formatFile.js +43 -0
- package/dist/utils/formatFile.js.map +1 -0
- package/dist/utils/sorted.js +10 -0
- package/dist/utils/sorted.js.map +1 -0
- package/dist/utils/validateConfig.js +44 -0
- package/dist/utils/validateConfig.js.map +1 -0
- package/dist/utils/writeFileSafely.js +24 -0
- package/dist/utils/writeFileSafely.js.map +1 -0
- package/package.json +4 -1
- package/.eslintrc.json +0 -11
- package/.github/actions/pretty-pr/action.yml +0 -9
- package/.github/actions/pretty-pr/index.js +0 -71
- package/.github/actions/pretty-pr/package-lock.json +0 -214
- package/.github/actions/pretty-pr/package.json +0 -18
- package/.github/workflows/linters.yml +0 -86
- package/.github/workflows/pr_polish.yml +0 -20
- package/.github/workflows/publish.yml +0 -20
- package/.prettierignore +0 -1
- package/build.js +0 -11
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 Valtýr Örn Kjartansson
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,4 +1,16 @@
|
|
|
1
|
-
|
|
1
|
+

|
|
2
|
+
|
|
3
|
+
<p align="center">
|
|
4
|
+
<a href="https://www.npmjs.com/package/prisma-kysely"><img src="https://badge.fury.io/js/prisma-kysely.svg"></a>
|
|
5
|
+
</p>
|
|
6
|
+
|
|
7
|
+
<br/>
|
|
8
|
+
<br/>
|
|
9
|
+
|
|
10
|
+

|
|
11
|
+
|
|
12
|
+
<br/>
|
|
13
|
+
<br/>
|
|
2
14
|
|
|
3
15
|
> 🚧 **Library and README in progress...**
|
|
4
16
|
|
|
@@ -55,6 +67,11 @@ Here's everything you need to do (let me know if something's missing...)
|
|
|
55
67
|
|
|
56
68
|
I'm not 100% sure the [type maps](https://github.com/valtyr/prisma-kysely/blob/main/src/helpers/generateFieldType.ts) are correct for every dialect, so any and all contributions on that front would be greatly appreciated. The same goes for any bug you come across or improvement you can think of.
|
|
57
69
|
|
|
70
|
+
### Shoutouts
|
|
71
|
+
|
|
72
|
+
- I wouldn't have made this library if I hadn't used Robin Blomberg's amazing [Kysely Codegen](https://github.com/RobinBlomberg/kysely-codegen). For anyone that isn't using Prisma for migrations I wholeheartedly recommend his package.
|
|
73
|
+
- The implicit many-to-many table generation code is partly inspired by and partly stolen from [`prisma-dbml-generator`](https://github.com/notiz-dev/prisma-dbml-generator/blob/752f89cf40257a9698913294b38843ac742f8345/src/generator/many-to-many-tables.ts). Many-too-many thanks to them!
|
|
74
|
+
|
|
58
75
|
```diff
|
|
59
76
|
+ 🥹 Make Codd proud!
|
|
60
77
|
```
|
package/dist/bin.js
ADDED
package/dist/bin.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bin.js","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":";;;AACA,uBAAqB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,cAAc,GAAG,cAAc,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generator.js","sourceRoot":"","sources":["../src/generator.ts"],"names":[],"mappings":";;;;;AAAA,2CAA6C;AAC7C,yEAAsE;AACtE,yDAAsD;AACtD,iGAA8F;AAC9F,2DAAwD;AACxD,qFAAkF;AAClF,2FAAwF;AACxF,2CAAwC;AACxC,2DAAwD;AACxD,6DAA0D;AAE1D,+DAA4D;AAC5D,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,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAA,6BAAa,EAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;QAGvC,MAAM,YAAY,GAAG,IAAA,2CAAoB,EAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;QAGrE,MAAM,IAAI,GAAG,IAAA,2BAAY,EAAC;YACxB,GAAG,KAAK;YACR,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC;YAClC,YAAY;SACb,CAAC,CAAC;QAGH,MAAM,aAAa,GAAG,cAAI,CAAC,IAAI,CAC7B,CAAA,MAAA,OAAO,CAAC,SAAS,CAAC,MAAM,0CAAE,KAAK,KAAI,EAAE,EACrC,MAAM,CAAC,QAAQ,CAChB,CAAC;QACF,MAAM,IAAA,iCAAe,EAAC,aAAa,EAAE,IAAI,CAAC,CAAC;IAC7C,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.generateDatabaseType = void 0;
|
|
7
|
+
const typescript_1 = __importDefault(require("typescript"));
|
|
8
|
+
const generateDatabaseType = (models) => {
|
|
9
|
+
const properties = models.map((field) => {
|
|
10
|
+
return typescript_1.default.factory.createPropertySignature(undefined, typescript_1.default.factory.createIdentifier(field), undefined, typescript_1.default.factory.createTypeReferenceNode(typescript_1.default.factory.createIdentifier(field), undefined));
|
|
11
|
+
});
|
|
12
|
+
return typescript_1.default.factory.createTypeAliasDeclaration(undefined, [typescript_1.default.factory.createModifier(typescript_1.default.SyntaxKind.ExportKeyword)], typescript_1.default.factory.createIdentifier("DB"), undefined, typescript_1.default.factory.createTypeLiteralNode(properties));
|
|
13
|
+
};
|
|
14
|
+
exports.generateDatabaseType = generateDatabaseType;
|
|
15
|
+
//# sourceMappingURL=generateDatabaseType.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generateDatabaseType.js","sourceRoot":"","sources":["../../src/helpers/generateDatabaseType.ts"],"names":[],"mappings":";;;;;;AAAA,4DAA4B;AAErB,MAAM,oBAAoB,GAAG,CAAC,MAAgB,EAAE,EAAE;IACvD,MAAM,UAAU,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;QACtC,OAAO,oBAAE,CAAC,OAAO,CAAC,uBAAuB,CACvC,SAAS,EACT,oBAAE,CAAC,OAAO,CAAC,gBAAgB,CAAC,KAAK,CAAC,EAClC,SAAS,EACT,oBAAE,CAAC,OAAO,CAAC,uBAAuB,CAChC,oBAAE,CAAC,OAAO,CAAC,gBAAgB,CAAC,KAAK,CAAC,EAClC,SAAS,CACV,CACF,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,OAAO,oBAAE,CAAC,OAAO,CAAC,0BAA0B,CAC1C,SAAS,EACT,CAAC,oBAAE,CAAC,OAAO,CAAC,cAAc,CAAC,oBAAE,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC,EACxD,oBAAE,CAAC,OAAO,CAAC,gBAAgB,CAAC,IAAI,CAAC,EACjC,SAAS,EACT,oBAAE,CAAC,OAAO,CAAC,qBAAqB,CAAC,UAAU,CAAC,CAC7C,CAAC;AACJ,CAAC,CAAC;AApBW,QAAA,oBAAoB,wBAoB/B"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.generateField = void 0;
|
|
7
|
+
const typescript_1 = __importDefault(require("typescript"));
|
|
8
|
+
const generateField = (name, type, nullable, generated, list) => {
|
|
9
|
+
let fieldType = type;
|
|
10
|
+
if (nullable)
|
|
11
|
+
fieldType = typescript_1.default.factory.createUnionTypeNode([
|
|
12
|
+
fieldType,
|
|
13
|
+
typescript_1.default.factory.createLiteralTypeNode(typescript_1.default.factory.createToken(typescript_1.default.SyntaxKind.NullKeyword)),
|
|
14
|
+
]);
|
|
15
|
+
if (generated)
|
|
16
|
+
fieldType = typescript_1.default.factory.createTypeReferenceNode(typescript_1.default.factory.createIdentifier("Generated"), [fieldType]);
|
|
17
|
+
if (list)
|
|
18
|
+
fieldType = typescript_1.default.factory.createArrayTypeNode(fieldType);
|
|
19
|
+
return typescript_1.default.factory.createPropertySignature(undefined, typescript_1.default.factory.createIdentifier(name), undefined, fieldType);
|
|
20
|
+
};
|
|
21
|
+
exports.generateField = generateField;
|
|
22
|
+
//# sourceMappingURL=generateField.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generateField.js","sourceRoot":"","sources":["../../src/helpers/generateField.ts"],"names":[],"mappings":";;;;;;AAAA,4DAA4B;AAErB,MAAM,aAAa,GAAG,CAC3B,IAAY,EACZ,IAAiB,EACjB,QAAiB,EACjB,SAAkB,EAClB,IAAa,EACb,EAAE;IACF,IAAI,SAAS,GAAG,IAAI,CAAC;IAErB,IAAI,QAAQ;QACV,SAAS,GAAG,oBAAE,CAAC,OAAO,CAAC,mBAAmB,CAAC;YACzC,SAAS;YACT,oBAAE,CAAC,OAAO,CAAC,qBAAqB,CAC9B,oBAAE,CAAC,OAAO,CAAC,WAAW,CAAC,oBAAE,CAAC,UAAU,CAAC,WAAW,CAAC,CAClD;SACF,CAAC,CAAC;IAEL,IAAI,SAAS;QACX,SAAS,GAAG,oBAAE,CAAC,OAAO,CAAC,uBAAuB,CAC5C,oBAAE,CAAC,OAAO,CAAC,gBAAgB,CAAC,WAAW,CAAC,EACxC,CAAC,SAAS,CAAC,CACZ,CAAC;IAEJ,IAAI,IAAI;QAAE,SAAS,GAAG,oBAAE,CAAC,OAAO,CAAC,mBAAmB,CAAC,SAAS,CAAC,CAAC;IAEhE,OAAO,oBAAE,CAAC,OAAO,CAAC,uBAAuB,CACvC,SAAS,EACT,oBAAE,CAAC,OAAO,CAAC,gBAAgB,CAAC,IAAI,CAAC,EACjC,SAAS,EACT,SAAS,CACV,CAAC;AACJ,CAAC,CAAC;AA/BW,QAAA,aAAa,iBA+BxB"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.generateFieldType = exports.generateFieldTypeInner = exports.overrideType = exports.postgresqlTypeMap = exports.mysqlTypeMap = exports.sqliteTypeMap = void 0;
|
|
4
|
+
exports.sqliteTypeMap = {
|
|
5
|
+
BigInt: "bigint",
|
|
6
|
+
Boolean: "number",
|
|
7
|
+
Bytes: "Buffer",
|
|
8
|
+
DateTime: "Timestamp",
|
|
9
|
+
Decimal: "number",
|
|
10
|
+
Float: "number",
|
|
11
|
+
Int: "number",
|
|
12
|
+
String: "string",
|
|
13
|
+
Unsupported: "unknown",
|
|
14
|
+
};
|
|
15
|
+
exports.mysqlTypeMap = {
|
|
16
|
+
BigInt: "bigint",
|
|
17
|
+
Boolean: "boolean",
|
|
18
|
+
Bytes: "Buffer",
|
|
19
|
+
DateTime: "Timestamp",
|
|
20
|
+
Decimal: "number",
|
|
21
|
+
Float: "number",
|
|
22
|
+
Int: "number",
|
|
23
|
+
Json: "unknown",
|
|
24
|
+
String: "string",
|
|
25
|
+
Unsupported: "unknown",
|
|
26
|
+
};
|
|
27
|
+
exports.postgresqlTypeMap = {
|
|
28
|
+
BigInt: "bigint",
|
|
29
|
+
Boolean: "boolean",
|
|
30
|
+
Bytes: "Buffer",
|
|
31
|
+
DateTime: "Timestamp",
|
|
32
|
+
Decimal: "number",
|
|
33
|
+
Float: "number",
|
|
34
|
+
Int: "number",
|
|
35
|
+
Json: "unknown",
|
|
36
|
+
String: "string",
|
|
37
|
+
Unsupported: "unknown",
|
|
38
|
+
};
|
|
39
|
+
const overrideType = (type, config) => {
|
|
40
|
+
switch (type) {
|
|
41
|
+
case "String":
|
|
42
|
+
return config.stringTypeOverride;
|
|
43
|
+
case "DateTime":
|
|
44
|
+
return config.dateTimeTypeOverride;
|
|
45
|
+
case "Boolean":
|
|
46
|
+
return config.booleanTypeOverride;
|
|
47
|
+
case "BigInt":
|
|
48
|
+
return config.bigIntTypeOverride;
|
|
49
|
+
case "Int":
|
|
50
|
+
return config.intTypeOverride;
|
|
51
|
+
case "Float":
|
|
52
|
+
return config.floatTypeOverride;
|
|
53
|
+
case "Decimal":
|
|
54
|
+
return config.decimalTypeOverride;
|
|
55
|
+
case "Bytes":
|
|
56
|
+
return config.bytesTypeOverride;
|
|
57
|
+
case "Json":
|
|
58
|
+
return config.jsonTypeOverride;
|
|
59
|
+
case "Unsupported":
|
|
60
|
+
return config.unsupportedTypeOverride;
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
exports.overrideType = overrideType;
|
|
64
|
+
const generateFieldTypeInner = (type, config) => {
|
|
65
|
+
switch (config.databaseProvider) {
|
|
66
|
+
case "sqlite":
|
|
67
|
+
return (0, exports.overrideType)(type, config) || exports.sqliteTypeMap[type];
|
|
68
|
+
case "mysql":
|
|
69
|
+
return (0, exports.overrideType)(type, config) || exports.mysqlTypeMap[type];
|
|
70
|
+
case "postgresql":
|
|
71
|
+
return (0, exports.overrideType)(type, config) || exports.postgresqlTypeMap[type];
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
exports.generateFieldTypeInner = generateFieldTypeInner;
|
|
75
|
+
const generateFieldType = (type, config) => {
|
|
76
|
+
const fieldType = (0, exports.generateFieldTypeInner)(type, config);
|
|
77
|
+
if (!fieldType)
|
|
78
|
+
throw new Error(`Unsupported type ${type}`);
|
|
79
|
+
return fieldType;
|
|
80
|
+
};
|
|
81
|
+
exports.generateFieldType = generateFieldType;
|
|
82
|
+
//# sourceMappingURL=generateFieldType.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generateFieldType.js","sourceRoot":"","sources":["../../src/helpers/generateFieldType.ts"],"names":[],"mappings":";;;AAgBa,QAAA,aAAa,GAAY;IACpC,MAAM,EAAE,QAAQ;IAChB,OAAO,EAAE,QAAQ;IACjB,KAAK,EAAE,QAAQ;IACf,QAAQ,EAAE,WAAW;IACrB,OAAO,EAAE,QAAQ;IACjB,KAAK,EAAE,QAAQ;IACf,GAAG,EAAE,QAAQ;IACb,MAAM,EAAE,QAAQ;IAChB,WAAW,EAAE,SAAS;CACvB,CAAC;AAEW,QAAA,YAAY,GAAY;IACnC,MAAM,EAAE,QAAQ;IAChB,OAAO,EAAE,SAAS;IAClB,KAAK,EAAE,QAAQ;IACf,QAAQ,EAAE,WAAW;IACrB,OAAO,EAAE,QAAQ;IACjB,KAAK,EAAE,QAAQ;IACf,GAAG,EAAE,QAAQ;IACb,IAAI,EAAE,SAAS;IACf,MAAM,EAAE,QAAQ;IAChB,WAAW,EAAE,SAAS;CACvB,CAAC;AAEW,QAAA,iBAAiB,GAAY;IACxC,MAAM,EAAE,QAAQ;IAChB,OAAO,EAAE,SAAS;IAClB,KAAK,EAAE,QAAQ;IACf,QAAQ,EAAE,WAAW;IACrB,OAAO,EAAE,QAAQ;IACjB,KAAK,EAAE,QAAQ;IACf,GAAG,EAAE,QAAQ;IACb,IAAI,EAAE,SAAS;IACf,MAAM,EAAE,QAAQ;IAChB,WAAW,EAAE,SAAS;CACvB,CAAC;AAEK,MAAM,YAAY,GAAG,CAAC,IAAY,EAAE,MAAc,EAAE,EAAE;IAC3D,QAAQ,IAAI,EAAE;QACZ,KAAK,QAAQ;YACX,OAAO,MAAM,CAAC,kBAAkB,CAAC;QACnC,KAAK,UAAU;YACb,OAAO,MAAM,CAAC,oBAAoB,CAAC;QACrC,KAAK,SAAS;YACZ,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QAAA,iBAAiB,qBAI5B"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.generateFile = void 0;
|
|
7
|
+
const typescript_1 = __importDefault(require("typescript"));
|
|
8
|
+
const printer = typescript_1.default.createPrinter({ newLine: typescript_1.default.NewLineKind.LineFeed });
|
|
9
|
+
const generateFile = (statements) => {
|
|
10
|
+
const file = typescript_1.default.factory.createSourceFile(statements, typescript_1.default.factory.createToken(typescript_1.default.SyntaxKind.EndOfFileToken), typescript_1.default.NodeFlags.None);
|
|
11
|
+
const result = printer.printFile(file);
|
|
12
|
+
const leader = `import type { ColumnType } from "kysely";
|
|
13
|
+
export type Generated<T> = T extends ColumnType<infer S, infer I, infer U>
|
|
14
|
+
? ColumnType<S, I | undefined, U>
|
|
15
|
+
: ColumnType<T, T | undefined, T>;
|
|
16
|
+
export type Timestamp = ColumnType<Date, Date | string, Date | string>;`;
|
|
17
|
+
return `${leader}\n${result}`;
|
|
18
|
+
};
|
|
19
|
+
exports.generateFile = generateFile;
|
|
20
|
+
//# sourceMappingURL=generateFile.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generateFile.js","sourceRoot":"","sources":["../../src/helpers/generateFile.ts"],"names":[],"mappings":";;;;;;AAAA,4DAA4B;AAE5B,MAAM,OAAO,GAAG,oBAAE,CAAC,aAAa,CAAC,EAAE,OAAO,EAAE,oBAAE,CAAC,WAAW,CAAC,QAAQ,EAAE,CAAC,CAAC;AAEhE,MAAM,YAAY,GAAG,CAAC,UAAmC,EAAE,EAAE;IAClE,MAAM,IAAI,GAAG,oBAAE,CAAC,OAAO,CAAC,gBAAgB,CACtC,UAAU,EACV,oBAAE,CAAC,OAAO,CAAC,WAAW,CAAC,oBAAE,CAAC,UAAU,CAAC,cAAc,CAAC,EACpD,oBAAE,CAAC,SAAS,CAAC,IAAI,CAClB,CAAC;IAEF,MAAM,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IAEvC,MAAM,MAAM,GAAG;;;;wEAIuD,CAAC;IAEvE,OAAO,GAAG,MAAM,KAAK,MAAM,EAAE,CAAC;AAChC,CAAC,CAAC;AAhBW,QAAA,YAAY,gBAgBvB"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.generateImplicitManyToManyModels = exports.getModelByType = void 0;
|
|
4
|
+
const sorted_1 = require("../utils/sorted");
|
|
5
|
+
const getModelByType = (models, type) => {
|
|
6
|
+
return models.find((model) => model.name === type);
|
|
7
|
+
};
|
|
8
|
+
exports.getModelByType = getModelByType;
|
|
9
|
+
function generateImplicitManyToManyModels(models) {
|
|
10
|
+
const manyToManyFields = filterManyToManyRelationFields(models);
|
|
11
|
+
if (manyToManyFields.length === 0) {
|
|
12
|
+
return [];
|
|
13
|
+
}
|
|
14
|
+
return generateModels(manyToManyFields, models, []);
|
|
15
|
+
}
|
|
16
|
+
exports.generateImplicitManyToManyModels = generateImplicitManyToManyModels;
|
|
17
|
+
function generateModels(manyToManyFields, models, manyToManyTables = []) {
|
|
18
|
+
const manyFirst = manyToManyFields.shift();
|
|
19
|
+
if (!manyFirst) {
|
|
20
|
+
return manyToManyTables;
|
|
21
|
+
}
|
|
22
|
+
const manySecond = manyToManyFields.find((field) => field.relationName === manyFirst.relationName);
|
|
23
|
+
if (!manySecond) {
|
|
24
|
+
return manyToManyTables;
|
|
25
|
+
}
|
|
26
|
+
manyToManyTables.push({
|
|
27
|
+
dbName: null,
|
|
28
|
+
name: (manyFirst === null || manyFirst === void 0 ? void 0 : manyFirst.relationName) || "",
|
|
29
|
+
primaryKey: null,
|
|
30
|
+
uniqueFields: [],
|
|
31
|
+
uniqueIndexes: [],
|
|
32
|
+
fields: generateJoinFields([manyFirst, manySecond], models),
|
|
33
|
+
});
|
|
34
|
+
return generateModels(manyToManyFields.filter((field) => field.relationName !== manyFirst.relationName), models, manyToManyTables);
|
|
35
|
+
}
|
|
36
|
+
function generateJoinFields(fields, models) {
|
|
37
|
+
if (fields.length !== 2)
|
|
38
|
+
throw new Error("Huh?");
|
|
39
|
+
const sortedFields = (0, sorted_1.sorted)(fields, (a, b) => a.name.localeCompare(b.name));
|
|
40
|
+
const A = sortedFields[0];
|
|
41
|
+
const B = sortedFields[1];
|
|
42
|
+
return [
|
|
43
|
+
{
|
|
44
|
+
name: "A",
|
|
45
|
+
type: getJoinIdType(A, models),
|
|
46
|
+
kind: "scalar",
|
|
47
|
+
isRequired: true,
|
|
48
|
+
isList: false,
|
|
49
|
+
isUnique: false,
|
|
50
|
+
isId: false,
|
|
51
|
+
isReadOnly: true,
|
|
52
|
+
hasDefaultValue: false,
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
name: "B",
|
|
56
|
+
type: getJoinIdType(B, models),
|
|
57
|
+
kind: "scalar",
|
|
58
|
+
isRequired: true,
|
|
59
|
+
isList: false,
|
|
60
|
+
isUnique: false,
|
|
61
|
+
isId: false,
|
|
62
|
+
isReadOnly: true,
|
|
63
|
+
hasDefaultValue: false,
|
|
64
|
+
},
|
|
65
|
+
];
|
|
66
|
+
}
|
|
67
|
+
function getJoinIdType(joinField, models) {
|
|
68
|
+
const joinIdField = models
|
|
69
|
+
.filter((model) => model.name === joinField.type)
|
|
70
|
+
.map((model) => model.fields.find((field) => field.name === joinField.relationToFields[0]))[0];
|
|
71
|
+
return joinIdField.type;
|
|
72
|
+
}
|
|
73
|
+
function filterManyToManyRelationFields(models) {
|
|
74
|
+
return models
|
|
75
|
+
.map((model) => model.fields
|
|
76
|
+
.filter((field) => {
|
|
77
|
+
var _a, _b;
|
|
78
|
+
return field.relationName &&
|
|
79
|
+
field.isList &&
|
|
80
|
+
((_a = field.relationFromFields) === null || _a === void 0 ? void 0 : _a.length) === 0 &&
|
|
81
|
+
((_b = field.relationToFields) === null || _b === void 0 ? void 0 : _b.length);
|
|
82
|
+
})
|
|
83
|
+
.map((field) => field))
|
|
84
|
+
.flat();
|
|
85
|
+
}
|
|
86
|
+
//# sourceMappingURL=generateImplicitManyToManyModels.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generateImplicitManyToManyModels.js","sourceRoot":"","sources":["../../src/helpers/generateImplicitManyToManyModels.ts"],"names":[],"mappings":";;;AAAA,4CAAyC;AAYlC,MAAM,cAAc,GAAG,CAC5B,MAAoB,EACpB,IAAY,EACY,EAAE;IAC1B,OAAO,MAAM,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;AACrD,CAAC,CAAC;AALW,QAAA,cAAc,kBAKzB;AAEF,SAAgB,gCAAgC,CAC9C,MAAoB;IAEpB,MAAM,gBAAgB,GAAG,8BAA8B,CAAC,MAAM,CAAC,CAAC;IAChE,IAAI,gBAAgB,CAAC,MAAM,KAAK,CAAC,EAAE;QACjC,OAAO,EAAE,CAAC;KACX;IACD,OAAO,cAAc,CAAC,gBAAgB,EAAE,MAAM,EAAE,EAAE,CAAC,CAAC;AACtD,CAAC;AARD,4EAQC;AAED,SAAS,cAAc,CACrB,gBAA8B,EAC9B,MAAoB,EACpB,mBAAiC,EAAE;IAEnC,MAAM,SAAS,GAAG,gBAAgB,CAAC,KAAK,EAAE,CAAC;IAC3C,IAAI,CAAC,SAAS,EAAE;QACd,OAAO,gBAAgB,CAAC;KACzB;IAED,MAAM,UAAU,GAAG,gBAAgB,CAAC,IAAI,CACtC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,YAAY,KAAK,SAAS,CAAC,YAAY,CACzD,CAAC;IAEF,IAAI,CAAC,UAAU,EAAE;QACf,OAAO,gBAAgB,CAAC;KAC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C,EAAE,MAAM,CAAC;YAC9B,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE,IAAI;YAChB,MAAM,EAAE,KAAK;YACb,QAAQ,EAAE,KAAK;YACf,IAAI,EAAE,KAAK;YACX,UAAU,EAAE,IAAI;YAChB,eAAe,EAAE,KAAK;SACvB;KACF,CAAC;AACJ,CAAC;AAED,SAAS,aAAa,CAAC,SAAqB,EAAE,MAAoB;IAChE,MAAM,WAAW,GAAG,MAAM;SACvB,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,KAAK,SAAS,CAAC,IAAI,CAAC;SAChD,GAAG,CACF,CAAC,KAAK,EAAE,EAAE,CACR,KAAK,CAAC,MAAM,CAAC,IAAI,CACf,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,KAAK,SAAS,CAAC,gBAAiB,CAAC,CAAC,CAAC,CACxD,CACL,CAAC,CAAC,CAAC,CAAC;IAEP,OAAO,WAAW,CAAC,IAAI,CAAC;AAC1B,CAAC;AAED,SAAS,8BAA8B,CAAC,MAAoB;IAC1D,OAAO,MAAM;SACV,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CACb,KAAK,CAAC,MAAM;SACT,MAAM,CACL,CAAC,KAAK,EAAE,EAAE;;QACR,OAAA,KAAK,CAAC,YAAY;YAClB,KAAK,CAAC,MAAM;YACZ,CAAA,MAAA,KAAK,CAAC,kBAAkB,0CAAE,MAAM,MAAK,CAAC;aACtC,MAAA,KAAK,CAAC,gBAAgB,0CAAE,MAAM,CAAA,CAAA;KAAA,CACjC;SACA,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,CACzB;SACA,IAAI,EAAE,CAAC;AACZ,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.generateModel = void 0;
|
|
7
|
+
const generateField_1 = require("./generateField");
|
|
8
|
+
const generateFieldType_1 = require("./generateFieldType");
|
|
9
|
+
const typescript_1 = __importDefault(require("typescript"));
|
|
10
|
+
const defaultTypesImplementedInJS = ["cuid", "uuid"];
|
|
11
|
+
const generateModel = (model, config) => {
|
|
12
|
+
const properties = model.fields.flatMap((field) => {
|
|
13
|
+
if (field.kind === "object" || field.kind === "unsupported")
|
|
14
|
+
return [];
|
|
15
|
+
if (field.kind === "enum")
|
|
16
|
+
return (0, generateField_1.generateField)(field.name, typescript_1.default.factory.createTypeReferenceNode(typescript_1.default.factory.createIdentifier(field.type), undefined), !field.isRequired, field.hasDefaultValue && !field.isId, field.isList);
|
|
17
|
+
const isGenerated = field.hasDefaultValue &&
|
|
18
|
+
!(typeof field.default === "object" &&
|
|
19
|
+
"name" in field.default &&
|
|
20
|
+
defaultTypesImplementedInJS.includes(field.default.name));
|
|
21
|
+
return (0, generateField_1.generateField)(field.name, typescript_1.default.factory.createTypeReferenceNode(typescript_1.default.factory.createIdentifier((0, generateFieldType_1.generateFieldType)(field.type, config)), undefined), !field.isRequired, isGenerated, field.isList);
|
|
22
|
+
});
|
|
23
|
+
return {
|
|
24
|
+
name: model.name,
|
|
25
|
+
definition: typescript_1.default.factory.createTypeAliasDeclaration(undefined, [typescript_1.default.factory.createModifier(typescript_1.default.SyntaxKind.ExportKeyword)], typescript_1.default.factory.createIdentifier(model.name), undefined, typescript_1.default.factory.createTypeLiteralNode(properties)),
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
exports.generateModel = generateModel;
|
|
29
|
+
//# sourceMappingURL=generateModel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generateModel.js","sourceRoot":"","sources":["../../src/helpers/generateModel.ts"],"names":[],"mappings":";;;;;;AACA,mDAAgD;AAChD,2DAAwD;AAExD,4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QAChB,UAAU,EAAE,oBAAE,CAAC,OAAO,CAAC,0BAA0B,CAC/C,SAAS,EACT,CAAC,oBAAE,CAAC,OAAO,CAAC,cAAc,CAAC,oBAAE,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC,EACxD,oBAAE,CAAC,OAAO,CAAC,gBAAgB,CAAC,KAAK,CAAC,IAAI,CAAC,EACvC,SAAS,EACT,oBAAE,CAAC,OAAO,CAAC,qBAAqB,CAAC,UAAU,CAAC,CAC7C;KACF,CAAC;AACJ,CAAC,CAAC;AA7CW,QAAA,aAAa,iBA6CxB"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.generateStringLiteralUnion = void 0;
|
|
7
|
+
const typescript_1 = __importDefault(require("typescript"));
|
|
8
|
+
const generateStringLiteralUnion = (stringLiterals) => {
|
|
9
|
+
if (stringLiterals.length === 0)
|
|
10
|
+
return null;
|
|
11
|
+
if (stringLiterals.length === 1)
|
|
12
|
+
return typescript_1.default.factory.createLiteralTypeNode(typescript_1.default.factory.createStringLiteral(stringLiterals[0]));
|
|
13
|
+
return typescript_1.default.factory.createUnionTypeNode(stringLiterals.map((literal) => typescript_1.default.factory.createLiteralTypeNode(typescript_1.default.factory.createStringLiteral(literal))));
|
|
14
|
+
};
|
|
15
|
+
exports.generateStringLiteralUnion = generateStringLiteralUnion;
|
|
16
|
+
//# sourceMappingURL=generateStringLiteralUnion.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generateStringLiteralUnion.js","sourceRoot":"","sources":["../../src/helpers/generateStringLiteralUnion.ts"],"names":[],"mappings":";;;;;;AAAA,4DAA4B;AAErB,MAAM,0BAA0B,GAAG,CAAC,cAAwB,EAAE,EAAE;IACrE,IAAI,cAAc,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IAC7C,IAAI,cAAc,CAAC,MAAM,KAAK,CAAC;QAC7B,OAAO,oBAAE,CAAC,OAAO,CAAC,qBAAqB,CACrC,oBAAE,CAAC,OAAO,CAAC,mBAAmB,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAClD,CAAC;IACJ,OAAO,oBAAE,CAAC,OAAO,CAAC,mBAAmB,CACnC,cAAc,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAC7B,oBAAE,CAAC,OAAO,CAAC,qBAAqB,CAAC,oBAAE,CAAC,OAAO,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAC,CAC1E,CACF,CAAC;AACJ,CAAC,CAAC;AAXW,QAAA,0BAA0B,8BAWrC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.generateTypedAliasDeclaration = void 0;
|
|
7
|
+
const typescript_1 = __importDefault(require("typescript"));
|
|
8
|
+
const generateTypedAliasDeclaration = (name, type) => {
|
|
9
|
+
return typescript_1.default.factory.createTypeAliasDeclaration(undefined, [typescript_1.default.factory.createModifier(typescript_1.default.SyntaxKind.ExportKeyword)], typescript_1.default.factory.createIdentifier(name), undefined, type);
|
|
10
|
+
};
|
|
11
|
+
exports.generateTypedAliasDeclaration = generateTypedAliasDeclaration;
|
|
12
|
+
//# sourceMappingURL=generateTypedAliasDeclaration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generateTypedAliasDeclaration.js","sourceRoot":"","sources":["../../src/helpers/generateTypedAliasDeclaration.ts"],"names":[],"mappings":";;;;;;AAAA,4DAA4B;AAErB,MAAM,6BAA6B,GAAG,CAC3C,IAAY,EACZ,IAAiB,EACjB,EAAE;IACF,OAAO,oBAAE,CAAC,OAAO,CAAC,0BAA0B,CAC1C,SAAS,EACT,CAAC,oBAAE,CAAC,OAAO,CAAC,cAAc,CAAC,oBAAE,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC,EACxD,oBAAE,CAAC,OAAO,CAAC,gBAAgB,CAAC,IAAI,CAAC,EACjC,SAAS,EACT,IAAI,CACL,CAAC;AACJ,CAAC,CAAC;AAXW,QAAA,6BAA6B,iCAWxC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.formatFile = void 0;
|
|
27
|
+
const formatFile = async (content) => {
|
|
28
|
+
try {
|
|
29
|
+
const { default: prettier } = await Promise.resolve().then(() => __importStar(require("prettier")));
|
|
30
|
+
const config = await prettier.resolveConfig(process.cwd());
|
|
31
|
+
if (!config)
|
|
32
|
+
return content;
|
|
33
|
+
const formatted = prettier.format(content, {
|
|
34
|
+
...config,
|
|
35
|
+
parser: "typescript",
|
|
36
|
+
});
|
|
37
|
+
return formatted;
|
|
38
|
+
}
|
|
39
|
+
catch (e) { }
|
|
40
|
+
return content;
|
|
41
|
+
};
|
|
42
|
+
exports.formatFile = formatFile;
|
|
43
|
+
//# sourceMappingURL=formatFile.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatFile.js","sourceRoot":"","sources":["../../src/utils/formatFile.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAO,MAAM,UAAU,GAAG,KAAK,EAAE,OAAe,EAAE,EAAE;IAIlD,IAAI;QACF,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,wDAAa,UAAU,GAAC,CAAC;QAEvD,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;QAC3D,IAAI,CAAC,MAAM;YAAE,OAAO,OAAO,CAAC;QAE5B,MAAM,SAAS,GAAG,QAAQ,CAAC,MAAM,CAAC,OAAO,EAAE;YACzC,GAAG,MAAM;YACT,MAAM,EAAE,YAAY;SACrB,CAAC,CAAC;QAEH,OAAO,SAAS,CAAC;KAClB;IAAC,OAAO,CAAC,EAAE,GAAE;IAEd,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AAnBW,QAAA,UAAU,cAmBrB"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.sorted = void 0;
|
|
4
|
+
const sorted = (list, sortFunction) => {
|
|
5
|
+
const newList = [...list];
|
|
6
|
+
newList.sort(sortFunction);
|
|
7
|
+
return newList;
|
|
8
|
+
};
|
|
9
|
+
exports.sorted = sorted;
|
|
10
|
+
//# sourceMappingURL=sorted.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sorted.js","sourceRoot":"","sources":["../../src/utils/sorted.ts"],"names":[],"mappings":";;;AAAO,MAAM,MAAM,GAAG,CAAI,IAAS,EAAE,YAAqC,EAAE,EAAE;IAC5E,MAAM,OAAO,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC;IAC1B,OAAO,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IAC3B,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AAJW,QAAA,MAAM,UAIjB"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.validateConfig = exports.configValidator = void 0;
|
|
7
|
+
const sdk_1 = require("@prisma/sdk");
|
|
8
|
+
const zod_1 = __importDefault(require("zod"));
|
|
9
|
+
exports.configValidator = zod_1.default
|
|
10
|
+
.object({
|
|
11
|
+
databaseProvider: zod_1.default.union([
|
|
12
|
+
zod_1.default.literal("postgresql"),
|
|
13
|
+
zod_1.default.literal("mysql"),
|
|
14
|
+
zod_1.default.literal("sqlite"),
|
|
15
|
+
]),
|
|
16
|
+
fileName: zod_1.default.string().optional().default("types.ts"),
|
|
17
|
+
stringTypeOverride: zod_1.default.string().optional(),
|
|
18
|
+
booleanTypeOverride: zod_1.default.string().optional(),
|
|
19
|
+
intTypeOverride: zod_1.default.string().optional(),
|
|
20
|
+
bigIntTypeOverride: zod_1.default.string().optional(),
|
|
21
|
+
floatTypeOverride: zod_1.default.string().optional(),
|
|
22
|
+
decimalTypeOverride: zod_1.default.string().optional(),
|
|
23
|
+
dateTimeTypeOverride: zod_1.default.string().optional(),
|
|
24
|
+
jsonTypeOverride: zod_1.default.string().optional(),
|
|
25
|
+
bytesTypeOverride: zod_1.default.string().optional(),
|
|
26
|
+
unsupportedTypeOverride: zod_1.default.string().optional(),
|
|
27
|
+
})
|
|
28
|
+
.strict();
|
|
29
|
+
const validateConfig = (config) => {
|
|
30
|
+
const parsed = exports.configValidator.safeParse(config);
|
|
31
|
+
if (!parsed.success) {
|
|
32
|
+
sdk_1.logger.error("Invalid prisma-kysely config");
|
|
33
|
+
Object.entries(parsed.error.flatten().fieldErrors).forEach(([key, value]) => {
|
|
34
|
+
sdk_1.logger.error(`${key}: ${value.join(", ")}`);
|
|
35
|
+
});
|
|
36
|
+
Object.values(parsed.error.flatten().formErrors).forEach((value) => {
|
|
37
|
+
sdk_1.logger.error(`${value}`);
|
|
38
|
+
});
|
|
39
|
+
process.exit(1);
|
|
40
|
+
}
|
|
41
|
+
return parsed.data;
|
|
42
|
+
};
|
|
43
|
+
exports.validateConfig = validateConfig;
|
|
44
|
+
//# sourceMappingURL=validateConfig.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validateConfig.js","sourceRoot":"","sources":["../../src/utils/validateConfig.ts"],"names":[],"mappings":";;;;;;AAAA,qCAAqC;AACrC,8CAAoB;AAEP,QAAA,eAAe,GAAG,aAAC;KAC7B,MAAM,CAAC;IAEN,gBAAgB,EAAE,aAAC,CAAC,KAAK,CAAC;QACxB,aAAC,CAAC,OAAO,CAAC,YAAY,CAAC;QACvB,aAAC,CAAC,OAAO,CAAC,OAAO,CAAC;QAClB,aAAC,CAAC,OAAO,CAAC,QAAQ,CAAC;KACpB,CAAC;IAGF,QAAQ,EAAE,aAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,UAAU,CAAC;IAGnD,kBAAkB,EAAE,aAAC,CAAC,MAAM,EAAE,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E,EAAE;YACjE,YAAM,CAAC,KAAK,CAAC,GAAG,KAAK,EAAE,CAAC,CAAC;QAC3B,CAAC,CAAC,CAAC;QACH,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;KACjB;IACD,OAAO,MAAM,CAAC,IAAI,CAAC;AACrB,CAAC,CAAC;AAfW,QAAA,cAAc,kBAezB"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.writeFileSafelyWithoutFormatting = exports.writeFileSafely = void 0;
|
|
7
|
+
const formatFile_1 = require("./formatFile");
|
|
8
|
+
const fs_1 = __importDefault(require("fs"));
|
|
9
|
+
const path_1 = __importDefault(require("path"));
|
|
10
|
+
const writeFileSafely = async (writeLocation, content) => {
|
|
11
|
+
fs_1.default.mkdirSync(path_1.default.dirname(writeLocation), {
|
|
12
|
+
recursive: true,
|
|
13
|
+
});
|
|
14
|
+
fs_1.default.writeFileSync(writeLocation, await (0, formatFile_1.formatFile)(content));
|
|
15
|
+
};
|
|
16
|
+
exports.writeFileSafely = writeFileSafely;
|
|
17
|
+
const writeFileSafelyWithoutFormatting = async (writeLocation, content) => {
|
|
18
|
+
fs_1.default.mkdirSync(path_1.default.dirname(writeLocation), {
|
|
19
|
+
recursive: true,
|
|
20
|
+
});
|
|
21
|
+
fs_1.default.writeFileSync(writeLocation, content);
|
|
22
|
+
};
|
|
23
|
+
exports.writeFileSafelyWithoutFormatting = writeFileSafelyWithoutFormatting;
|
|
24
|
+
//# sourceMappingURL=writeFileSafely.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"writeFileSafely.js","sourceRoot":"","sources":["../../src/utils/writeFileSafely.ts"],"names":[],"mappings":";;;;;;AAAA,6CAA0C;AAC1C,4CAAoB;AACpB,gDAAwB;AAEjB,MAAM,eAAe,GAAG,KAAK,EAClC,aAAqB,EACrB,OAAe,EACf,EAAE;IACF,YAAE,CAAC,SAAS,CAAC,cAAI,CAAC,OAAO,CAAC,aAAa,CAAC,EAAE;QACxC,SAAS,EAAE,IAAI;KAChB,CAAC,CAAC;IAEH,YAAE,CAAC,aAAa,CAAC,aAAa,EAAE,MAAM,IAAA,uBAAU,EAAC,OAAO,CAAC,CAAC,CAAC;AAC7D,CAAC,CAAC;AATW,QAAA,eAAe,mBAS1B;AAEK,MAAM,gCAAgC,GAAG,KAAK,EACnD,aAAqB,EACrB,OAAe,EACf,EAAE;IACF,YAAE,CAAC,SAAS,CAAC,cAAI,CAAC,OAAO,CAAC,aAAa,CAAC,EAAE;QACxC,SAAS,EAAE,IAAI;KAChB,CAAC,CAAC;IAEH,YAAE,CAAC,aAAa,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;AAC3C,CAAC,CAAC;AATW,QAAA,gCAAgC,oCAS3C"}
|
package/package.json
CHANGED
package/.eslintrc.json
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"parser": "@typescript-eslint/parser",
|
|
3
|
-
"parserOptions": {
|
|
4
|
-
"project": "./tsconfig.json"
|
|
5
|
-
},
|
|
6
|
-
"plugins": ["@typescript-eslint"],
|
|
7
|
-
"extends": ["plugin:@typescript-eslint/recommended"],
|
|
8
|
-
"rules": {
|
|
9
|
-
"@typescript-eslint/consistent-type-imports": "warn"
|
|
10
|
-
}
|
|
11
|
-
}
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
const core = require('@actions/core');
|
|
2
|
-
const github = require('@actions/github');
|
|
3
|
-
const splitEmoji = require('emoji-aware').split;
|
|
4
|
-
const onlyEmoji = require('emoji-aware').onlyEmoji;
|
|
5
|
-
|
|
6
|
-
async function run() {
|
|
7
|
-
try {
|
|
8
|
-
const token = core.getInput('repo-token');
|
|
9
|
-
const { owner, repo } = github.context.repo;
|
|
10
|
-
|
|
11
|
-
const prNumber = getPrNumber();
|
|
12
|
-
|
|
13
|
-
if (!prNumber) {
|
|
14
|
-
core.setFailed('Could not get pull request number from context');
|
|
15
|
-
return;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
const octokit = github.getOctokit(token);
|
|
19
|
-
|
|
20
|
-
const response = await octokit.rest.pulls.get({
|
|
21
|
-
owner,
|
|
22
|
-
repo,
|
|
23
|
-
pull_number: prNumber,
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
const prTitle = response.data.title;
|
|
27
|
-
|
|
28
|
-
if (hasEmoji(prTitle)) {
|
|
29
|
-
return;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
const newTitle = addEmoji(prTitle);
|
|
33
|
-
|
|
34
|
-
await octokit.rest.pulls.update({
|
|
35
|
-
owner,
|
|
36
|
-
repo,
|
|
37
|
-
pull_number: prNumber,
|
|
38
|
-
title: newTitle,
|
|
39
|
-
});
|
|
40
|
-
} catch (error) {
|
|
41
|
-
console.error(error);
|
|
42
|
-
core.setFailed(error.messsage);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
function getPrNumber() {
|
|
47
|
-
const pullRequest = github.context.payload.pull_request;
|
|
48
|
-
|
|
49
|
-
if (!pullRequest) {
|
|
50
|
-
return undefined;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
return pullRequest.number;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
function hasEmoji(text) {
|
|
57
|
-
const currentEmoji = onlyEmoji(text);
|
|
58
|
-
return currentEmoji.length !== 0;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
function addEmoji(text) {
|
|
62
|
-
const result = emojiArray[Math.floor(Math.random() * emojiArray.length)];
|
|
63
|
-
if (!result) return text.trim();
|
|
64
|
-
return `${result} ${text.trim()}`;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
const emojiPool =
|
|
68
|
-
'🪵🪵🪵😬🙌😅🌄😎⚡️🧠🧠🧠✨✨✨✨✨🦓🦓🦓🤷♂️🤷♂️🤷♂️🤷♂️🍄🍄🍄🪁🪁🪁🪁👩🍳👌🦷🦷🦷🚧🚧🚧🚧💽💽💽💽💽🐓🐓🐓🐓🍽😼🤙🤙🫂😏😏🤪🤨🤬🤬🤬😤😎🥵🥶😶🌫️😑🤮🤠🤠🤠🤐😵💫🥴😈😈💩💩💩👻🤡🤡🤡🤡🤡👺☠️💀💀💀🤖🎃🙌🤌🦾🖕🖕🖕🦵🙏🙏🙏🦻🦻🫀🗣🕵️♀️👷♂️👨🔧🧛♂️🧟♀️👼👼👼👼🕺🕺🕺🕺🕺🧑🦽🧑🦼🧵🪢🪢🪢🪡🪡🧢🧢🧢🥾👟👡👠🩴🧣🥽🥽🥽🌂👓👛🐸🐸🐶🐱🐭🐹🐰🦊🐻🐼🐻❄️🐨🐯🦁🐮🐷🐽🐵🙈🙉🙊🐒🐔🐔🐔🐔🐧🐦🐤🐣🐥🦆🦆🦆🦅🦅🦅🦅🦉🦇🐺🐗🐴🦄🐝🪱🪱🪱🐛🦋🐌🐞🐜🪰🪰🪲🪳🦟🦗🕸🦂🐢🐍🦎🦖🦖🦖🦕🐙🦑🦑🦑🦑🦐🦞🦀🐠🐟🐬🐳🐋🦈🦭🐊🐅🐆🦓🦍🦧🦧🦧🦧🦣🐘🦛🦏🐪🐫🦒🦘🦬🐃🐂🐄🐎🐖🐏🐑🦙🐐🦌🐕🐩🦮🐕🦺🐈🐈⬛🪶🐓🦃🦤🦚🦚🦚🦜🦜🦜🦢🦩🕊🐇🦝🦨🦡🦫🦦🦦🦦🦥🐁🐀🐿🦔🦔🦔🐲🐉🌵🌵🌵🎄🌳🍀🎍🍁🌷💐🌾🪨🐚🌹🥀🌺🌸🌼🌻🌞🌝🌛🌚🌕🌖🌗🌘🌑🌒🌓🌔🌙🌎🌍🌏🪐🪐🪐🪐☄️⚡️✨💥🔥🔥🔥🔥🔥🌪🌈🌈🌈🌈🌈☀️☃️🌬☔️☂️🍏🍎🍐🍊🍋🍋🍋🍌🍉🍇🍓🫐🫐🫐🫐🍈🍒🍑🥭🍍🥥🥝🍅🍆🥑🥦🥬🥒🌶🫑🌽🥕🫒🫒🧄🧅🥔🍠🥐🥯🥯🥯🍞🥖🥨🧀🥚🍳🍳🍳🍳🧈🥞🧇🥓🥩🥩🍗🍖🦴🌭🍔🍟🍕🫓🥪🥙🧆🌮🌯🫔🥗🥘🥫🍝🍜🍲🍛🍣🍱🥟🦪🍤🍤🍤🍙🍘🍥🥠🥮🍢🍨🍦🥧🧁🍰🎂🍮🍭🍬🍫🍿🍩🍪🌰🥜🍯🥛🫖🍵🧋🍺🍺🍺🍺🍺🍻🥂🍷🥃🍸🍹🧉🍾🍾🍾🍾🧊🥄🧂🥡🥢⚽️🏈🥎🎾🏐🏉🥏🎱🪀🏓🏓🏓🏓🏸🏸🏸🏒🏑🥍🏏🪃⛳️🎣🤿🤿🤿🥊🥋🎽🛹🛼🛷🪂🏂⛷🎿🥌⛸⛹️♂️🤼🏋️♂️🤸♂️🤺🤺🤺🤾🏇🏄♂️🚣🥇🥈🥈🥈🥈🥉🥉🥉🥉🥉🥉🥉🥉🏅🎖🩰🎺🎺🎺🎷🥁🪗🪗🪗🎸🪕🎻🎲🎯♟🎳🎰🚗🚕🚙🚌🏎🚓🚑🚐🛻🚚🚛🚜🛵🚲🚨🚨🚨🚨🚨🚨🚨🛺🚠🚟🚃🚋🚞🚝🚄🚅🚈🚂🚇🚊🚉✈️🛫🛬🛩💺🛰🚀🚀🚀🚀🚀🚁⛵️🚤🛥🛳🚢⚓️🪝⛽️🚦🗺🚏🗼🗽🗿🏰🏯🏟🎡🎢🎠⛲️⛱🏖🏝🏜⛰🗻🏕⛺️🛖🏠🏡🏚🏭🏣🏤🏪🏫🏩💒🏛⛪️🕌🕍🛕🕋⛩🛤🗾🎑🌅🌠🎇🎆🌇🌆🌃🌌🌉🌁⌚️📲💻⌨️🖥🖱🖲🗜💽💾📼🎥☎️📞📟📠📺📻⏰⏳🔌🔌🔌🔌🔌💡💡💡💡🔦🕯🪔🧯🧯🧯🧯🛢💸💸💸💵💴💶💷🪙💰💳💎💎💎💎⚖️🪜🧰🪛🔨🔧⚒🛠🪚🔩⚙️🪤🪤🪤🪤🪤🧱⛓🧲💣🧨🪓🔪🗡⚔️🛡🚬🚬🚬🚬🚬⚰️⚱️🏺🔮📿🧿💈⚗️🔭🔬🕳🕳🕳🩺💊💉🩸🧬🦠🦠🦠🦠🧫🧫🧫🧪🧪🌡🧹🪠🧺🚽🚽🚽🚽🚽🚰🚿🛁🪥🛀🧽🪣🧴🧴🧴🛎🔑🛏🧸🧸🚪🗝🖼🪟🛍🪆🎁🎈🎈🎈🎈🎏🪅🪅🪅🎉🎊🪄🪄🪄🎎🏮🎐🧧📧💌📦📭📬📪📫📮📯📜📃📑📊📈📉🗒🗓📅🗑📇🗃🗳📋🗞📰📓📔📒📕📗📚📖🔖🧷🔗📎🖇📐📏📌📍✂️🖊🖋✒️🖌📝✏️🔎❤️🧡💛💚💜🖤🤍❤️🔥❤️🔥❤️🔥❤️🔥❤️🔥❤️🩹❣️💕💞💓💗💖💖💖💘💝🔞🔞🔞🔞🚭🚷🚯🚳🚱💯💮♻️⚜️🚾🚾🚾♿️🆒🆗👁🗨🔊♥️📢🏴☠️🏳️🌈🏳️🌈🏳️🌈🇦🇽🇦🇽🇦🇽🇦🇽🇦🇽🇳🇵🇮🇸🇺🇦🇸🇪🕴';
|
|
69
|
-
const emojiArray = splitEmoji(emojiPool);
|
|
70
|
-
|
|
71
|
-
run();
|
|
@@ -1,214 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "pretty-pr-action",
|
|
3
|
-
"version": "1.0.0",
|
|
4
|
-
"lockfileVersion": 1,
|
|
5
|
-
"requires": true,
|
|
6
|
-
"dependencies": {
|
|
7
|
-
"@actions/core": {
|
|
8
|
-
"version": "1.8.0",
|
|
9
|
-
"resolved": "https://registry.npmjs.org/@actions/core/-/core-1.8.0.tgz",
|
|
10
|
-
"integrity": "sha512-XirM+Zo/PFlA+1h+i4bkfvagujta+LIM2AOSzPbt8JqXbbuxb1HTB+FqIyaKmue9yiCx/JIJY6pXsOl3+T8JGw==",
|
|
11
|
-
"requires": {
|
|
12
|
-
"@actions/http-client": "^1.0.11"
|
|
13
|
-
}
|
|
14
|
-
},
|
|
15
|
-
"@actions/github": {
|
|
16
|
-
"version": "5.0.1",
|
|
17
|
-
"resolved": "https://registry.npmjs.org/@actions/github/-/github-5.0.1.tgz",
|
|
18
|
-
"integrity": "sha512-JZGyPM9ektb8NVTTI/2gfJ9DL7Rk98tQ7OVyTlgTuaQroariRBsOnzjy0I2EarX4xUZpK88YyO503fhmjFdyAg==",
|
|
19
|
-
"requires": {
|
|
20
|
-
"@actions/http-client": "^1.0.11",
|
|
21
|
-
"@octokit/core": "^3.6.0",
|
|
22
|
-
"@octokit/plugin-paginate-rest": "^2.17.0",
|
|
23
|
-
"@octokit/plugin-rest-endpoint-methods": "^5.13.0"
|
|
24
|
-
}
|
|
25
|
-
},
|
|
26
|
-
"@actions/http-client": {
|
|
27
|
-
"version": "1.0.11",
|
|
28
|
-
"resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-1.0.11.tgz",
|
|
29
|
-
"integrity": "sha512-VRYHGQV1rqnROJqdMvGUbY/Kn8vriQe/F9HR2AlYHzmKuM/p3kjNuXhmdBfcVgsvRWTz5C5XW5xvndZrVBuAYg==",
|
|
30
|
-
"requires": {
|
|
31
|
-
"tunnel": "0.0.6"
|
|
32
|
-
}
|
|
33
|
-
},
|
|
34
|
-
"@octokit/auth-token": {
|
|
35
|
-
"version": "2.5.0",
|
|
36
|
-
"resolved": "https://registry.npmjs.org/@octokit/auth-token/-/auth-token-2.5.0.tgz",
|
|
37
|
-
"integrity": "sha512-r5FVUJCOLl19AxiuZD2VRZ/ORjp/4IN98Of6YJoJOkY75CIBuYfmiNHGrDwXr+aLGG55igl9QrxX3hbiXlLb+g==",
|
|
38
|
-
"requires": {
|
|
39
|
-
"@octokit/types": "^6.0.3"
|
|
40
|
-
}
|
|
41
|
-
},
|
|
42
|
-
"@octokit/core": {
|
|
43
|
-
"version": "3.6.0",
|
|
44
|
-
"resolved": "https://registry.npmjs.org/@octokit/core/-/core-3.6.0.tgz",
|
|
45
|
-
"integrity": "sha512-7RKRKuA4xTjMhY+eG3jthb3hlZCsOwg3rztWh75Xc+ShDWOfDDATWbeZpAHBNRpm4Tv9WgBMOy1zEJYXG6NJ7Q==",
|
|
46
|
-
"requires": {
|
|
47
|
-
"@octokit/auth-token": "^2.4.4",
|
|
48
|
-
"@octokit/graphql": "^4.5.8",
|
|
49
|
-
"@octokit/request": "^5.6.3",
|
|
50
|
-
"@octokit/request-error": "^2.0.5",
|
|
51
|
-
"@octokit/types": "^6.0.3",
|
|
52
|
-
"before-after-hook": "^2.2.0",
|
|
53
|
-
"universal-user-agent": "^6.0.0"
|
|
54
|
-
}
|
|
55
|
-
},
|
|
56
|
-
"@octokit/endpoint": {
|
|
57
|
-
"version": "6.0.12",
|
|
58
|
-
"resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-6.0.12.tgz",
|
|
59
|
-
"integrity": "sha512-lF3puPwkQWGfkMClXb4k/eUT/nZKQfxinRWJrdZaJO85Dqwo/G0yOC434Jr2ojwafWJMYqFGFa5ms4jJUgujdA==",
|
|
60
|
-
"requires": {
|
|
61
|
-
"@octokit/types": "^6.0.3",
|
|
62
|
-
"is-plain-object": "^5.0.0",
|
|
63
|
-
"universal-user-agent": "^6.0.0"
|
|
64
|
-
}
|
|
65
|
-
},
|
|
66
|
-
"@octokit/graphql": {
|
|
67
|
-
"version": "4.8.0",
|
|
68
|
-
"resolved": "https://registry.npmjs.org/@octokit/graphql/-/graphql-4.8.0.tgz",
|
|
69
|
-
"integrity": "sha512-0gv+qLSBLKF0z8TKaSKTsS39scVKF9dbMxJpj3U0vC7wjNWFuIpL/z76Qe2fiuCbDRcJSavkXsVtMS6/dtQQsg==",
|
|
70
|
-
"requires": {
|
|
71
|
-
"@octokit/request": "^5.6.0",
|
|
72
|
-
"@octokit/types": "^6.0.3",
|
|
73
|
-
"universal-user-agent": "^6.0.0"
|
|
74
|
-
}
|
|
75
|
-
},
|
|
76
|
-
"@octokit/openapi-types": {
|
|
77
|
-
"version": "11.2.0",
|
|
78
|
-
"resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-11.2.0.tgz",
|
|
79
|
-
"integrity": "sha512-PBsVO+15KSlGmiI8QAzaqvsNlZlrDlyAJYcrXBCvVUxCp7VnXjkwPoFHgjEJXx3WF9BAwkA6nfCUA7i9sODzKA=="
|
|
80
|
-
},
|
|
81
|
-
"@octokit/plugin-paginate-rest": {
|
|
82
|
-
"version": "2.17.0",
|
|
83
|
-
"resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-2.17.0.tgz",
|
|
84
|
-
"integrity": "sha512-tzMbrbnam2Mt4AhuyCHvpRkS0oZ5MvwwcQPYGtMv4tUa5kkzG58SVB0fcsLulOZQeRnOgdkZWkRUiyBlh0Bkyw==",
|
|
85
|
-
"requires": {
|
|
86
|
-
"@octokit/types": "^6.34.0"
|
|
87
|
-
}
|
|
88
|
-
},
|
|
89
|
-
"@octokit/plugin-rest-endpoint-methods": {
|
|
90
|
-
"version": "5.13.0",
|
|
91
|
-
"resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-5.13.0.tgz",
|
|
92
|
-
"integrity": "sha512-uJjMTkN1KaOIgNtUPMtIXDOjx6dGYysdIFhgA52x4xSadQCz3b/zJexvITDVpANnfKPW/+E0xkOvLntqMYpviA==",
|
|
93
|
-
"requires": {
|
|
94
|
-
"@octokit/types": "^6.34.0",
|
|
95
|
-
"deprecation": "^2.3.1"
|
|
96
|
-
}
|
|
97
|
-
},
|
|
98
|
-
"@octokit/request": {
|
|
99
|
-
"version": "5.6.3",
|
|
100
|
-
"resolved": "https://registry.npmjs.org/@octokit/request/-/request-5.6.3.tgz",
|
|
101
|
-
"integrity": "sha512-bFJl0I1KVc9jYTe9tdGGpAMPy32dLBXXo1dS/YwSCTL/2nd9XeHsY616RE3HPXDVk+a+dBuzyz5YdlXwcDTr2A==",
|
|
102
|
-
"requires": {
|
|
103
|
-
"@octokit/endpoint": "^6.0.1",
|
|
104
|
-
"@octokit/request-error": "^2.1.0",
|
|
105
|
-
"@octokit/types": "^6.16.1",
|
|
106
|
-
"is-plain-object": "^5.0.0",
|
|
107
|
-
"node-fetch": "^2.6.7",
|
|
108
|
-
"universal-user-agent": "^6.0.0"
|
|
109
|
-
}
|
|
110
|
-
},
|
|
111
|
-
"@octokit/request-error": {
|
|
112
|
-
"version": "2.1.0",
|
|
113
|
-
"resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-2.1.0.tgz",
|
|
114
|
-
"integrity": "sha512-1VIvgXxs9WHSjicsRwq8PlR2LR2x6DwsJAaFgzdi0JfJoGSO8mYI/cHJQ+9FbN21aa+DrgNLnwObmyeSC8Rmpg==",
|
|
115
|
-
"requires": {
|
|
116
|
-
"@octokit/types": "^6.0.3",
|
|
117
|
-
"deprecation": "^2.0.0",
|
|
118
|
-
"once": "^1.4.0"
|
|
119
|
-
}
|
|
120
|
-
},
|
|
121
|
-
"@octokit/types": {
|
|
122
|
-
"version": "6.34.0",
|
|
123
|
-
"resolved": "https://registry.npmjs.org/@octokit/types/-/types-6.34.0.tgz",
|
|
124
|
-
"integrity": "sha512-s1zLBjWhdEI2zwaoSgyOFoKSl109CUcVBCc7biPJ3aAf6LGLU6szDvi31JPU7bxfla2lqfhjbbg/5DdFNxOwHw==",
|
|
125
|
-
"requires": {
|
|
126
|
-
"@octokit/openapi-types": "^11.2.0"
|
|
127
|
-
}
|
|
128
|
-
},
|
|
129
|
-
"before-after-hook": {
|
|
130
|
-
"version": "2.2.2",
|
|
131
|
-
"resolved": "https://registry.npmjs.org/before-after-hook/-/before-after-hook-2.2.2.tgz",
|
|
132
|
-
"integrity": "sha512-3pZEU3NT5BFUo/AD5ERPWOgQOCZITni6iavr5AUw5AUwQjMlI0kzu5btnyD39AF0gUEsDPwJT+oY1ORBJijPjQ=="
|
|
133
|
-
},
|
|
134
|
-
"deprecation": {
|
|
135
|
-
"version": "2.3.1",
|
|
136
|
-
"resolved": "https://registry.npmjs.org/deprecation/-/deprecation-2.3.1.tgz",
|
|
137
|
-
"integrity": "sha512-xmHIy4F3scKVwMsQ4WnVaS8bHOx0DmVwRywosKhaILI0ywMDWPtBSku2HNxRvF7jtwDRsoEwYQSfbxj8b7RlJQ=="
|
|
138
|
-
},
|
|
139
|
-
"emoji-aware": {
|
|
140
|
-
"version": "3.1.0",
|
|
141
|
-
"resolved": "https://registry.npmjs.org/emoji-aware/-/emoji-aware-3.1.0.tgz",
|
|
142
|
-
"integrity": "sha512-YMXaS6nqEhS3SyVkGIeLvj5qmn9xEIl4fgYcN49MUdR9GfCzkmPBslxkO6AB5lKagnmWp2B0QtPWik41kPWGag==",
|
|
143
|
-
"requires": {
|
|
144
|
-
"lodash.flattendeep": "^4.4.0",
|
|
145
|
-
"parsimmon": "^1.18.1"
|
|
146
|
-
}
|
|
147
|
-
},
|
|
148
|
-
"is-plain-object": {
|
|
149
|
-
"version": "5.0.0",
|
|
150
|
-
"resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-5.0.0.tgz",
|
|
151
|
-
"integrity": "sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q=="
|
|
152
|
-
},
|
|
153
|
-
"lodash.flattendeep": {
|
|
154
|
-
"version": "4.4.0",
|
|
155
|
-
"resolved": "https://registry.npmjs.org/lodash.flattendeep/-/lodash.flattendeep-4.4.0.tgz",
|
|
156
|
-
"integrity": "sha1-+wMJF/hqMTTlvJvsDWngAT3f7bI="
|
|
157
|
-
},
|
|
158
|
-
"node-fetch": {
|
|
159
|
-
"version": "2.6.7",
|
|
160
|
-
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz",
|
|
161
|
-
"integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==",
|
|
162
|
-
"requires": {
|
|
163
|
-
"whatwg-url": "^5.0.0"
|
|
164
|
-
}
|
|
165
|
-
},
|
|
166
|
-
"once": {
|
|
167
|
-
"version": "1.4.0",
|
|
168
|
-
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
|
|
169
|
-
"integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=",
|
|
170
|
-
"requires": {
|
|
171
|
-
"wrappy": "1"
|
|
172
|
-
}
|
|
173
|
-
},
|
|
174
|
-
"parsimmon": {
|
|
175
|
-
"version": "1.18.1",
|
|
176
|
-
"resolved": "https://registry.npmjs.org/parsimmon/-/parsimmon-1.18.1.tgz",
|
|
177
|
-
"integrity": "sha512-u7p959wLfGAhJpSDJVYXoyMCXWYwHia78HhRBWqk7AIbxdmlrfdp5wX0l3xv/iTSH5HvhN9K7o26hwwpgS5Nmw=="
|
|
178
|
-
},
|
|
179
|
-
"tr46": {
|
|
180
|
-
"version": "0.0.3",
|
|
181
|
-
"resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz",
|
|
182
|
-
"integrity": "sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o="
|
|
183
|
-
},
|
|
184
|
-
"tunnel": {
|
|
185
|
-
"version": "0.0.6",
|
|
186
|
-
"resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.6.tgz",
|
|
187
|
-
"integrity": "sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg=="
|
|
188
|
-
},
|
|
189
|
-
"universal-user-agent": {
|
|
190
|
-
"version": "6.0.0",
|
|
191
|
-
"resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-6.0.0.tgz",
|
|
192
|
-
"integrity": "sha512-isyNax3wXoKaulPDZWHQqbmIx1k2tb9fb3GGDBRxCscfYV2Ch7WxPArBsFEG8s/safwXTT7H4QGhaIkTp9447w=="
|
|
193
|
-
},
|
|
194
|
-
"webidl-conversions": {
|
|
195
|
-
"version": "3.0.1",
|
|
196
|
-
"resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz",
|
|
197
|
-
"integrity": "sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE="
|
|
198
|
-
},
|
|
199
|
-
"whatwg-url": {
|
|
200
|
-
"version": "5.0.0",
|
|
201
|
-
"resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz",
|
|
202
|
-
"integrity": "sha1-lmRU6HZUYuN2RNNib2dCzotwll0=",
|
|
203
|
-
"requires": {
|
|
204
|
-
"tr46": "~0.0.3",
|
|
205
|
-
"webidl-conversions": "^3.0.0"
|
|
206
|
-
}
|
|
207
|
-
},
|
|
208
|
-
"wrappy": {
|
|
209
|
-
"version": "1.0.2",
|
|
210
|
-
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
|
|
211
|
-
"integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8="
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "pretty-pr-action",
|
|
3
|
-
"version": "1.0.0",
|
|
4
|
-
"description": "",
|
|
5
|
-
"main": "index.js",
|
|
6
|
-
"scripts": {
|
|
7
|
-
"test": "echo \"Error: no test specified\" && exit 1",
|
|
8
|
-
"compile": "npx @vercel/ncc build index.js"
|
|
9
|
-
},
|
|
10
|
-
"keywords": [],
|
|
11
|
-
"author": "",
|
|
12
|
-
"license": "ISC",
|
|
13
|
-
"dependencies": {
|
|
14
|
-
"@actions/core": "^1.8.0",
|
|
15
|
-
"@actions/github": "^5.0.1",
|
|
16
|
-
"emoji-aware": "^3.1.0"
|
|
17
|
-
}
|
|
18
|
-
}
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
name: 😵💫 Sanity checks
|
|
2
|
-
on:
|
|
3
|
-
pull_request:
|
|
4
|
-
types: [opened, synchronize]
|
|
5
|
-
push:
|
|
6
|
-
branches:
|
|
7
|
-
- main
|
|
8
|
-
|
|
9
|
-
jobs:
|
|
10
|
-
test:
|
|
11
|
-
name: 🧪 Tests
|
|
12
|
-
runs-on: ubuntu-latest
|
|
13
|
-
permissions:
|
|
14
|
-
contents: read
|
|
15
|
-
steps:
|
|
16
|
-
- name: 🏗 Setup repo
|
|
17
|
-
uses: actions/checkout@v2
|
|
18
|
-
|
|
19
|
-
- name: 🏗 Setup Node
|
|
20
|
-
uses: actions/setup-node@v2
|
|
21
|
-
with:
|
|
22
|
-
node-version: 16.x
|
|
23
|
-
cache: yarn
|
|
24
|
-
|
|
25
|
-
- name: 📦 Install dependencies
|
|
26
|
-
run: yarn install
|
|
27
|
-
|
|
28
|
-
- name: 🧪 Run tests
|
|
29
|
-
run: yarn run test
|
|
30
|
-
|
|
31
|
-
typecheck:
|
|
32
|
-
name: 🤓 Type checker
|
|
33
|
-
runs-on: ubuntu-latest
|
|
34
|
-
permissions:
|
|
35
|
-
contents: read
|
|
36
|
-
steps:
|
|
37
|
-
- name: 🏗 Setup repo
|
|
38
|
-
uses: actions/checkout@v2
|
|
39
|
-
|
|
40
|
-
- name: 🏗 Setup Node
|
|
41
|
-
uses: actions/setup-node@v2
|
|
42
|
-
with:
|
|
43
|
-
node-version: 16.x
|
|
44
|
-
cache: yarn
|
|
45
|
-
|
|
46
|
-
- name: 📦 Install dependencies
|
|
47
|
-
run: yarn install
|
|
48
|
-
|
|
49
|
-
- name: 🤓 Run type checker
|
|
50
|
-
run: yarn run typecheck
|
|
51
|
-
|
|
52
|
-
lint:
|
|
53
|
-
name: 👮♂️ Linters and formatters
|
|
54
|
-
runs-on: ubuntu-latest
|
|
55
|
-
permissions:
|
|
56
|
-
checks: write # Allow creating checks
|
|
57
|
-
contents: read
|
|
58
|
-
steps:
|
|
59
|
-
- name: 🏗 Setup repo
|
|
60
|
-
uses: actions/checkout@v2
|
|
61
|
-
|
|
62
|
-
- name: 🏗 Setup Node
|
|
63
|
-
uses: actions/setup-node@v2
|
|
64
|
-
with:
|
|
65
|
-
node-version: 16.x
|
|
66
|
-
cache: yarn
|
|
67
|
-
|
|
68
|
-
- name: 📦 Install dependencies
|
|
69
|
-
run: yarn install
|
|
70
|
-
|
|
71
|
-
- name: 👮♂️ Run linters
|
|
72
|
-
run: yarn run lint
|
|
73
|
-
|
|
74
|
-
- name: 💅 Run fixers, and check diff
|
|
75
|
-
id: diffCheck
|
|
76
|
-
run: yarn run fix && git diff --exit-code -- ':!yarn.lock'
|
|
77
|
-
|
|
78
|
-
- name: 💬 Post a check explaining the issue
|
|
79
|
-
if: ${{ failure() && steps.diffCheck.conclusion == 'failure' }}
|
|
80
|
-
uses: LouisBrunner/checks-action@v1.1.1
|
|
81
|
-
with:
|
|
82
|
-
token: ${{ secrets.GITHUB_TOKEN }}
|
|
83
|
-
name: 🧹 Check all files are formatted correctly
|
|
84
|
-
conclusion: failure
|
|
85
|
-
output: |
|
|
86
|
-
{"summary": "Hrm, seems like you don't have prettier set up properly. Make sure your editor is configured to format code automatically, and that it respects the project's prettier config. [Click here](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) to view the Prettier extension for VS Code.\n\n> _**💡 Tip:**_ \n> \n> In the meantime you can run `npm run fix` and commit the changes."}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
name: 💖 PR Polish
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
pull_request:
|
|
5
|
-
types: [opened, edited]
|
|
6
|
-
branches:
|
|
7
|
-
- '**'
|
|
8
|
-
|
|
9
|
-
jobs:
|
|
10
|
-
pretty-prs:
|
|
11
|
-
name: 💅 Yassify PR
|
|
12
|
-
runs-on: ubuntu-20.04
|
|
13
|
-
steps:
|
|
14
|
-
- uses: actions/checkout@v2
|
|
15
|
-
with:
|
|
16
|
-
fetch-depth: 0
|
|
17
|
-
- name: Yassify PR name
|
|
18
|
-
uses: ./.github/actions/pretty-pr
|
|
19
|
-
with:
|
|
20
|
-
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
name: 📦 Publish Package to NPM
|
|
2
|
-
on:
|
|
3
|
-
release:
|
|
4
|
-
types: [published]
|
|
5
|
-
jobs:
|
|
6
|
-
build:
|
|
7
|
-
name: 📦 Build and publish
|
|
8
|
-
runs-on: ubuntu-latest
|
|
9
|
-
steps:
|
|
10
|
-
- uses: actions/checkout@v3
|
|
11
|
-
# Setup .npmrc file to publish to npm
|
|
12
|
-
- uses: actions/setup-node@v3
|
|
13
|
-
with:
|
|
14
|
-
node-version: "16.x"
|
|
15
|
-
registry-url: "https://registry.npmjs.org"
|
|
16
|
-
- run: yarn
|
|
17
|
-
- run: yarn build
|
|
18
|
-
- run: yarn publish
|
|
19
|
-
env:
|
|
20
|
-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
package/.prettierignore
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
prisma/generated/*
|
package/build.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
const esbuild = require('esbuild');
|
|
2
|
-
|
|
3
|
-
console.time('⭐ Built Kysely Prisma generator');
|
|
4
|
-
esbuild.build({
|
|
5
|
-
entryPoints: ['src/bin.ts'],
|
|
6
|
-
bundle: true,
|
|
7
|
-
outfile: 'dist/bin.js',
|
|
8
|
-
platform: 'node',
|
|
9
|
-
packages: 'external',
|
|
10
|
-
});
|
|
11
|
-
console.timeLog('⭐ Built Kysely Prisma generator');
|