prisma-effect-kysely 1.5.2 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +54 -0
- package/dist/effect/enum.d.ts.map +1 -1
- package/dist/effect/enum.js +8 -11
- package/dist/effect/enum.js.map +1 -1
- package/dist/effect/generator.d.ts +2 -2
- package/dist/effect/generator.d.ts.map +1 -1
- package/dist/effect/generator.js +18 -15
- package/dist/effect/generator.js.map +1 -1
- package/dist/effect/join-table.d.ts.map +1 -1
- package/dist/effect/join-table.js +17 -11
- package/dist/effect/join-table.js.map +1 -1
- package/dist/generator/index.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,60 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [1.6.0] - 2025-10-12
|
|
9
|
+
|
|
10
|
+
### Changed
|
|
11
|
+
|
|
12
|
+
- **BREAKING: TypeScript Namespace Pattern for Complete Name Preservation**
|
|
13
|
+
- **Zero name transformations** - All user-declared names from Prisma schema are preserved exactly throughout the generated code
|
|
14
|
+
- **Enums**: Now use TypeScript namespace pattern instead of suffix pattern
|
|
15
|
+
- Before v1.6.0: `ACTIVE_STATUS` enum generated `ACTIVE_STATUSSchema` and `ACTIVE_STATUSType` (awkward)
|
|
16
|
+
- v1.6.0+: Uses namespace merging for clean API:
|
|
17
|
+
```typescript
|
|
18
|
+
export enum ACTIVE_STATUS { ACTIVE, INACTIVE }
|
|
19
|
+
export namespace ACTIVE_STATUS {
|
|
20
|
+
export const Schema = Schema.Enums(ACTIVE_STATUS);
|
|
21
|
+
export type Type = Schema.Schema.Type<typeof Schema>;
|
|
22
|
+
}
|
|
23
|
+
// Usage: ACTIVE_STATUS.ACTIVE, ACTIVE_STATUS.Schema, ACTIVE_STATUS.Type
|
|
24
|
+
```
|
|
25
|
+
- **Models**: Operational schemas and type exports moved into namespaces
|
|
26
|
+
- Before v1.6.0: `export const User = getSchemas(_User)`, `export type UserSelect = ...`
|
|
27
|
+
- v1.6.0+: Everything grouped in namespace:
|
|
28
|
+
```typescript
|
|
29
|
+
export namespace User {
|
|
30
|
+
const schemas = getSchemas(_User);
|
|
31
|
+
export const Selectable = schemas.Selectable;
|
|
32
|
+
export const Insertable = schemas.Insertable;
|
|
33
|
+
export const Updateable = schemas.Updateable;
|
|
34
|
+
export type Select = Schema.Schema.Type<typeof User.Selectable>;
|
|
35
|
+
export type Insert = Schema.Schema.Type<typeof User.Insertable>;
|
|
36
|
+
// ...
|
|
37
|
+
}
|
|
38
|
+
```
|
|
39
|
+
- **Join Tables**: Same namespace pattern for consistency
|
|
40
|
+
- **No PascalCase conversion**: `session_model_preference` stays `session_model_preference` (not converted to `SessionModelPreference`)
|
|
41
|
+
- **Benefits**:
|
|
42
|
+
- ✨ Complete bridge from Prisma → Effect → Kysely → TypeScript with stable names
|
|
43
|
+
- ✨ No naming conflicts without transformations
|
|
44
|
+
- ✨ Cleaner API with grouped related exports
|
|
45
|
+
- ✨ User's Prisma schema names are the source of truth
|
|
46
|
+
- **Migration Guide**:
|
|
47
|
+
- Enum access: `ACTIVE_STATUSSchema` → `ACTIVE_STATUS.Schema`, `ACTIVE_STATUSType` → `ACTIVE_STATUS.Type`
|
|
48
|
+
- Model operational schemas: `User.Selectable` stays the same (namespace merging)
|
|
49
|
+
- Type imports: `UserSelect` → `User.Select`, `UserInsert` → `User.Insert`, etc.
|
|
50
|
+
- Encoded types: `UserSelectEncoded` → `User.SelectEncoded`, etc.
|
|
51
|
+
|
|
52
|
+
## [1.5.3] - 2025-10-12
|
|
53
|
+
|
|
54
|
+
### Changed
|
|
55
|
+
|
|
56
|
+
- **BREAKING**: Enum names now preserve original Prisma schema naming instead of converting to PascalCase
|
|
57
|
+
- If your enum is `UserRole` in Prisma, it stays `UserRole` in generated code
|
|
58
|
+
- If your enum is `user_role` in Prisma, it stays `user_role` (no longer converted to `UserRole`)
|
|
59
|
+
- This ensures generated TypeScript enums match your Prisma schema exactly
|
|
60
|
+
- **Migration**: If you were relying on automatic PascalCase conversion, you'll need to update your enum references
|
|
61
|
+
|
|
8
62
|
## [1.5.2] - 2025-10-12
|
|
9
63
|
|
|
10
64
|
### Added
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enum.d.ts","sourceRoot":"","sources":["../../src/effect/enum.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAKrD;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,IAAI,CAAC,aAAa,
|
|
1
|
+
{"version":3,"file":"enum.d.ts","sourceRoot":"","sources":["../../src/effect/enum.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAKrD;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,IAAI,CAAC,aAAa,UAqB7D;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,SAAS,IAAI,CAAC,aAAa,EAAE,UAMrE"}
|
package/dist/effect/enum.js
CHANGED
|
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.generateEnumSchema = generateEnumSchema;
|
|
4
4
|
exports.generateEnumsFile = generateEnumsFile;
|
|
5
5
|
const enum_1 = require("../prisma/enum");
|
|
6
|
-
const naming_1 = require("../utils/naming");
|
|
7
6
|
const codegen_1 = require("../utils/codegen");
|
|
8
7
|
/**
|
|
9
8
|
* Generate TypeScript enum + Effect Schema.Enums wrapper
|
|
@@ -16,26 +15,24 @@ const codegen_1 = require("../utils/codegen");
|
|
|
16
15
|
* - Type alias for convenience
|
|
17
16
|
*/
|
|
18
17
|
function generateEnumSchema(enumDef) {
|
|
19
|
-
//
|
|
20
|
-
const enumName =
|
|
21
|
-
|
|
22
|
-
const typeName = `${enumName}Type`;
|
|
23
|
-
// Generate native TypeScript enum members (Tests 1-2)
|
|
18
|
+
// Preserve original enum name from Prisma schema
|
|
19
|
+
const enumName = enumDef.name;
|
|
20
|
+
// Generate native TypeScript enum members
|
|
24
21
|
const enumMembers = enumDef.values
|
|
25
22
|
.map((v) => {
|
|
26
23
|
const value = (0, enum_1.getEnumValueDbName)(v);
|
|
27
24
|
return ` ${v.name} = "${value}"`;
|
|
28
25
|
})
|
|
29
26
|
.join(",\n");
|
|
30
|
-
// Generate: enum +
|
|
31
|
-
// Explicitly NOT using Schema.Literal (Test 6)
|
|
27
|
+
// Generate: enum + namespace with Schema and Type
|
|
32
28
|
return `export enum ${enumName} {
|
|
33
29
|
${enumMembers}
|
|
34
30
|
}
|
|
35
31
|
|
|
36
|
-
export
|
|
37
|
-
|
|
38
|
-
export type
|
|
32
|
+
export namespace ${enumName} {
|
|
33
|
+
export const Schema = Schema.Enums(${enumName});
|
|
34
|
+
export type Type = Schema.Schema.Type<typeof Schema>;
|
|
35
|
+
}`;
|
|
39
36
|
}
|
|
40
37
|
/**
|
|
41
38
|
* Generate all enum schemas as a single file content
|
package/dist/effect/enum.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enum.js","sourceRoot":"","sources":["../../src/effect/enum.ts"],"names":[],"mappings":";;AAeA,
|
|
1
|
+
{"version":3,"file":"enum.js","sourceRoot":"","sources":["../../src/effect/enum.ts"],"names":[],"mappings":";;AAeA,gDAqBC;AAKD,8CAMC;AA9CD,yCAAoD;AAEpD,8CAAsD;AAEtD;;;;;;;;;GASG;AACH,SAAgB,kBAAkB,CAAC,OAA2B;IAC5D,iDAAiD;IACjD,MAAM,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;IAE9B,0CAA0C;IAC1C,MAAM,WAAW,GAAG,OAAO,CAAC,MAAM;SAC/B,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;QACT,MAAM,KAAK,GAAG,IAAA,yBAAkB,EAAC,CAAC,CAAC,CAAC;QACpC,OAAO,KAAK,CAAC,CAAC,IAAI,OAAO,KAAK,GAAG,CAAC;IACpC,CAAC,CAAC;SACD,IAAI,CAAC,KAAK,CAAC,CAAC;IAEf,kDAAkD;IAClD,OAAO,eAAe,QAAQ;EAC9B,WAAW;;;mBAGM,QAAQ;uCACY,QAAQ;;EAE7C,CAAC;AACH,CAAC;AAED;;GAEG;AACH,SAAgB,iBAAiB,CAAC,KAAoC;IACpE,MAAM,MAAM,GAAG,IAAA,4BAAkB,GAAE,CAAC;IACpC,MAAM,OAAO,GAAG,kCAAkC,CAAC;IACnD,MAAM,WAAW,GAAG,KAAK,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAE/D,OAAO,GAAG,MAAM,OAAO,OAAO,OAAO,WAAW,EAAE,CAAC;AACrD,CAAC"}
|
|
@@ -15,11 +15,11 @@ export declare class EffectGenerator {
|
|
|
15
15
|
*/
|
|
16
16
|
generateBaseSchema(model: DMMF.Model, fields: readonly DMMF.Field[]): string;
|
|
17
17
|
/**
|
|
18
|
-
* Generate operational schemas (ModelName.Selectable, etc.)
|
|
18
|
+
* Generate operational schemas as namespace (ModelName.Selectable, etc.)
|
|
19
19
|
*/
|
|
20
20
|
generateOperationalSchemas(model: DMMF.Model): string;
|
|
21
21
|
/**
|
|
22
|
-
* Generate TypeScript type exports
|
|
22
|
+
* Generate TypeScript type exports as namespace
|
|
23
23
|
*/
|
|
24
24
|
generateTypeExports(model: DMMF.Model): string;
|
|
25
25
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../../src/effect/generator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAOrD,OAAO,K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AAE;CAKrD"}
|
package/dist/effect/generator.js
CHANGED
|
@@ -36,28 +36,31 @@ ${fieldDefinitions}
|
|
|
36
36
|
});`;
|
|
37
37
|
}
|
|
38
38
|
/**
|
|
39
|
-
* Generate operational schemas (ModelName.Selectable, etc.)
|
|
39
|
+
* Generate operational schemas as namespace (ModelName.Selectable, etc.)
|
|
40
40
|
*/
|
|
41
41
|
generateOperationalSchemas(model) {
|
|
42
42
|
const baseSchemaName = `_${model.name}`;
|
|
43
|
-
const
|
|
44
|
-
return `export
|
|
43
|
+
const modelName = model.name;
|
|
44
|
+
return `export namespace ${modelName} {
|
|
45
|
+
const schemas = getSchemas(${baseSchemaName});
|
|
46
|
+
export const Selectable = schemas.Selectable;
|
|
47
|
+
export const Insertable = schemas.Insertable;
|
|
48
|
+
export const Updateable = schemas.Updateable;
|
|
49
|
+
}`;
|
|
45
50
|
}
|
|
46
51
|
/**
|
|
47
|
-
* Generate TypeScript type exports
|
|
52
|
+
* Generate TypeScript type exports as namespace
|
|
48
53
|
*/
|
|
49
54
|
generateTypeExports(model) {
|
|
50
|
-
const name =
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
export type
|
|
54
|
-
export type
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
export type
|
|
58
|
-
|
|
59
|
-
export type ${name}UpdateEncoded = Schema.Schema.Encoded<typeof ${name}.Updateable>;`;
|
|
60
|
-
return applicationTypes + encodedTypes;
|
|
55
|
+
const name = model.name;
|
|
56
|
+
return `export namespace ${name} {
|
|
57
|
+
export type Select = Schema.Schema.Type<typeof ${name}.Selectable>;
|
|
58
|
+
export type Insert = Schema.Schema.Type<typeof ${name}.Insertable>;
|
|
59
|
+
export type Update = Schema.Schema.Type<typeof ${name}.Updateable>;
|
|
60
|
+
export type SelectEncoded = Schema.Schema.Encoded<typeof ${name}.Selectable>;
|
|
61
|
+
export type InsertEncoded = Schema.Schema.Encoded<typeof ${name}.Insertable>;
|
|
62
|
+
export type UpdateEncoded = Schema.Schema.Encoded<typeof ${name}.Updateable>;
|
|
63
|
+
}`;
|
|
61
64
|
}
|
|
62
65
|
/**
|
|
63
66
|
* Generate complete model schema (base + operational + types)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generator.js","sourceRoot":"","sources":["../../src/effect/generator.ts"],"names":[],"mappings":";;;AACA,iCAA2C;AAC3C,iCAAwC;AAExC,4CAA+C;AAC/C,8CAAsD;AACtD,6CAAuD;AAGvD;;GAEG;AACH,MAAa,eAAe;IAC1B,YAA6B,IAAmB;QAAnB,SAAI,GAAJ,IAAI,CAAe;IAAG,CAAC;IAEpD;;OAEG;IACH,aAAa,CAAC,KAAoC;QAChD,OAAO,IAAA,wBAAiB,EAAC,KAAK,CAAC,CAAC;IAClC,CAAC;IAED;;OAEG;IACH,kBAAkB,CAAC,KAAiB,EAAE,MAA6B;QACjE,MAAM,gBAAgB,GAAG,MAAM;aAC5B,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;YACb,MAAM,SAAS,GAAG,IAAA,qBAAc,EAAC,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;YACnD,OAAO,KAAK,KAAK,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;QACzC,CAAC,CAAC;aACD,IAAI,CAAC,KAAK,CAAC,CAAC;QAEf,MAAM,cAAc,GAAG,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC;QAExC,OAAO,MAAM,KAAK,CAAC,IAAI;eACZ,cAAc;EAC3B,gBAAgB;IACd,CAAC;IACH,CAAC;IAED;;OAEG;IACH,0BAA0B,CAAC,KAAiB;QAC1C,MAAM,cAAc,GAAG,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC;QACxC,MAAM,
|
|
1
|
+
{"version":3,"file":"generator.js","sourceRoot":"","sources":["../../src/effect/generator.ts"],"names":[],"mappings":";;;AACA,iCAA2C;AAC3C,iCAAwC;AAExC,4CAA+C;AAC/C,8CAAsD;AACtD,6CAAuD;AAGvD;;GAEG;AACH,M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"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAuBxD;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,CACrC,SAAS,EAAE,aAAa,EACxB,IAAI,EAAE,IAAI,CAAC,QAAQ,GAClB,MAAM,
|
|
1
|
+
{"version":3,"file":"join-table.d.ts","sourceRoot":"","sources":["../../src/effect/join-table.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAuBxD;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,CACrC,SAAS,EAAE,aAAa,EACxB,IAAI,EAAE,IAAI,CAAC,QAAQ,GAClB,MAAM,CAqCR"}
|
|
@@ -39,16 +39,22 @@ export const _${relationName} = Schema.Struct({
|
|
|
39
39
|
${columnAField},
|
|
40
40
|
${columnBField},
|
|
41
41
|
});`;
|
|
42
|
-
// Generate operational schemas
|
|
43
|
-
const operationalSchema = `export
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
export
|
|
47
|
-
export
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
export
|
|
51
|
-
export type
|
|
52
|
-
|
|
42
|
+
// Generate operational schemas as namespace
|
|
43
|
+
const operationalSchema = `export namespace ${relationName} {
|
|
44
|
+
const schemas = getSchemas(_${relationName});
|
|
45
|
+
export const Selectable = schemas.Selectable;
|
|
46
|
+
export const Insertable = schemas.Insertable;
|
|
47
|
+
export const Updateable = schemas.Updateable;
|
|
48
|
+
}`;
|
|
49
|
+
// Generate Type exports as namespace
|
|
50
|
+
const typeExports = `export namespace ${relationName} {
|
|
51
|
+
export type Select = Schema.Schema.Type<typeof ${relationName}.Selectable>;
|
|
52
|
+
export type Insert = Schema.Schema.Type<typeof ${relationName}.Insertable>;
|
|
53
|
+
export type Update = Schema.Schema.Type<typeof ${relationName}.Updateable>;
|
|
54
|
+
export type SelectEncoded = Schema.Schema.Encoded<typeof ${relationName}.Selectable>;
|
|
55
|
+
export type InsertEncoded = Schema.Schema.Encoded<typeof ${relationName}.Insertable>;
|
|
56
|
+
export type UpdateEncoded = Schema.Schema.Encoded<typeof ${relationName}.Updateable>;
|
|
57
|
+
}`;
|
|
58
|
+
return `${baseSchema}\n\n${operationalSchema}\n\n${typeExports}`;
|
|
53
59
|
}
|
|
54
60
|
//# sourceMappingURL=join-table.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"join-table.js","sourceRoot":"","sources":["../../src/effect/join-table.ts"],"names":[],"mappings":";;AAiCA,
|
|
1
|
+
{"version":3,"file":"join-table.js","sourceRoot":"","sources":["../../src/effect/join-table.ts"],"names":[],"mappings":";;AAiCA,0DAwCC;AAtED;;;GAGG;AACH,SAAS,aAAa,CACpB,UAAkB,EAClB,MAAe;IAEf,IAAI,UAAU,KAAK,QAAQ,IAAI,MAAM,EAAE,CAAC;QACtC,OAAO,aAAa,CAAC;IACvB,CAAC;IAED,MAAM,SAAS,GAA2B;QACxC,MAAM,EAAE,eAAe;QACvB,GAAG,EAAE,eAAe;QACpB,MAAM,EAAE,eAAe;KACxB,CAAC;IAEF,OAAO,SAAS,CAAC,UAAU,CAAC,IAAI,gBAAgB,CAAC;AACnD,CAAC;AAED;;;;;;;;GAQG;AACH,SAAgB,uBAAuB,CACrC,SAAwB,EACxB,IAAmB;IAEnB,MAAM,EAAE,SAAS,EAAE,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,aAAa,EAAE,aAAa,EAAE,GAAG,SAAS,CAAC;IAEtG,0CAA0C;IAC1C,MAAM,aAAa,GAAG,aAAa,CAAC,WAAW,EAAE,aAAa,CAAC,CAAC;IAChE,MAAM,aAAa,GAAG,aAAa,CAAC,WAAW,EAAE,aAAa,CAAC,CAAC;IAEhE,0EAA0E;IAC1E,MAAM,YAAY,GAAG,mBAAmB,aAAa,+BAA+B,CAAC;IACrF,MAAM,YAAY,GAAG,mBAAmB,aAAa,+BAA+B,CAAC;IAErF,uBAAuB;IACvB,MAAM,UAAU,GAAG,MAAM,SAAS;gBACpB,YAAY;EAC1B,YAAY;EACZ,YAAY;IACV,CAAC;IAEH,4CAA4C;IAC5C,MAAM,iBAAiB,GAAG,oBAAoB,YAAY;gCAC5B,YAAY;;;;EAI1C,CAAC;IAED,qCAAqC;IACrC,MAAM,WAAW,GAAG,oBAAoB,YAAY;mDACH,YAAY;mDACZ,YAAY;mDACZ,YAAY;6DACF,YAAY;6DACZ,YAAY;6DACZ,YAAY;EACvE,CAAC;IAED,OAAO,GAAG,UAAU,OAAO,iBAAiB,OAAO,WAAW,EAAE,CAAC;AACnE,CAAC"}
|
package/dist/generator/index.js
CHANGED
|
@@ -22,7 +22,7 @@ const orchestrator_1 = require("./orchestrator");
|
|
|
22
22
|
__exportStar(require("../kysely/helpers"), exports);
|
|
23
23
|
exports.generator = (0, generator_helper_1.generatorHandler)({
|
|
24
24
|
onManifest: () => ({
|
|
25
|
-
version: '1.
|
|
25
|
+
version: '1.6.0',
|
|
26
26
|
defaultOutput: './generated',
|
|
27
27
|
prettyName: 'Prisma Effect Kysely Generator',
|
|
28
28
|
}),
|