@entifix/business 0.7.0 → 0.7.2

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,6 +3,7 @@ export * from './repository/config.repository.js';
3
3
  export * from './repository/entity.repository.js';
4
4
  export * from './repository/entity-link-resolver.repository.js';
5
5
  export * from './repository/entity-mixins.repository.js';
6
+ export * from './repository/entity-repository-factory.js';
6
7
  export * from './sessions/one-time-token-store.js';
7
8
  export * from './sessions/session-store.js';
8
9
  export * from './shutdown/shutdown-registry.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAC;AAC5C,cAAc,mCAAmC,CAAC;AAClD,cAAc,mCAAmC,CAAC;AAClD,cAAc,iDAAiD,CAAC;AAChE,cAAc,0CAA0C,CAAC;AACzD,cAAc,oCAAoC,CAAC;AACnD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,iCAAiC,CAAC;AAChD,cAAc,oBAAoB,CAAC;AACnC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,6BAA6B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAC;AAC5C,cAAc,mCAAmC,CAAC;AAClD,cAAc,mCAAmC,CAAC;AAClD,cAAc,iDAAiD,CAAC;AAChE,cAAc,0CAA0C,CAAC;AACzD,cAAc,2CAA2C,CAAC;AAC1D,cAAc,oCAAoC,CAAC;AACnD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,iCAAiC,CAAC;AAChD,cAAc,oBAAoB,CAAC;AACnC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,6BAA6B,CAAC"}
package/dist/index.js CHANGED
@@ -3,6 +3,7 @@ export * from './repository/config.repository.js';
3
3
  export * from './repository/entity.repository.js';
4
4
  export * from './repository/entity-link-resolver.repository.js';
5
5
  export * from './repository/entity-mixins.repository.js';
6
+ export * from './repository/entity-repository-factory.js';
6
7
  export * from './sessions/one-time-token-store.js';
7
8
  export * from './sessions/session-store.js';
8
9
  export * from './shutdown/shutdown-registry.js';
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["export * from './health/health-registry.js';\nexport * from './repository/config.repository.js';\nexport * from './repository/entity.repository.js';\nexport * from './repository/entity-link-resolver.repository.js';\nexport * from './repository/entity-mixins.repository.js';\nexport * from './sessions/one-time-token-store.js';\nexport * from './sessions/session-store.js';\nexport * from './shutdown/shutdown-registry.js';\nexport * from './tenancy/index.js';\nexport * from './tokens/token-service.js';\nexport * from './use-case/delete/index.js';\nexport * from './use-case/get/index.js';\nexport * from './use-case/load/index.js';\nexport * from './use-case/save/index.js';\nexport * from './wiring/wiring-registry.js';\n"],"names":[],"mappings":"AAAA,cAAc,8BAA8B;AAC5C,cAAc,oCAAoC;AAClD,cAAc,oCAAoC;AAClD,cAAc,kDAAkD;AAChE,cAAc,2CAA2C;AACzD,cAAc,qCAAqC;AACnD,cAAc,8BAA8B;AAC5C,cAAc,kCAAkC;AAChD,cAAc,qBAAqB;AACnC,cAAc,4BAA4B;AAC1C,cAAc,6BAA6B;AAC3C,cAAc,0BAA0B;AACxC,cAAc,2BAA2B;AACzC,cAAc,2BAA2B;AACzC,cAAc,8BAA8B"}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["export * from './health/health-registry.js';\nexport * from './repository/config.repository.js';\nexport * from './repository/entity.repository.js';\nexport * from './repository/entity-link-resolver.repository.js';\nexport * from './repository/entity-mixins.repository.js';\nexport * from './repository/entity-repository-factory.js';\nexport * from './sessions/one-time-token-store.js';\nexport * from './sessions/session-store.js';\nexport * from './shutdown/shutdown-registry.js';\nexport * from './tenancy/index.js';\nexport * from './tokens/token-service.js';\nexport * from './use-case/delete/index.js';\nexport * from './use-case/get/index.js';\nexport * from './use-case/load/index.js';\nexport * from './use-case/save/index.js';\nexport * from './wiring/wiring-registry.js';\n"],"names":[],"mappings":"AAAA,cAAc,8BAA8B;AAC5C,cAAc,oCAAoC;AAClD,cAAc,oCAAoC;AAClD,cAAc,kDAAkD;AAChE,cAAc,2CAA2C;AACzD,cAAc,4CAA4C;AAC1D,cAAc,qCAAqC;AACnD,cAAc,8BAA8B;AAC5C,cAAc,kCAAkC;AAChD,cAAc,qBAAqB;AACnC,cAAc,4BAA4B;AAC1C,cAAc,6BAA6B;AAC3C,cAAc,0BAA0B;AACxC,cAAc,2BAA2B;AACzC,cAAc,2BAA2B;AACzC,cAAc,8BAA8B"}
@@ -0,0 +1,31 @@
1
+ import type { EntifixConnError, Entity, EntityConstructor } from '@entifix/core';
2
+ import { Context, type Effect } from 'effect';
3
+ import type { EntityRepository } from './entity.repository.js';
4
+ /**
5
+ * Who a repository is being opened for. A request on a per-organization store
6
+ * names its organization; a request on a single store names nothing.
7
+ */
8
+ export interface RepositoryScope {
9
+ readonly organizationId?: string;
10
+ }
11
+ /**
12
+ * Opens the {@link EntityRepository} for one entity, for one request.
13
+ *
14
+ * What lets generic code — a route derived from an entity, a sweep — reach
15
+ * storage without knowing which store, which engine or which database it is.
16
+ * The host provides one at composition: a single database for a platform
17
+ * store, a per-organization resolver for a tenant one. Calling it is cheap; it
18
+ * hands out handles over a pool that already exists.
19
+ *
20
+ * An implementation over a per-organization store **must refuse** a scope with
21
+ * no `organizationId` rather than pick a default: a default organization is
22
+ * somebody else's data.
23
+ */
24
+ export interface EntityRepositoryFactory {
25
+ readonly for: <T extends Entity>(entityConstructor: EntityConstructor<T>, scope: RepositoryScope) => Effect.Effect<EntityRepository, EntifixConnError>;
26
+ }
27
+ declare const EntityRepositoryFactoryTag_base: Context.ServiceClass<EntityRepositoryFactoryTag, "EntityRepositoryFactoryTag", EntityRepositoryFactory>;
28
+ export declare class EntityRepositoryFactoryTag extends EntityRepositoryFactoryTag_base {
29
+ }
30
+ export {};
31
+ //# sourceMappingURL=entity-repository-factory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entity-repository-factory.d.ts","sourceRoot":"","sources":["../../src/repository/entity-repository-factory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAChB,MAAM,EACN,iBAAiB,EAClB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,QAAQ,CAAC;AAE9C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE/D;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;CAClC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,GAAG,EAAE,CAAC,CAAC,SAAS,MAAM,EAC7B,iBAAiB,EAAE,iBAAiB,CAAC,CAAC,CAAC,EACvC,KAAK,EAAE,eAAe,KACnB,MAAM,CAAC,MAAM,CAAC,gBAAgB,EAAE,gBAAgB,CAAC,CAAC;CACxD;;AAED,qBAAa,0BAA2B,SAAQ,+BAGf;CAAG"}
@@ -0,0 +1,5 @@
1
+ import { Context } from 'effect';
2
+ export class EntityRepositoryFactoryTag extends Context.Service()('EntityRepositoryFactoryTag') {
3
+ }
4
+
5
+ //# sourceMappingURL=entity-repository-factory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/repository/entity-repository-factory.ts"],"sourcesContent":["import type {\n EntifixConnError,\n Entity,\n EntityConstructor,\n} from '@entifix/core';\nimport { Context, type Effect } from 'effect';\n\nimport type { EntityRepository } from './entity.repository.js';\n\n/**\n * Who a repository is being opened for. A request on a per-organization store\n * names its organization; a request on a single store names nothing.\n */\nexport interface RepositoryScope {\n readonly organizationId?: string;\n}\n\n/**\n * Opens the {@link EntityRepository} for one entity, for one request.\n *\n * What lets generic code — a route derived from an entity, a sweep — reach\n * storage without knowing which store, which engine or which database it is.\n * The host provides one at composition: a single database for a platform\n * store, a per-organization resolver for a tenant one. Calling it is cheap; it\n * hands out handles over a pool that already exists.\n *\n * An implementation over a per-organization store **must refuse** a scope with\n * no `organizationId` rather than pick a default: a default organization is\n * somebody else's data.\n */\nexport interface EntityRepositoryFactory {\n readonly for: <T extends Entity>(\n entityConstructor: EntityConstructor<T>,\n scope: RepositoryScope,\n ) => Effect.Effect<EntityRepository, EntifixConnError>;\n}\n\nexport class EntityRepositoryFactoryTag extends Context.Service<\n EntityRepositoryFactoryTag,\n EntityRepositoryFactory\n>()('EntityRepositoryFactoryTag') {}\n"],"names":["Context","EntityRepositoryFactoryTag","Service"],"mappings":"AAKA,SAASA,OAAO,QAAqB,SAAS;AAgC9C,OAAO,MAAMC,mCAAmCD,QAAQE,OAAO,GAG3D;AAA+B"}
@@ -1,2 +1,3 @@
1
1
  export * from './tenant-database-resolver.js';
2
+ export * from './tenant-directory.js';
2
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tenancy/index.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tenancy/index.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAC;AAC9C,cAAc,uBAAuB,CAAC"}
@@ -1,3 +1,4 @@
1
1
  export * from './tenant-database-resolver.js';
2
+ export * from './tenant-directory.js';
2
3
 
3
4
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/tenancy/index.ts"],"sourcesContent":["export * from './tenant-database-resolver.js';\n"],"names":[],"mappings":"AAAA,cAAc,gCAAgC"}
1
+ {"version":3,"sources":["../../src/tenancy/index.ts"],"sourcesContent":["export * from './tenant-database-resolver.js';\nexport * from './tenant-directory.js';\n"],"names":[],"mappings":"AAAA,cAAc,gCAAgC;AAC9C,cAAc,wBAAwB"}
@@ -0,0 +1,31 @@
1
+ import type { EntifixConnError } from '@entifix/core';
2
+ import { Context, type Effect } from 'effect';
3
+ /** One organization's storage, as a {@link TenantDirectory} lists it. */
4
+ export interface TenantEntry<THandle> {
5
+ readonly organizationId: string;
6
+ readonly handle: THandle;
7
+ }
8
+ /**
9
+ * Every organization's storage for one per-organization store.
10
+ *
11
+ * The other half of {@link TenantDatabaseResolver}: that one answers a
12
+ * request about **one** organization; this one is for the background work
13
+ * that has to visit **all** of them — an outbox relay, an expiry sweep, a
14
+ * rebuild walk. A request handler never needs it, and should not have it.
15
+ *
16
+ * Enumerating is only legitimate for the slice that writes the store being
17
+ * enumerated. A process listing another slice's tenant databases is reading
18
+ * storage it does not own.
19
+ */
20
+ export interface TenantDirectory<THandle> {
21
+ readonly list: () => Effect.Effect<readonly TenantEntry<THandle>[], EntifixConnError>;
22
+ }
23
+ declare const TenantDirectoryTag_base: Context.ServiceClass<TenantDirectoryTag, "TenantDirectoryTag", TenantDirectory<unknown>>;
24
+ /**
25
+ * DI tag for the directory, with an `unknown` handle for the reason
26
+ * {@link TenantDatabaseResolverTag} gives: the composition root narrows it.
27
+ */
28
+ export declare class TenantDirectoryTag extends TenantDirectoryTag_base {
29
+ }
30
+ export {};
31
+ //# sourceMappingURL=tenant-directory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tenant-directory.d.ts","sourceRoot":"","sources":["../../src/tenancy/tenant-directory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,QAAQ,CAAC;AAE9C,yEAAyE;AACzE,MAAM,WAAW,WAAW,CAAC,OAAO;IAClC,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;CAC1B;AAED;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,eAAe,CAAC,OAAO;IACtC,QAAQ,CAAC,IAAI,EAAE,MAAM,MAAM,CAAC,MAAM,CAChC,SAAS,WAAW,CAAC,OAAO,CAAC,EAAE,EAC/B,gBAAgB,CACjB,CAAC;CACH;;AAED;;;GAGG;AACH,qBAAa,kBAAmB,SAAQ,uBAGf;CAAG"}
@@ -0,0 +1,8 @@
1
+ import { Context } from 'effect';
2
+ /**
3
+ * DI tag for the directory, with an `unknown` handle for the reason
4
+ * {@link TenantDatabaseResolverTag} gives: the composition root narrows it.
5
+ */ export class TenantDirectoryTag extends Context.Service()('TenantDirectoryTag') {
6
+ }
7
+
8
+ //# sourceMappingURL=tenant-directory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/tenancy/tenant-directory.ts"],"sourcesContent":["import type { EntifixConnError } from '@entifix/core';\nimport { Context, type Effect } from 'effect';\n\n/** One organization's storage, as a {@link TenantDirectory} lists it. */\nexport interface TenantEntry<THandle> {\n readonly organizationId: string;\n readonly handle: THandle;\n}\n\n/**\n * Every organization's storage for one per-organization store.\n *\n * The other half of {@link TenantDatabaseResolver}: that one answers a\n * request about **one** organization; this one is for the background work\n * that has to visit **all** of them — an outbox relay, an expiry sweep, a\n * rebuild walk. A request handler never needs it, and should not have it.\n *\n * Enumerating is only legitimate for the slice that writes the store being\n * enumerated. A process listing another slice's tenant databases is reading\n * storage it does not own.\n */\nexport interface TenantDirectory<THandle> {\n readonly list: () => Effect.Effect<\n readonly TenantEntry<THandle>[],\n EntifixConnError\n >;\n}\n\n/**\n * DI tag for the directory, with an `unknown` handle for the reason\n * {@link TenantDatabaseResolverTag} gives: the composition root narrows it.\n */\nexport class TenantDirectoryTag extends Context.Service<\n TenantDirectoryTag,\n TenantDirectory<unknown>\n>()('TenantDirectoryTag') {}\n"],"names":["Context","TenantDirectoryTag","Service"],"mappings":"AACA,SAASA,OAAO,QAAqB,SAAS;AA2B9C;;;CAGC,GACD,OAAO,MAAMC,2BAA2BD,QAAQE,OAAO,GAGnD;AAAuB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@entifix/business",
3
- "version": "0.7.0",
3
+ "version": "0.7.2",
4
4
  "description": "The ports every adapter implements — repository, session, token, health — and the generic get, load, save and delete use-cases.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -51,7 +51,7 @@
51
51
  },
52
52
  "dependencies": {
53
53
  "@swc/helpers": "0.5.23",
54
- "@entifix/core": "0.7.0"
54
+ "@entifix/core": "0.7.2"
55
55
  },
56
56
  "peerDependencies": {
57
57
  "effect": "^4.0.5"