@sentzunhat/zacatl 0.0.20 β 0.0.21
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 +16 -0
- package/build/index.d.ts +1 -0
- package/build/index.d.ts.map +1 -1
- package/build/index.js +1 -0
- package/build/index.js.map +1 -1
- package/build/orm-exports.d.ts +5 -0
- package/build/orm-exports.d.ts.map +1 -0
- package/build/orm-exports.js +3 -0
- package/build/orm-exports.js.map +1 -0
- package/build/service/architecture/infrastructure/orm/adapter-loader.d.ts +5 -0
- package/build/service/architecture/infrastructure/orm/adapter-loader.d.ts.map +1 -0
- package/build/service/architecture/infrastructure/orm/adapter-loader.js +25 -0
- package/build/service/architecture/infrastructure/orm/adapter-loader.js.map +1 -0
- package/build/service/architecture/infrastructure/orm/adapters/mongoose-adapter.d.ts +1 -1
- package/build/service/architecture/infrastructure/orm/adapters/mongoose-adapter.d.ts.map +1 -1
- package/build/service/architecture/infrastructure/orm/adapters/mongoose-adapter.js +2 -4
- package/build/service/architecture/infrastructure/orm/adapters/mongoose-adapter.js.map +1 -1
- package/build/service/architecture/infrastructure/repositories/abstract.d.ts +3 -2
- package/build/service/architecture/infrastructure/repositories/abstract.d.ts.map +1 -1
- package/build/service/architecture/infrastructure/repositories/abstract.js +7 -6
- package/build/service/architecture/infrastructure/repositories/abstract.js.map +1 -1
- package/build/test/tsconfig.tsbuildinfo +1 -1
- package/package.json +50 -7
- package/src/index.ts +3 -0
- package/src/orm-exports.ts +23 -0
- package/src/service/architecture/infrastructure/orm/adapter-loader.ts +52 -0
- package/src/service/architecture/infrastructure/orm/adapters/mongoose-adapter.ts +10 -11
- package/src/service/architecture/infrastructure/repositories/abstract.ts +21 -14
package/README.md
CHANGED
|
@@ -47,6 +47,18 @@ Zacatl is MIT-licensed (permissive). Please donβt use it to harm people.
|
|
|
47
47
|
npm install @sentzunhat/zacatl
|
|
48
48
|
```
|
|
49
49
|
|
|
50
|
+
## π¦ Import Shortcuts (v0.0.21+)
|
|
51
|
+
|
|
52
|
+
```typescript
|
|
53
|
+
// Short imports for better DX
|
|
54
|
+
import { BaseRepository, ORMType } from "@sentzunhat/zacatl/infrastructure";
|
|
55
|
+
import { CustomError } from "@sentzunhat/zacatl/errors";
|
|
56
|
+
import { loadConfig } from "@sentzunhat/zacatl/config";
|
|
57
|
+
|
|
58
|
+
// Or full path (still works)
|
|
59
|
+
import { BaseRepository } from "@sentzunhat/zacatl/build/service/architecture/infrastructure/repositories/abstract";
|
|
60
|
+
```
|
|
61
|
+
|
|
50
62
|
### Hello World HTTP Service
|
|
51
63
|
|
|
52
64
|
```typescript
|
|
@@ -362,3 +374,7 @@ Zacatl is built for developers who value clean architecture, type safety, and te
|
|
|
362
374
|
**Created by**: [Diego Beltran](https://www.linkedin.com/in/diego-beltran)
|
|
363
375
|
**Repository**: https://github.com/sentzunhat/zacatl
|
|
364
376
|
**npm**: https://www.npmjs.com/package/@sentzunhat/zacatl
|
|
377
|
+
|
|
378
|
+
## π€ Acknowledgments
|
|
379
|
+
|
|
380
|
+
This framework was built with assistance from **GitHub Copilot** and friendly ML/LLM models, demonstrating effective human-AI collaboration in software development.
|
package/build/index.d.ts
CHANGED
package/build/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"./src/","sources":["index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,wBAAwB,CAAC;AACvC,cAAc,WAAW,CAAC;AAC1B,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,YAAY,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC/C,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAG/B,cAAc,uCAAuC,CAAC;AAGtD,OAAO,EACL,UAAU,EACV,YAAY,EACZ,cAAc,EACd,YAAY,GACb,MAAM,+CAA+C,CAAC;AACvD,YAAY,EAAE,YAAY,EAAE,MAAM,+CAA+C,CAAC;AAGlF,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACrC,YAAY,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAGpD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,YAAY,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"./src/","sources":["index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,wBAAwB,CAAC;AACvC,cAAc,WAAW,CAAC;AAC1B,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,YAAY,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC/C,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAG/B,cAAc,uCAAuC,CAAC;AAGtD,OAAO,EACL,UAAU,EACV,YAAY,EACZ,cAAc,EACd,YAAY,GACb,MAAM,+CAA+C,CAAC;AACvD,YAAY,EAAE,YAAY,EAAE,MAAM,+CAA+C,CAAC;AAGlF,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACrC,YAAY,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAGpD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,YAAY,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAC;AAGxD,cAAc,eAAe,CAAC"}
|
package/build/index.js
CHANGED
|
@@ -12,4 +12,5 @@ export * from "./service/architecture/infrastructure";
|
|
|
12
12
|
export { ServerType, ServerVendor, DatabaseVendor, HandlersType, } from "./service/architecture/platform/server/server";
|
|
13
13
|
export { container } from "tsyringe";
|
|
14
14
|
export { z } from "zod";
|
|
15
|
+
export * from "./orm-exports";
|
|
15
16
|
//# sourceMappingURL=index.js.map
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"./src/","sources":["index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,wBAAwB,CAAC;AACvC,cAAc,WAAW,CAAC;AAC1B,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAG/B,cAAc,uCAAuC,CAAC;AAGtD,OAAO,EACL,UAAU,EACV,YAAY,EACZ,cAAc,EACd,YAAY,GACb,MAAM,+CAA+C,CAAC;AAIvD,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAIrC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC","sourcesContent":["export * from \"./optionals\";\nexport * from \"./configuration\";\nexport * from \"./utils\";\nexport * from \"./error\";\nexport * from \"./dependency-injection\";\nexport * from \"./service\";\nexport { Service } from \"./service\";\nexport type { ConfigService } from \"./service\";\nexport * from \"./logs\";\nexport * from \"./runtime\";\nexport * from \"./localization\";\n\n// Re-export infrastructure with ORM types\nexport * from \"./service/architecture/infrastructure\";\n\n// Re-export server types for convenience\nexport {\n ServerType,\n ServerVendor,\n DatabaseVendor,\n HandlersType,\n} from \"./service/architecture/platform/server/server\";\nexport type { ConfigServer } from \"./service/architecture/platform/server/server\";\n\n// Re-export commonly used third-party packages\nexport { container } from \"tsyringe\";\nexport type { DependencyContainer } from \"tsyringe\";\n\n// Re-export Zod for validation\nexport { z } from \"zod\";\nexport type { ZodSchema, ZodType, ZodError } from \"zod\";\n\n// Note: TypeScript utility types (Partial, Required, Readonly, etc.)\n// are globally available and don't need re-export\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"./src/","sources":["index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,wBAAwB,CAAC;AACvC,cAAc,WAAW,CAAC;AAC1B,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAG/B,cAAc,uCAAuC,CAAC;AAGtD,OAAO,EACL,UAAU,EACV,YAAY,EACZ,cAAc,EACd,YAAY,GACb,MAAM,+CAA+C,CAAC;AAIvD,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAIrC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,cAAc,eAAe,CAAC","sourcesContent":["export * from \"./optionals\";\nexport * from \"./configuration\";\nexport * from \"./utils\";\nexport * from \"./error\";\nexport * from \"./dependency-injection\";\nexport * from \"./service\";\nexport { Service } from \"./service\";\nexport type { ConfigService } from \"./service\";\nexport * from \"./logs\";\nexport * from \"./runtime\";\nexport * from \"./localization\";\n\n// Re-export infrastructure with ORM types\nexport * from \"./service/architecture/infrastructure\";\n\n// Re-export server types for convenience\nexport {\n ServerType,\n ServerVendor,\n DatabaseVendor,\n HandlersType,\n} from \"./service/architecture/platform/server/server\";\nexport type { ConfigServer } from \"./service/architecture/platform/server/server\";\n\n// Re-export commonly used third-party packages\nexport { container } from \"tsyringe\";\nexport type { DependencyContainer } from \"tsyringe\";\n\n// Re-export Zod for validation\nexport { z } from \"zod\";\nexport type { ZodSchema, ZodType, ZodError } from \"zod\";\n\n// Re-export ORMs (included as dependencies)\nexport * from \"./orm-exports\";\n\n// Note: TypeScript utility types (Partial, Required, Readonly, etc.)\n// are globally available and don't need re-export\n"]}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { default as mongoose, Mongoose, Schema, Model, Document, connect, connection, } from "mongoose";
|
|
2
|
+
export { Sequelize, Model as SequelizeModel, DataTypes, Op } from "sequelize";
|
|
3
|
+
export type { Model as MongooseModel } from "mongoose";
|
|
4
|
+
export type { ModelStatic, Options as SequelizeOptions } from "sequelize";
|
|
5
|
+
//# sourceMappingURL=orm-exports.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"orm-exports.d.ts","sourceRoot":"./src/","sources":["orm-exports.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,OAAO,IAAI,QAAQ,EACnB,QAAQ,EACR,MAAM,EACN,KAAK,EACL,QAAQ,EACR,OAAO,EACP,UAAU,GACX,MAAM,UAAU,CAAC;AAGlB,OAAO,EAAE,SAAS,EAAE,KAAK,IAAI,cAAc,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,WAAW,CAAC;AAG9E,YAAY,EAAE,KAAK,IAAI,aAAa,EAAE,MAAM,UAAU,CAAC;AACvD,YAAY,EAAE,WAAW,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,WAAW,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"orm-exports.js","sourceRoot":"./src/","sources":["orm-exports.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,OAAO,IAAI,QAAQ,EACnB,QAAQ,EACR,MAAM,EACN,KAAK,EACL,QAAQ,EACR,OAAO,EACP,UAAU,GACX,MAAM,UAAU,CAAC;AAGlB,OAAO,EAAE,SAAS,EAAE,KAAK,IAAI,cAAc,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,WAAW,CAAC","sourcesContent":["/**\n * Re-export ORM dependencies for convenience\n * These are included as dependencies (currently) for backward compatibility\n * Future versions may move them to pure peer dependencies\n */\n\n// Mongoose exports - full re-export\nexport {\n default as mongoose,\n Mongoose,\n Schema,\n Model,\n Document,\n connect,\n connection,\n} from \"mongoose\";\n\n// Sequelize exports - full re-export\nexport { Sequelize, Model as SequelizeModel, DataTypes, Op } from \"sequelize\";\n\n// Type-only exports for convenience\nexport type { Model as MongooseModel } from \"mongoose\";\nexport type { ModelStatic, Options as SequelizeOptions } from \"sequelize\";\n"]}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Model } from "sequelize";
|
|
2
|
+
import type { MongooseRepositoryConfig, SequelizeRepositoryConfig, ORMAdapter } from "../repositories/types";
|
|
3
|
+
export declare function loadMongooseAdapter<D, I, O>(config: MongooseRepositoryConfig<D>): ORMAdapter<D, I, O>;
|
|
4
|
+
export declare function loadSequelizeAdapter<D extends Model, I, O>(config: SequelizeRepositoryConfig<D>): ORMAdapter<D, I, O>;
|
|
5
|
+
//# sourceMappingURL=adapter-loader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adapter-loader.d.ts","sourceRoot":"./src/","sources":["service/architecture/infrastructure/orm/adapter-loader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,KAAK,EACV,wBAAwB,EACxB,yBAAyB,EACzB,UAAU,EACX,MAAM,uBAAuB,CAAC;AAM/B,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EACzC,MAAM,EAAE,wBAAwB,CAAC,CAAC,CAAC,GAClC,UAAU,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAerB;AAMD,wBAAgB,oBAAoB,CAAC,CAAC,SAAS,KAAK,EAAE,CAAC,EAAE,CAAC,EACxD,MAAM,EAAE,yBAAyB,CAAC,CAAC,CAAC,GACnC,UAAU,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAerB"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export function loadMongooseAdapter(config) {
|
|
2
|
+
try {
|
|
3
|
+
const adapters = require("./adapters/mongoose-adapter");
|
|
4
|
+
return new adapters.MongooseAdapter(config);
|
|
5
|
+
}
|
|
6
|
+
catch (error) {
|
|
7
|
+
if (error.code === "MODULE_NOT_FOUND") {
|
|
8
|
+
throw new Error("Mongoose is not installed. Install it with: npm install mongoose");
|
|
9
|
+
}
|
|
10
|
+
throw error;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
export function loadSequelizeAdapter(config) {
|
|
14
|
+
try {
|
|
15
|
+
const adapters = require("./adapters/sequelize-adapter");
|
|
16
|
+
return new adapters.SequelizeAdapter(config);
|
|
17
|
+
}
|
|
18
|
+
catch (error) {
|
|
19
|
+
if (error.code === "MODULE_NOT_FOUND") {
|
|
20
|
+
throw new Error("Sequelize is not installed. Install it with: npm install sequelize");
|
|
21
|
+
}
|
|
22
|
+
throw error;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=adapter-loader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adapter-loader.js","sourceRoot":"./src/","sources":["service/architecture/infrastructure/orm/adapter-loader.ts"],"names":[],"mappings":"AAWA,MAAM,UAAU,mBAAmB,CACjC,MAAmC;IAEnC,IAAI,CAAC;QAGH,MAAM,QAAQ,GACZ,OAAO,CAAC,6BAA6B,CAAiD,CAAC;QACzF,OAAO,IAAI,QAAQ,CAAC,eAAe,CAAU,MAAM,CAAC,CAAC;IACvD,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACpB,IAAI,KAAK,CAAC,IAAI,KAAK,kBAAkB,EAAE,CAAC;YACtC,MAAM,IAAI,KAAK,CACb,kEAAkE,CACnE,CAAC;QACJ,CAAC;QACD,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC;AAMD,MAAM,UAAU,oBAAoB,CAClC,MAAoC;IAEpC,IAAI,CAAC;QAGH,MAAM,QAAQ,GACZ,OAAO,CAAC,8BAA8B,CAAkD,CAAC;QAC3F,OAAO,IAAI,QAAQ,CAAC,gBAAgB,CAAU,MAAM,CAAC,CAAC;IACxD,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACpB,IAAI,KAAK,CAAC,IAAI,KAAK,kBAAkB,EAAE,CAAC;YACtC,MAAM,IAAI,KAAK,CACb,oEAAoE,CACrE,CAAC;QACJ,CAAC;QACD,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC","sourcesContent":["import type { Model } from \"sequelize\";\nimport type {\n MongooseRepositoryConfig,\n SequelizeRepositoryConfig,\n ORMAdapter,\n} from \"../repositories/types\";\n\n/**\n * Loads MongooseAdapter dynamically - only when needed\n * Throws helpful error if mongoose is not installed\n */\nexport function loadMongooseAdapter<D, I, O>(\n config: MongooseRepositoryConfig<D>,\n): ORMAdapter<D, I, O> {\n try {\n // Dynamic import - only loads when Mongoose is actually used\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const adapters =\n require(\"./adapters/mongoose-adapter\") as typeof import(\"./adapters/mongoose-adapter\");\n return new adapters.MongooseAdapter<D, I, O>(config);\n } catch (error: any) {\n if (error.code === \"MODULE_NOT_FOUND\") {\n throw new Error(\n \"Mongoose is not installed. Install it with: npm install mongoose\",\n );\n }\n throw error;\n }\n}\n\n/**\n * Loads SequelizeAdapter dynamically - only when needed\n * Throws helpful error if sequelize is not installed\n */\nexport function loadSequelizeAdapter<D extends Model, I, O>(\n config: SequelizeRepositoryConfig<D>,\n): ORMAdapter<D, I, O> {\n try {\n // Dynamic import - only loads when Sequelize is actually used\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const adapters =\n require(\"./adapters/sequelize-adapter\") as typeof import(\"./adapters/sequelize-adapter\");\n return new adapters.SequelizeAdapter<D, I, O>(config);\n } catch (error: any) {\n if (error.code === \"MODULE_NOT_FOUND\") {\n throw new Error(\n \"Sequelize is not installed. Install it with: npm install sequelize\",\n );\n }\n throw error;\n }\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Model as MongooseModel } from "mongoose";
|
|
1
|
+
import type { Model as MongooseModel } from "mongoose";
|
|
2
2
|
import type { MongooseRepositoryConfig, ORMAdapter } from "../../repositories/types";
|
|
3
3
|
export declare class MongooseAdapter<D, I, O> implements ORMAdapter<D, I, O> {
|
|
4
4
|
readonly model: MongooseModel<D>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mongoose-adapter.d.ts","sourceRoot":"./src/","sources":["service/architecture/infrastructure/orm/adapters/mongoose-adapter.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"mongoose-adapter.d.ts","sourceRoot":"./src/","sources":["service/architecture/infrastructure/orm/adapters/mongoose-adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,IAAI,aAAa,EAAE,MAAM,UAAU,CAAC;AAIvD,OAAO,KAAK,EACV,wBAAwB,EACxB,UAAU,EAEX,MAAM,0BAA0B,CAAC;AAWlC,qBAAa,eAAe,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAE,YAAW,UAAU,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;IAClE,SAAgB,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC;IACxC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA8B;gBAEzC,MAAM,EAAE,wBAAwB,CAAC,CAAC,CAAC;IAmBxC,MAAM,CAAC,KAAK,EAAE,OAAO,GAAG,CAAC,GAAG,IAAI;IAoDjC,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC;IASvC,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;IAY7B,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC;IASzD,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC;CAQ5C"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Mongoose } from "mongoose";
|
|
2
2
|
import { v4 as uuidv4 } from "uuid";
|
|
3
3
|
import { container } from "tsyringe";
|
|
4
4
|
export class MongooseAdapter {
|
|
@@ -6,9 +6,7 @@ export class MongooseAdapter {
|
|
|
6
6
|
config;
|
|
7
7
|
constructor(config) {
|
|
8
8
|
this.config = config;
|
|
9
|
-
const mongoose =
|
|
10
|
-
? importedMongoose
|
|
11
|
-
: container.resolve(Mongoose);
|
|
9
|
+
const mongoose = container.resolve(Mongoose);
|
|
12
10
|
const { name, schema } = this.config;
|
|
13
11
|
if (name) {
|
|
14
12
|
this.model = mongoose.model(name, schema);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mongoose-adapter.js","sourceRoot":"./src/","sources":["service/architecture/infrastructure/orm/adapters/mongoose-adapter.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"mongoose-adapter.js","sourceRoot":"./src/","sources":["service/architecture/infrastructure/orm/adapters/mongoose-adapter.ts"],"names":[],"mappings":"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","sourcesContent":["import type { Model as MongooseModel } from \"mongoose\";\nimport { Mongoose } from \"mongoose\";\nimport { v4 as uuidv4 } from \"uuid\";\nimport { container } from \"tsyringe\";\nimport type {\n MongooseRepositoryConfig,\n ORMAdapter,\n LeanWithMeta,\n} from \"../../repositories/types\";\n\n/**\n * MongooseAdapter - Handles Mongoose-specific ORM operations\n *\n * Provides consistent interface for repository layer with:\n * - Document transformation\n * - ID normalization\n * - Timestamp management\n * - Connection instance from DI container\n */\nexport class MongooseAdapter<D, I, O> implements ORMAdapter<D, I, O> {\n public readonly model: MongooseModel<D>;\n private readonly config: MongooseRepositoryConfig<D>;\n\n constructor(config: MongooseRepositoryConfig<D>) {\n this.config = config;\n // Get mongoose instance from DI container - allows per-database configuration\n // Connection strings should be set up before repository instantiation\n const mongoose = container.resolve<Mongoose>(Mongoose);\n\n const { name, schema } = this.config;\n\n if (name) {\n this.model = mongoose.model<D>(name, schema);\n } else {\n this.model = mongoose.model<D>(uuidv4(), schema);\n }\n\n this.model.createCollection();\n this.model.createIndexes();\n this.model.init();\n }\n\n public toLean(input: unknown): O | null {\n if (!input) {\n return null;\n }\n\n let base: LeanWithMeta<O>;\n\n if (\n input &&\n typeof input === \"object\" &&\n \"toObject\" in input &&\n typeof (input as unknown as Record<string, unknown>)[\"toObject\"] ===\n \"function\"\n ) {\n base = (\n input as unknown as {\n toObject: (opt: any) => LeanWithMeta<O>;\n }\n ).toObject({\n virtuals: true,\n }) as LeanWithMeta<O>;\n } else {\n base = input as LeanWithMeta<O>;\n }\n\n const result: O = {\n ...(base as O),\n id:\n typeof base.id === \"string\"\n ? base.id\n : typeof base._id === \"string\"\n ? base._id\n : base._id !== undefined\n ? String(base._id)\n : \"\",\n createdAt:\n base.createdAt instanceof Date\n ? base.createdAt\n : base.createdAt\n ? new Date(base.createdAt as string | number)\n : new Date(),\n updatedAt:\n base.updatedAt instanceof Date\n ? base.updatedAt\n : base.updatedAt\n ? new Date(base.updatedAt as string | number)\n : new Date(),\n } as O;\n\n return result;\n }\n\n async findById(id: string): Promise<O | null> {\n const entity = await this.model\n .findById(id)\n .lean<O>({ virtuals: true })\n .exec();\n\n return this.toLean(entity);\n }\n\n async create(entity: I): Promise<O> {\n const document = await this.model.create(entity as any);\n\n const leanDocument = this.toLean(document);\n\n if (!leanDocument) {\n throw new Error(\"failed to create document\");\n }\n\n return leanDocument;\n }\n\n async update(id: string, update: Partial<I>): Promise<O | null> {\n const entity = await this.model\n .findByIdAndUpdate(id, update as any, { new: true })\n .lean<O>({ virtuals: true })\n .exec();\n\n return this.toLean(entity);\n }\n\n async delete(id: string): Promise<O | null> {\n const entity = await this.model\n .findByIdAndDelete(id)\n .lean<O>({ virtuals: true })\n .exec();\n\n return this.toLean(entity);\n }\n}\n"]}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { Model as MongooseModel } from "mongoose";
|
|
2
|
-
import { ModelStatic } from "sequelize";
|
|
1
|
+
import type { Model as MongooseModel } from "mongoose";
|
|
2
|
+
import type { ModelStatic } from "sequelize";
|
|
3
3
|
import { BaseRepositoryConfig, Repository } from "./types";
|
|
4
4
|
export * from "./types";
|
|
5
5
|
export declare abstract class BaseRepository<D, I, O> implements Repository<D, I, O> {
|
|
6
6
|
private adapter;
|
|
7
|
+
private readonly ormType;
|
|
7
8
|
constructor(config: BaseRepositoryConfig<D>);
|
|
8
9
|
get model(): MongooseModel<D> | ModelStatic<any>;
|
|
9
10
|
isMongoose(): boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"abstract.d.ts","sourceRoot":"./src/","sources":["service/architecture/infrastructure/repositories/abstract.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,IAAI,aAAa,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"abstract.d.ts","sourceRoot":"./src/","sources":["service/architecture/infrastructure/repositories/abstract.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,IAAI,aAAa,EAAE,MAAM,UAAU,CAAC;AACvD,OAAO,KAAK,EAAS,WAAW,EAAE,MAAM,WAAW,CAAC;AACpD,OAAO,EACL,oBAAoB,EACpB,UAAU,EAKX,MAAM,SAAS,CAAC;AAMjB,cAAc,SAAS,CAAC;AA2BxB,8BAAsB,cAAc,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAE,YAAW,UAAU,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;IAC1E,OAAO,CAAC,OAAO,CAAsB;IACrC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAU;gBAEtB,MAAM,EAAE,oBAAoB,CAAC,CAAC,CAAC;IAoB3C,IAAI,KAAK,IAAI,aAAa,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC,GAAG,CAAC,CAE/C;IAEM,UAAU,IAAI,OAAO;IAIrB,WAAW,IAAI,OAAO;IAItB,gBAAgB,IAAI,aAAa,CAAC,CAAC,CAAC;IAOpC,iBAAiB,IAAI,WAAW,CAAC,GAAG,CAAC;IAOrC,MAAM,CAAC,KAAK,EAAE,OAAO,GAAG,CAAC,GAAG,IAAI;IAIjC,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC;IAIvC,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;IAI7B,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC;IAIzD,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC;CAG5C"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { ORMType, } from "./types";
|
|
2
|
-
import {
|
|
3
|
-
import { SequelizeAdapter } from "../orm/adapters/sequelize-adapter";
|
|
2
|
+
import { loadMongooseAdapter, loadSequelizeAdapter, } from "../orm/adapter-loader";
|
|
4
3
|
export * from "./types";
|
|
5
4
|
const isMongooseConfig = (config) => {
|
|
6
5
|
return config.type === ORMType.Mongoose;
|
|
@@ -10,12 +9,14 @@ const isSequelizeConfig = (config) => {
|
|
|
10
9
|
};
|
|
11
10
|
export class BaseRepository {
|
|
12
11
|
adapter;
|
|
12
|
+
ormType;
|
|
13
13
|
constructor(config) {
|
|
14
|
+
this.ormType = config.type;
|
|
14
15
|
if (isMongooseConfig(config)) {
|
|
15
|
-
this.adapter =
|
|
16
|
+
this.adapter = loadMongooseAdapter(config);
|
|
16
17
|
}
|
|
17
18
|
else if (isSequelizeConfig(config)) {
|
|
18
|
-
this.adapter =
|
|
19
|
+
this.adapter = loadSequelizeAdapter(config);
|
|
19
20
|
}
|
|
20
21
|
else {
|
|
21
22
|
const exhaustive = config;
|
|
@@ -26,10 +27,10 @@ export class BaseRepository {
|
|
|
26
27
|
return this.adapter.model;
|
|
27
28
|
}
|
|
28
29
|
isMongoose() {
|
|
29
|
-
return this.
|
|
30
|
+
return this.ormType === ORMType.Mongoose;
|
|
30
31
|
}
|
|
31
32
|
isSequelize() {
|
|
32
|
-
return this.
|
|
33
|
+
return this.ormType === ORMType.Sequelize;
|
|
33
34
|
}
|
|
34
35
|
getMongooseModel() {
|
|
35
36
|
if (!this.isMongoose()) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"abstract.js","sourceRoot":"./src/","sources":["service/architecture/infrastructure/repositories/abstract.ts"],"names":[],"mappings":"AAEA,OAAO,EAML,OAAO,GACR,MAAM,SAAS,CAAC;AACjB,OAAO,
|
|
1
|
+
{"version":3,"file":"abstract.js","sourceRoot":"./src/","sources":["service/architecture/infrastructure/repositories/abstract.ts"],"names":[],"mappings":"AAEA,OAAO,EAML,OAAO,GACR,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,mBAAmB,EACnB,oBAAoB,GACrB,MAAM,uBAAuB,CAAC;AAE/B,cAAc,SAAS,CAAC;AAKxB,MAAM,gBAAgB,GAAG,CACvB,MAA+B,EACQ,EAAE;IACzC,OAAO,MAAM,CAAC,IAAI,KAAK,OAAO,CAAC,QAAQ,CAAC;AAC1C,CAAC,CAAC;AAKF,MAAM,iBAAiB,GAAG,CACxB,MAA+B,EACS,EAAE;IAC1C,OAAO,MAAM,CAAC,IAAI,KAAK,OAAO,CAAC,SAAS,CAAC;AAC3C,CAAC,CAAC;AASF,MAAM,OAAgB,cAAc;IAC1B,OAAO,CAAsB;IACpB,OAAO,CAAU;IAElC,YAAY,MAA+B;QACzC,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC;QAE3B,IAAI,gBAAgB,CAAI,MAAM,CAAC,EAAE,CAAC;YAChC,IAAI,CAAC,OAAO,GAAG,mBAAmB,CAAU,MAAM,CAAC,CAAC;QACtD,CAAC;aAAM,IAAI,iBAAiB,CAAC,MAAM,CAAC,EAAE,CAAC;YAErC,IAAI,CAAC,OAAO,GAAG,oBAAoB,CAAc,MAAM,CAItD,CAAC;QACJ,CAAC;aAAM,CAAC;YACN,MAAM,UAAU,GAAU,MAAM,CAAC;YACjC,MAAM,IAAI,KAAK,CACb,+CAA+C,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,EAAE,CAC5E,CAAC;QACJ,CAAC;IACH,CAAC;IAED,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC;IAC5B,CAAC;IAEM,UAAU;QACf,OAAO,IAAI,CAAC,OAAO,KAAK,OAAO,CAAC,QAAQ,CAAC;IAC3C,CAAC;IAEM,WAAW;QAChB,OAAO,IAAI,CAAC,OAAO,KAAK,OAAO,CAAC,SAAS,CAAC;IAC5C,CAAC;IAEM,gBAAgB;QACrB,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,EAAE,CAAC;YACvB,MAAM,IAAI,KAAK,CAAC,kCAAkC,CAAC,CAAC;QACtD,CAAC;QACD,OAAO,IAAI,CAAC,OAAO,CAAC,KAAyB,CAAC;IAChD,CAAC;IAEM,iBAAiB;QACtB,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE,CAAC;YACxB,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAC;QACvD,CAAC;QACD,OAAO,IAAI,CAAC,OAAO,CAAC,KAAyB,CAAC;IAChD,CAAC;IAEM,MAAM,CAAC,KAAc;QAC1B,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC;IAED,KAAK,CAAC,QAAQ,CAAC,EAAU;QACvB,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;IACnC,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,MAAS;QACpB,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IACrC,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,EAAU,EAAE,MAAkB;QACzC,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC;IACzC,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,EAAU;QACrB,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IACjC,CAAC;CACF","sourcesContent":["import type { Model as MongooseModel } from \"mongoose\";\nimport type { Model, ModelStatic } from \"sequelize\";\nimport {\n BaseRepositoryConfig,\n Repository,\n MongooseRepositoryConfig,\n SequelizeRepositoryConfig,\n ORMAdapter,\n ORMType,\n} from \"./types\";\nimport {\n loadMongooseAdapter,\n loadSequelizeAdapter,\n} from \"../orm/adapter-loader\";\n\nexport * from \"./types\";\n\n/**\n * Type guard to check if config is for Mongoose\n */\nconst isMongooseConfig = <D>(\n config: BaseRepositoryConfig<D>,\n): config is MongooseRepositoryConfig<D> => {\n return config.type === ORMType.Mongoose;\n};\n\n/**\n * Type guard to check if config is for Sequelize\n */\nconst isSequelizeConfig = <D extends Model>(\n config: BaseRepositoryConfig<D>,\n): config is SequelizeRepositoryConfig<D> => {\n return config.type === ORMType.Sequelize;\n};\n\n/**\n * BaseRepository - Abstract base class for all repositories\n *\n * Supports multiple ORMs (Mongoose, Sequelize) through adapter pattern.\n * Adapters are lazy-loaded - only the ORM you use gets imported.\n * This allows projects to install only one ORM without unused dependencies.\n */\nexport abstract class BaseRepository<D, I, O> implements Repository<D, I, O> {\n private adapter: ORMAdapter<D, I, O>;\n private readonly ormType: ORMType;\n\n constructor(config: BaseRepositoryConfig<D>) {\n this.ormType = config.type;\n\n if (isMongooseConfig<D>(config)) {\n this.adapter = loadMongooseAdapter<D, I, O>(config);\n } else if (isSequelizeConfig(config)) {\n // Type assertion needed here because D could be either Mongoose or Sequelize model\n this.adapter = loadSequelizeAdapter<Model, I, O>(config) as ORMAdapter<\n D,\n I,\n O\n >;\n } else {\n const exhaustive: never = config;\n throw new Error(\n `Invalid repository configuration. Received: ${JSON.stringify(exhaustive)}`,\n );\n }\n }\n\n get model(): MongooseModel<D> | ModelStatic<any> {\n return this.adapter.model;\n }\n\n public isMongoose(): boolean {\n return this.ormType === ORMType.Mongoose;\n }\n\n public isSequelize(): boolean {\n return this.ormType === ORMType.Sequelize;\n }\n\n public getMongooseModel(): MongooseModel<D> {\n if (!this.isMongoose()) {\n throw new Error(\"Repository is not using Mongoose\");\n }\n return this.adapter.model as MongooseModel<D>;\n }\n\n public getSequelizeModel(): ModelStatic<any> {\n if (!this.isSequelize()) {\n throw new Error(\"Repository is not using Sequelize\");\n }\n return this.adapter.model as ModelStatic<any>;\n }\n\n public toLean(input: unknown): O | null {\n return this.adapter.toLean(input);\n }\n\n async findById(id: string): Promise<O | null> {\n return this.adapter.findById(id);\n }\n\n async create(entity: I): Promise<O> {\n return this.adapter.create(entity);\n }\n\n async update(id: string, update: Partial<I>): Promise<O | null> {\n return this.adapter.update(id, update);\n }\n\n async delete(id: string): Promise<O | null> {\n return this.adapter.delete(id);\n }\n}\n"]}
|