@entifix/business 0.7.2 → 0.9.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/README.md +3 -3
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/repository/entity-facet-counter.d.ts +35 -0
- package/dist/repository/entity-facet-counter.d.ts.map +1 -0
- package/dist/repository/entity-facet-counter.js +7 -0
- package/dist/repository/entity-facet-counter.js.map +1 -0
- package/dist/use-case/facets/facet-counts.uc.d.ts +12 -0
- package/dist/use-case/facets/facet-counts.uc.d.ts.map +1 -0
- package/dist/use-case/facets/facet-counts.uc.js +14 -0
- package/dist/use-case/facets/facet-counts.uc.js.map +1 -0
- package/dist/use-case/facets/index.d.ts +2 -0
- package/dist/use-case/facets/index.d.ts.map +1 -0
- package/dist/use-case/facets/index.js +3 -0
- package/dist/use-case/facets/index.js.map +1 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -12,9 +12,9 @@ pnpm add @entifix/business effect
|
|
|
12
12
|
|
|
13
13
|
## Entry points
|
|
14
14
|
|
|
15
|
-
| Import | What it holds
|
|
16
|
-
| ------------------- |
|
|
17
|
-
| `@entifix/business` | Port tags, `getUCFactory` / `loadUCFactory` / `saveUCFactory` / `deleteUCFactory`, `loadAllUCFactory` (every record a request keeps, page by page), `resolveLinksUCFactory` (chosen links of many records), `HealthRegistryLayer`, `makeShutdownRegistry` |
|
|
15
|
+
| Import | What it holds |
|
|
16
|
+
| ------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
17
|
+
| `@entifix/business` | Port tags (the facet counter, `EntityFacetCounterTag` and its factory, beside the repository), `getUCFactory` / `loadUCFactory` / `saveUCFactory` / `deleteUCFactory`, `facetCountsUCFactory`, `loadAllUCFactory` (every record a request keeps, page by page), `resolveLinksUCFactory` (chosen links of many records), `HealthRegistryLayer`, `makeShutdownRegistry` |
|
|
18
18
|
|
|
19
19
|
---
|
|
20
20
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * from './health/health-registry.js';
|
|
2
2
|
export * from './repository/config.repository.js';
|
|
3
3
|
export * from './repository/entity.repository.js';
|
|
4
|
+
export * from './repository/entity-facet-counter.js';
|
|
4
5
|
export * from './repository/entity-link-resolver.repository.js';
|
|
5
6
|
export * from './repository/entity-mixins.repository.js';
|
|
6
7
|
export * from './repository/entity-repository-factory.js';
|
|
@@ -10,6 +11,7 @@ export * from './shutdown/shutdown-registry.js';
|
|
|
10
11
|
export * from './tenancy/index.js';
|
|
11
12
|
export * from './tokens/token-service.js';
|
|
12
13
|
export * from './use-case/delete/index.js';
|
|
14
|
+
export * from './use-case/facets/index.js';
|
|
13
15
|
export * from './use-case/get/index.js';
|
|
14
16
|
export * from './use-case/load/index.js';
|
|
15
17
|
export * from './use-case/save/index.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -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,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"}
|
|
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,sCAAsC,CAAC;AACrD,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,4BAA4B,CAAC;AAC3C,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,6BAA6B,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * from './health/health-registry.js';
|
|
2
2
|
export * from './repository/config.repository.js';
|
|
3
3
|
export * from './repository/entity.repository.js';
|
|
4
|
+
export * from './repository/entity-facet-counter.js';
|
|
4
5
|
export * from './repository/entity-link-resolver.repository.js';
|
|
5
6
|
export * from './repository/entity-mixins.repository.js';
|
|
6
7
|
export * from './repository/entity-repository-factory.js';
|
|
@@ -10,6 +11,7 @@ export * from './shutdown/shutdown-registry.js';
|
|
|
10
11
|
export * from './tenancy/index.js';
|
|
11
12
|
export * from './tokens/token-service.js';
|
|
12
13
|
export * from './use-case/delete/index.js';
|
|
14
|
+
export * from './use-case/facets/index.js';
|
|
13
15
|
export * from './use-case/get/index.js';
|
|
14
16
|
export * from './use-case/load/index.js';
|
|
15
17
|
export * from './use-case/save/index.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 './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"}
|
|
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-facet-counter.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/facets/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,uCAAuC;AACrD,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,6BAA6B;AAC3C,cAAc,0BAA0B;AACxC,cAAc,2BAA2B;AACzC,cAAc,2BAA2B;AACzC,cAAc,8BAA8B"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { EntifixConnError, EntifixError, Entity, EntityConstructor, EntityFacetCounts, EntityFacetQuery } from '@entifix/core';
|
|
2
|
+
import { Context, type Effect } from 'effect';
|
|
3
|
+
import type { RepositoryScope } from './entity-repository-factory.js';
|
|
4
|
+
/**
|
|
5
|
+
* Counts how many of one entity's records hold each value of a member — what a
|
|
6
|
+
* facet shows beside each choice ("Aurora (12)").
|
|
7
|
+
*
|
|
8
|
+
* A port of its own rather than a fifth method on `EntityRepository`, so a
|
|
9
|
+
* store that cannot count is simply not bound to it: a route or a read that
|
|
10
|
+
* needs counts then fails to compile for want of the tag, instead of an
|
|
11
|
+
* adapter answering an empty list nobody notices.
|
|
12
|
+
*
|
|
13
|
+
* ⚠️ Like the repository, every method requires nothing from its environment;
|
|
14
|
+
* an adapter binds what it needs when it is built.
|
|
15
|
+
*/
|
|
16
|
+
export interface EntityFacetCounter {
|
|
17
|
+
count<TEntity extends Entity>(queries: readonly EntityFacetQuery<TEntity>[]): Effect.Effect<EntityFacetCounts, EntifixError>;
|
|
18
|
+
}
|
|
19
|
+
declare const EntityFacetCounterTag_base: Context.ServiceClass<EntityFacetCounterTag, "EntityFacetCounterTag", EntityFacetCounter>;
|
|
20
|
+
export declare class EntityFacetCounterTag extends EntityFacetCounterTag_base {
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Opens the {@link EntityFacetCounter} for one entity, for one request — the
|
|
24
|
+
* counter's `EntityRepositoryFactory`, with the same rule: an implementation
|
|
25
|
+
* over a per-organization store **must refuse** a scope with no
|
|
26
|
+
* `organizationId`.
|
|
27
|
+
*/
|
|
28
|
+
export interface EntityFacetCounterFactory {
|
|
29
|
+
readonly for: <T extends Entity>(entityConstructor: EntityConstructor<T>, scope: RepositoryScope) => Effect.Effect<EntityFacetCounter, EntifixConnError>;
|
|
30
|
+
}
|
|
31
|
+
declare const EntityFacetCounterFactoryTag_base: Context.ServiceClass<EntityFacetCounterFactoryTag, "EntityFacetCounterFactoryTag", EntityFacetCounterFactory>;
|
|
32
|
+
export declare class EntityFacetCounterFactoryTag extends EntityFacetCounterFactoryTag_base {
|
|
33
|
+
}
|
|
34
|
+
export {};
|
|
35
|
+
//# sourceMappingURL=entity-facet-counter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entity-facet-counter.d.ts","sourceRoot":"","sources":["../../src/repository/entity-facet-counter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAChB,YAAY,EACZ,MAAM,EACN,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,EACjB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,QAAQ,CAAC;AAE9C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAEtE;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,kBAAkB;IACjC,KAAK,CAAC,OAAO,SAAS,MAAM,EAC1B,OAAO,EAAE,SAAS,gBAAgB,CAAC,OAAO,CAAC,EAAE,GAC5C,MAAM,CAAC,MAAM,CAAC,iBAAiB,EAAE,YAAY,CAAC,CAAC;CACnD;;AAED,qBAAa,qBAAsB,SAAQ,0BAGf;CAAG;AAE/B;;;;;GAKG;AACH,MAAM,WAAW,yBAAyB;IACxC,QAAQ,CAAC,GAAG,EAAE,CAAC,CAAC,SAAS,MAAM,EAC7B,iBAAiB,EAAE,iBAAiB,CAAC,CAAC,CAAC,EACvC,KAAK,EAAE,eAAe,KACnB,MAAM,CAAC,MAAM,CAAC,kBAAkB,EAAE,gBAAgB,CAAC,CAAC;CAC1D;;AAED,qBAAa,4BAA6B,SAAQ,iCAGf;CAAG"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Context } from 'effect';
|
|
2
|
+
export class EntityFacetCounterTag extends Context.Service()('EntityFacetCounterTag') {
|
|
3
|
+
}
|
|
4
|
+
export class EntityFacetCounterFactoryTag extends Context.Service()('EntityFacetCounterFactoryTag') {
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
//# sourceMappingURL=entity-facet-counter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/repository/entity-facet-counter.ts"],"sourcesContent":["import type {\n EntifixConnError,\n EntifixError,\n Entity,\n EntityConstructor,\n EntityFacetCounts,\n EntityFacetQuery,\n} from '@entifix/core';\nimport { Context, type Effect } from 'effect';\n\nimport type { RepositoryScope } from './entity-repository-factory.js';\n\n/**\n * Counts how many of one entity's records hold each value of a member — what a\n * facet shows beside each choice (\"Aurora (12)\").\n *\n * A port of its own rather than a fifth method on `EntityRepository`, so a\n * store that cannot count is simply not bound to it: a route or a read that\n * needs counts then fails to compile for want of the tag, instead of an\n * adapter answering an empty list nobody notices.\n *\n * ⚠️ Like the repository, every method requires nothing from its environment;\n * an adapter binds what it needs when it is built.\n */\nexport interface EntityFacetCounter {\n count<TEntity extends Entity>(\n queries: readonly EntityFacetQuery<TEntity>[],\n ): Effect.Effect<EntityFacetCounts, EntifixError>;\n}\n\nexport class EntityFacetCounterTag extends Context.Service<\n EntityFacetCounterTag,\n EntityFacetCounter\n>()('EntityFacetCounterTag') {}\n\n/**\n * Opens the {@link EntityFacetCounter} for one entity, for one request — the\n * counter's `EntityRepositoryFactory`, with the same rule: an implementation\n * over a per-organization store **must refuse** a scope with no\n * `organizationId`.\n */\nexport interface EntityFacetCounterFactory {\n readonly for: <T extends Entity>(\n entityConstructor: EntityConstructor<T>,\n scope: RepositoryScope,\n ) => Effect.Effect<EntityFacetCounter, EntifixConnError>;\n}\n\nexport class EntityFacetCounterFactoryTag extends Context.Service<\n EntityFacetCounterFactoryTag,\n EntityFacetCounterFactory\n>()('EntityFacetCounterFactoryTag') {}\n"],"names":["Context","EntityFacetCounterTag","Service","EntityFacetCounterFactoryTag"],"mappings":"AAQA,SAASA,OAAO,QAAqB,SAAS;AAsB9C,OAAO,MAAMC,8BAA8BD,QAAQE,OAAO,GAGtD;AAA0B;AAe9B,OAAO,MAAMC,qCAAqCH,QAAQE,OAAO,GAG7D;AAAiC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Entity, EntityFacetQuery } from '@entifix/core';
|
|
2
|
+
import { Effect } from 'effect';
|
|
3
|
+
import { EntityFacetCounterTag } from '../../repository/entity-facet-counter.js';
|
|
4
|
+
/**
|
|
5
|
+
* The counts for `queries`, from whichever counter the caller provides.
|
|
6
|
+
*
|
|
7
|
+
* The queries are an argument rather than a tag: a tag cannot carry the
|
|
8
|
+
* entity's type, and the cast a load request needs to cross one is exactly
|
|
9
|
+
* what this use case has no reason to inherit.
|
|
10
|
+
*/
|
|
11
|
+
export declare const facetCountsUCFactory: <TEntity extends Entity>(queries: readonly EntityFacetQuery<TEntity>[]) => Effect.Effect<Readonly<Record<string, readonly import("@entifix/core").EntityFacetValue[]>>, import("@entifix/core").EntifixError, EntityFacetCounterTag>;
|
|
12
|
+
//# sourceMappingURL=facet-counts.uc.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"facet-counts.uc.d.ts","sourceRoot":"","sources":["../../../src/use-case/facets/facet-counts.uc.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAC9D,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,OAAO,EAAE,qBAAqB,EAAE,MAAM,0CAA0C,CAAC;AAEjF;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB,GAAI,OAAO,SAAS,MAAM,EACzD,SAAS,SAAS,gBAAgB,CAAC,OAAO,CAAC,EAAE,8JAK3C,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Effect } from 'effect';
|
|
2
|
+
import { EntityFacetCounterTag } from '../../repository/entity-facet-counter.js';
|
|
3
|
+
/**
|
|
4
|
+
* The counts for `queries`, from whichever counter the caller provides.
|
|
5
|
+
*
|
|
6
|
+
* The queries are an argument rather than a tag: a tag cannot carry the
|
|
7
|
+
* entity's type, and the cast a load request needs to cross one is exactly
|
|
8
|
+
* what this use case has no reason to inherit.
|
|
9
|
+
*/ export const facetCountsUCFactory = (queries)=>Effect.gen(function*() {
|
|
10
|
+
const counter = yield* EntityFacetCounterTag;
|
|
11
|
+
return yield* counter.count(queries);
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
//# sourceMappingURL=facet-counts.uc.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/use-case/facets/facet-counts.uc.ts"],"sourcesContent":["import type { Entity, EntityFacetQuery } from '@entifix/core';\nimport { Effect } from 'effect';\n\nimport { EntityFacetCounterTag } from '../../repository/entity-facet-counter.js';\n\n/**\n * The counts for `queries`, from whichever counter the caller provides.\n *\n * The queries are an argument rather than a tag: a tag cannot carry the\n * entity's type, and the cast a load request needs to cross one is exactly\n * what this use case has no reason to inherit.\n */\nexport const facetCountsUCFactory = <TEntity extends Entity>(\n queries: readonly EntityFacetQuery<TEntity>[],\n) =>\n Effect.gen(function* () {\n const counter = yield* EntityFacetCounterTag;\n return yield* counter.count<TEntity>(queries);\n });\n"],"names":["Effect","EntityFacetCounterTag","facetCountsUCFactory","queries","gen","counter","count"],"mappings":"AACA,SAASA,MAAM,QAAQ,SAAS;AAEhC,SAASC,qBAAqB,QAAQ,2CAA2C;AAEjF;;;;;;CAMC,GACD,OAAO,MAAMC,uBAAuB,CAClCC,UAEAH,OAAOI,GAAG,CAAC;QACT,MAAMC,UAAU,OAAOJ;QACvB,OAAO,OAAOI,QAAQC,KAAK,CAAUH;IACvC,GAAG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/use-case/facets/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/use-case/facets/index.ts"],"sourcesContent":["export * from './facet-counts.uc.js';\n"],"names":[],"mappings":"AAAA,cAAc,uBAAuB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@entifix/business",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
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.
|
|
54
|
+
"@entifix/core": "0.9.0"
|
|
55
55
|
},
|
|
56
56
|
"peerDependencies": {
|
|
57
57
|
"effect": "^4.0.5"
|