@xemahq/biome-database-nest 0.1.0 → 0.2.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/dist/index.d.ts CHANGED
@@ -3,4 +3,5 @@ export { resolveBiomeDatabaseConfigFromEnv, type BiomeDatabaseConfig, } from './
3
3
  export { createBiomePrismaAdapter, createBiomePrismaAdapterFromEnv, } from './lib/adapter';
4
4
  export { fetchSystemDatabaseConfig, type SystemDatabaseConfigRequest, } from './lib/control-plane-client';
5
5
  export { bootstrapBiomeDatabases, type BiomeDatabaseDeclaration, type BootstrapBiomeDatabasesOptions, } from './lib/bootstrap';
6
+ export { BiomeDatabaseModule, BIOME_DATABASE_READY, type BiomeDatabaseModuleOptions, } from './lib/nest/biome-database.module';
6
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,qBAAqB,GACtB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,iCAAiC,EACjC,KAAK,mBAAmB,GACzB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,wBAAwB,EACxB,+BAA+B,GAChC,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,yBAAyB,EACzB,KAAK,2BAA2B,GACjC,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,uBAAuB,EACvB,KAAK,wBAAwB,EAC7B,KAAK,8BAA8B,GACpC,MAAM,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,qBAAqB,GACtB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,iCAAiC,EACjC,KAAK,mBAAmB,GACzB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,wBAAwB,EACxB,+BAA+B,GAChC,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,yBAAyB,EACzB,KAAK,2BAA2B,GACjC,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,uBAAuB,EACvB,KAAK,wBAAwB,EAC7B,KAAK,8BAA8B,GACpC,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,mBAAmB,EACnB,oBAAoB,EACpB,KAAK,0BAA0B,GAChC,MAAM,kCAAkC,CAAC"}
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.bootstrapBiomeDatabases = exports.fetchSystemDatabaseConfig = exports.createBiomePrismaAdapterFromEnv = exports.createBiomePrismaAdapter = exports.resolveBiomeDatabaseConfigFromEnv = exports.deriveBiomeSchemaName = exports.DEFAULT_BIOME_DB_KEY = void 0;
3
+ exports.BIOME_DATABASE_READY = exports.BiomeDatabaseModule = exports.bootstrapBiomeDatabases = exports.fetchSystemDatabaseConfig = exports.createBiomePrismaAdapterFromEnv = exports.createBiomePrismaAdapter = exports.resolveBiomeDatabaseConfigFromEnv = exports.deriveBiomeSchemaName = exports.DEFAULT_BIOME_DB_KEY = void 0;
4
4
  var schema_name_1 = require("./lib/schema-name");
5
5
  Object.defineProperty(exports, "DEFAULT_BIOME_DB_KEY", { enumerable: true, get: function () { return schema_name_1.DEFAULT_BIOME_DB_KEY; } });
6
6
  Object.defineProperty(exports, "deriveBiomeSchemaName", { enumerable: true, get: function () { return schema_name_1.deriveBiomeSchemaName; } });
@@ -13,4 +13,7 @@ var control_plane_client_1 = require("./lib/control-plane-client");
13
13
  Object.defineProperty(exports, "fetchSystemDatabaseConfig", { enumerable: true, get: function () { return control_plane_client_1.fetchSystemDatabaseConfig; } });
14
14
  var bootstrap_1 = require("./lib/bootstrap");
15
15
  Object.defineProperty(exports, "bootstrapBiomeDatabases", { enumerable: true, get: function () { return bootstrap_1.bootstrapBiomeDatabases; } });
16
+ var biome_database_module_1 = require("./lib/nest/biome-database.module");
17
+ Object.defineProperty(exports, "BiomeDatabaseModule", { enumerable: true, get: function () { return biome_database_module_1.BiomeDatabaseModule; } });
18
+ Object.defineProperty(exports, "BIOME_DATABASE_READY", { enumerable: true, get: function () { return biome_database_module_1.BIOME_DATABASE_READY; } });
16
19
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,iDAG2B;AAFzB,mHAAA,oBAAoB,OAAA;AACpB,oHAAA,qBAAqB,OAAA;AAEvB,uCAGsB;AAFpB,2HAAA,iCAAiC,OAAA;AAGnC,yCAGuB;AAFrB,mHAAA,wBAAwB,OAAA;AACxB,0HAAA,+BAA+B,OAAA;AAEjC,mEAGoC;AAFlC,iIAAA,yBAAyB,OAAA;AAG3B,6CAIyB;AAHvB,oHAAA,uBAAuB,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,iDAG2B;AAFzB,mHAAA,oBAAoB,OAAA;AACpB,oHAAA,qBAAqB,OAAA;AAEvB,uCAGsB;AAFpB,2HAAA,iCAAiC,OAAA;AAGnC,yCAGuB;AAFrB,mHAAA,wBAAwB,OAAA;AACxB,0HAAA,+BAA+B,OAAA;AAEjC,mEAGoC;AAFlC,iIAAA,yBAAyB,OAAA;AAG3B,6CAIyB;AAHvB,oHAAA,uBAAuB,OAAA;AAIzB,0EAI0C;AAHxC,4HAAA,mBAAmB,OAAA;AACnB,6HAAA,oBAAoB,OAAA"}
@@ -0,0 +1,11 @@
1
+ import type { DynamicModule } from '@nestjs/common';
2
+ import type { BiomeDatabaseDeclaration } from '../bootstrap';
3
+ export declare const BIOME_DATABASE_READY: unique symbol;
4
+ export interface BiomeDatabaseModuleOptions {
5
+ readonly biomeId: string;
6
+ readonly databases?: readonly BiomeDatabaseDeclaration[];
7
+ }
8
+ export declare class BiomeDatabaseModule {
9
+ static forRoot(opts: BiomeDatabaseModuleOptions): DynamicModule;
10
+ }
11
+ //# sourceMappingURL=biome-database.module.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"biome-database.module.d.ts","sourceRoot":"","sources":["../../../src/lib/nest/biome-database.module.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAOpD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAC;AAY7D,eAAO,MAAM,oBAAoB,eAEhC,CAAC;AAGF,MAAM,WAAW,0BAA0B;IAEzC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IAKzB,QAAQ,CAAC,SAAS,CAAC,EAAE,SAAS,wBAAwB,EAAE,CAAC;CAC1D;AAgCD,qBACa,mBAAmB;IAC9B,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,0BAA0B,GAAG,aAAa;CA8BhE"}
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var BiomeDatabaseModule_1;
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.BiomeDatabaseModule = exports.BIOME_DATABASE_READY = void 0;
11
+ const common_1 = require("@nestjs/common");
12
+ const identity_client_1 = require("@xemahq/identity-client");
13
+ const service_registry_nest_1 = require("@xemahq/service-registry-nest");
14
+ const bootstrap_1 = require("../bootstrap");
15
+ const schema_name_1 = require("../schema-name");
16
+ exports.BIOME_DATABASE_READY = Symbol.for('@xemahq/biome-database-nest:ready');
17
+ let BiomeDatabaseModule = BiomeDatabaseModule_1 = class BiomeDatabaseModule {
18
+ static forRoot(opts) {
19
+ const databases = opts.databases ?? [
20
+ { key: schema_name_1.DEFAULT_BIOME_DB_KEY, workspaceDir: process.cwd() },
21
+ ];
22
+ return {
23
+ module: BiomeDatabaseModule_1,
24
+ global: true,
25
+ providers: [
26
+ {
27
+ provide: exports.BIOME_DATABASE_READY,
28
+ useFactory: async (registry, identityBootstrap) => {
29
+ await (0, bootstrap_1.bootstrapBiomeDatabases)({
30
+ biomeId: opts.biomeId,
31
+ databases,
32
+ registry,
33
+ serviceToken: () => identityBootstrap.getAccessToken(),
34
+ });
35
+ return true;
36
+ },
37
+ inject: [service_registry_nest_1.SERVICE_REGISTRY_TOKEN, identity_client_1.IdentityBootstrapService],
38
+ },
39
+ ],
40
+ exports: [exports.BIOME_DATABASE_READY],
41
+ };
42
+ }
43
+ };
44
+ exports.BiomeDatabaseModule = BiomeDatabaseModule;
45
+ exports.BiomeDatabaseModule = BiomeDatabaseModule = BiomeDatabaseModule_1 = __decorate([
46
+ (0, common_1.Module)({})
47
+ ], BiomeDatabaseModule);
48
+ //# sourceMappingURL=biome-database.module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"biome-database.module.js","sourceRoot":"","sources":["../../../src/lib/nest/biome-database.module.ts"],"names":[],"mappings":";;;;;;;;;;AACA,2CAAwC;AACxC,6DAAmE;AAEnE,yEAAuE;AAEvE,4CAAuD;AAEvD,gDAAsD;AAWzC,QAAA,oBAAoB,GAAG,MAAM,CAAC,GAAG,CAC5C,mCAAmC,CACpC,CAAC;AA4CK,IAAM,mBAAmB,2BAAzB,MAAM,mBAAmB;IAC9B,MAAM,CAAC,OAAO,CAAC,IAAgC;QAC7C,MAAM,SAAS,GACb,IAAI,CAAC,SAAS,IAAI;YAChB,EAAE,GAAG,EAAE,kCAAoB,EAAE,YAAY,EAAE,OAAO,CAAC,GAAG,EAAE,EAAE;SAC3D,CAAC;QAEJ,OAAO;YACL,MAAM,EAAE,qBAAmB;YAC3B,MAAM,EAAE,IAAI;YACZ,SAAS,EAAE;gBACT;oBACE,OAAO,EAAE,4BAAoB;oBAC7B,UAAU,EAAE,KAAK,EACf,QAAyB,EACzB,iBAA2C,EAC5B,EAAE;wBACjB,MAAM,IAAA,mCAAuB,EAAC;4BAC5B,OAAO,EAAE,IAAI,CAAC,OAAO;4BACrB,SAAS;4BACT,QAAQ;4BACR,YAAY,EAAE,GAAG,EAAE,CAAC,iBAAiB,CAAC,cAAc,EAAE;yBACvD,CAAC,CAAC;wBACH,OAAO,IAAI,CAAC;oBACd,CAAC;oBACD,MAAM,EAAE,CAAC,8CAAsB,EAAE,0CAAwB,CAAC;iBAC3D;aACF;YACD,OAAO,EAAE,CAAC,4BAAoB,CAAC;SAChC,CAAC;IACJ,CAAC;CACF,CAAA;AA/BY,kDAAmB;8BAAnB,mBAAmB;IAD/B,IAAA,eAAM,EAAC,EAAE,CAAC;GACE,mBAAmB,CA+B/B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xemahq/biome-database-nest",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "Layer 1 SDK that centralizes ALL database concerns for Xema biome services. Provides the single correct construction of a schema-qualified Prisma driver-adapter (the second-arg `{ schema }` that makes `@prisma/adapter-pg` qualify `biome_<id>.<table>` instead of `public.<table>`), the per-biome schema-naming convention, env/control-plane config resolution, and a boot-time bootstrap that creates the schema and runs migrations. Biomes carry zero DB boilerplate.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/",
@@ -12,6 +12,8 @@
12
12
  "dist"
13
13
  ],
14
14
  "devDependencies": {
15
+ "@nestjs/common": "11.1.13",
16
+ "@nestjs/core": "11.1.13",
15
17
  "@types/jest": "^30.0.0",
16
18
  "@types/node": "25.2.3",
17
19
  "@types/pg": "^8.16.0",
@@ -21,10 +23,13 @@
21
23
  "typescript": "5.9.3"
22
24
  },
23
25
  "peerDependencies": {
26
+ "@nestjs/common": "^10 || ^11",
27
+ "@nestjs/core": "^10 || ^11",
24
28
  "@prisma/adapter-pg": "^7",
25
29
  "@prisma/client": "^7"
26
30
  },
27
31
  "dependencies": {
32
+ "@xemahq/identity-client": "^0.3.2",
28
33
  "@xemahq/kernel-contracts": "^0.11.0",
29
34
  "@xemahq/migration-runner-prisma": "^0.1.1",
30
35
  "@xemahq/platform-common": "^0.2.0",