@entifix/core 0.23.8 → 0.23.9
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/entity-definition/describe/describe-entity-use-cases.d.ts +12 -0
- package/dist/entity-definition/describe/describe-entity-use-cases.d.ts.map +1 -1
- package/dist/entity-definition/describe/describe-entity-use-cases.js +6 -2
- package/dist/entity-definition/describe/describe-entity-use-cases.js.map +1 -1
- package/dist/use-case-runner/use-case-runner.d.ts +4 -1
- package/dist/use-case-runner/use-case-runner.d.ts.map +1 -1
- package/dist/use-case-runner/use-case-runner.js.map +1 -1
- package/package.json +1 -1
|
@@ -24,7 +24,19 @@ export interface UseCaseDescriptor extends UseCaseHierarchy {
|
|
|
24
24
|
inverse?: string;
|
|
25
25
|
/** The states a record must be in for the verb to be offered on it. */
|
|
26
26
|
availableWhen?: UseCaseAvailability;
|
|
27
|
+
/**
|
|
28
|
+
* The form a surface opens to ask for this verb's {@link takesInput}, by
|
|
29
|
+
* name; the host supplies it. Without one, a verb that takes input is
|
|
30
|
+
* offered by no generic surface.
|
|
31
|
+
*/
|
|
27
32
|
form?: string;
|
|
33
|
+
/**
|
|
34
|
+
* `true` when the verb needs a body: its use case declares a `payload`. A
|
|
35
|
+
* generic surface cannot ask for one, so it offers the verb only through
|
|
36
|
+
* the {@link form} the verb names — never as a button that posts nothing.
|
|
37
|
+
* Absent on a verb that needs none.
|
|
38
|
+
*/
|
|
39
|
+
takesInput?: true;
|
|
28
40
|
/** The named variant set this verb resolves between. */
|
|
29
41
|
variants?: string;
|
|
30
42
|
/** The named recipe this verb starts a flow from. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"describe-entity-use-cases.d.ts","sourceRoot":"","sources":["../../../src/entity-definition/describe/describe-entity-use-cases.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAElE,OAAO,KAAK,EACV,mBAAmB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,CAAC;CAC/B;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,SAAS,MAAM,EAC3D,iBAAiB,EAAE,iBAAiB,CAAC,OAAO,CAAC,GAC5C,iBAAiB,EAAE,CAqBrB;AAED;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAChC,UAAU,EAAE,IAAI,CAAC,iBAAiB,EAAE,eAAe,CAAC,EACpD,MAAM,EAAE,MAAM,GAAG,SAAS,GACzB,OAAO,CAQT"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { _ as _extends } from "@swc/helpers/_/_extends";
|
|
1
2
|
import { extractMetaUseCases } from '../helpers/index.js';
|
|
2
3
|
/**
|
|
3
4
|
* Resolves the use cases declared against an entity, in declaration order.
|
|
@@ -10,7 +11,7 @@ import { extractMetaUseCases } from '../helpers/index.js';
|
|
|
10
11
|
* A browser never calls this — it fetches the descriptors instead, so no
|
|
11
12
|
* use-case implementation reaches a client bundle.
|
|
12
13
|
*/ export function describeEntityUseCases(entityConstructor) {
|
|
13
|
-
return extractMetaUseCases(entityConstructor).map((metaUseCase)=>({
|
|
14
|
+
return extractMetaUseCases(entityConstructor).map((metaUseCase)=>_extends({
|
|
14
15
|
key: metaUseCase.key,
|
|
15
16
|
binding: metaUseCase.binding,
|
|
16
17
|
placement: metaUseCase.placement,
|
|
@@ -25,7 +26,10 @@ import { extractMetaUseCases } from '../helpers/index.js';
|
|
|
25
26
|
priority: metaUseCase.priority,
|
|
26
27
|
rowInline: metaUseCase.rowInline,
|
|
27
28
|
shortcut: metaUseCase.shortcut,
|
|
28
|
-
form: metaUseCase.form
|
|
29
|
+
form: metaUseCase.form
|
|
30
|
+
}, metaUseCase.payload === undefined ? {} : {
|
|
31
|
+
takesInput: true
|
|
32
|
+
}, {
|
|
29
33
|
variants: metaUseCase.variants,
|
|
30
34
|
recipe: metaUseCase.recipe
|
|
31
35
|
}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/entity-definition/describe/describe-entity-use-cases.ts"],"sourcesContent":["import { Entity, EntityConstructor } from '../../types/Entity.js';\nimport { extractMetaUseCases } from '../helpers/index.js';\nimport type {\n UseCaseAvailability,\n UseCaseBinding,\n UseCaseCell,\n UseCaseConfirm,\n UseCaseHierarchy,\n UseCasePlacement,\n UseCaseReversible,\n} from '../meta-entities/meta-use-case/index.js';\n\n/**\n * An action a caller may take on an entity, resolved from its use-case\n * metadata. The counterpart to {@link EntityFieldDescriptor}, and like it,\n * framework-free and copy-free — every human-readable member is a catalog key.\n *\n * It carries no `entity`: this is the shape that goes over the wire from\n * `GET /api/<entity>/$metadata`, where the entity is already the address.\n */\nexport interface UseCaseDescriptor extends UseCaseHierarchy {\n /** The verb. Also the third segment of the permission guarding it. */\n key: string;\n binding: UseCaseBinding;\n placement: UseCasePlacement;\n /** Further cells this same verb appears in — see `MetaUseCaseOptions`. */\n alsoAt?: readonly UseCaseCell[];\n labelKey: string;\n keywordsKey?: string;\n confirm?: UseCaseConfirm;\n /** How a destructive verb is made safe — see `UseCaseReversible`. */\n reversible?: UseCaseReversible;\n /** The verb Undo runs, by key. */\n inverse?: string;\n /** The states a record must be in for the verb to be offered on it. */\n availableWhen?: UseCaseAvailability;\n form?: string;\n /** The named variant set this verb resolves between. */\n variants?: string;\n /** The named recipe this verb starts a flow from. */\n recipe?: string;\n /**\n * What this verb resolves to **for the caller asking** — present only on a\n * served `$metadata` document, computed per principal.\n */\n composition?: UseCaseComposition;\n}\n\n/** Which variant, and which flow, a verb resolves to for one caller. */\nexport interface UseCaseComposition {\n useCase: string;\n variant: string;\n recipe?: string;\n slipVersion?: number;\n /** The `id@n` references the recipe can pin, in order. */\n fragments?: readonly string[];\n}\n\n/**\n * Resolves the use cases declared against an entity, in declaration order.\n *\n * Unlike {@link describeEntityColumns}, this is only trustworthy where the\n * use-case modules have been loaded: a `@useCase()` class registers itself when\n * its module evaluates. On a service that is the composition root's job, and\n * a host's register should fail the build on a class its package barrel does\n * not export.\n * A browser never calls this — it fetches the descriptors instead, so no\n * use-case implementation reaches a client bundle.\n */\nexport function describeEntityUseCases<TEntity extends Entity>(\n entityConstructor: EntityConstructor<TEntity>,\n): UseCaseDescriptor[] {\n return extractMetaUseCases(entityConstructor).map(metaUseCase => ({\n key: metaUseCase.key,\n binding: metaUseCase.binding,\n placement: metaUseCase.placement,\n alsoAt: metaUseCase.alsoAt,\n labelKey: metaUseCase.labelKey,\n keywordsKey: metaUseCase.keywordsKey,\n confirm: metaUseCase.confirm,\n reversible: metaUseCase.reversible,\n inverse: metaUseCase.inverse,\n availableWhen: metaUseCase.availableWhen,\n emphasis: metaUseCase.emphasis,\n priority: metaUseCase.priority,\n rowInline: metaUseCase.rowInline,\n shortcut: metaUseCase.shortcut,\n form: metaUseCase.form,\n variants: metaUseCase.variants,\n recipe: metaUseCase.recipe,\n }));\n}\n\n/**\n * Whether a surface offers `descriptor` on `record`: always, for a verb that\n * declares no {@link UseCaseAvailability}; otherwise only once the record has\n * arrived and its member holds one of the declared states. A record still in\n * flight offers none of its state-bound verbs, rather than all of them for a\n * moment.\n *\n * Presentation only — the verb's handler is what refuses an illegal move.\n */\nexport function isUseCaseAvailable(\n descriptor: Pick<UseCaseDescriptor, 'availableWhen'>,\n record: object | undefined,\n): boolean {\n const availability = descriptor.availableWhen;\n if (availability === undefined) return true;\n if (record === undefined) return false;\n const state = (record as Readonly<Record<string, unknown>>)[\n availability.member\n ];\n return typeof state === 'string' && availability.in.includes(state);\n}\n"],"names":["extractMetaUseCases","describeEntityUseCases","entityConstructor","map","metaUseCase","key","binding","placement","alsoAt","labelKey","keywordsKey","confirm","reversible","inverse","availableWhen","emphasis","priority","rowInline","shortcut","form","variants","recipe","isUseCaseAvailable","descriptor","record","availability","
|
|
1
|
+
{"version":3,"sources":["../../../src/entity-definition/describe/describe-entity-use-cases.ts"],"sourcesContent":["import { Entity, EntityConstructor } from '../../types/Entity.js';\nimport { extractMetaUseCases } from '../helpers/index.js';\nimport type {\n UseCaseAvailability,\n UseCaseBinding,\n UseCaseCell,\n UseCaseConfirm,\n UseCaseHierarchy,\n UseCasePlacement,\n UseCaseReversible,\n} from '../meta-entities/meta-use-case/index.js';\n\n/**\n * An action a caller may take on an entity, resolved from its use-case\n * metadata. The counterpart to {@link EntityFieldDescriptor}, and like it,\n * framework-free and copy-free — every human-readable member is a catalog key.\n *\n * It carries no `entity`: this is the shape that goes over the wire from\n * `GET /api/<entity>/$metadata`, where the entity is already the address.\n */\nexport interface UseCaseDescriptor extends UseCaseHierarchy {\n /** The verb. Also the third segment of the permission guarding it. */\n key: string;\n binding: UseCaseBinding;\n placement: UseCasePlacement;\n /** Further cells this same verb appears in — see `MetaUseCaseOptions`. */\n alsoAt?: readonly UseCaseCell[];\n labelKey: string;\n keywordsKey?: string;\n confirm?: UseCaseConfirm;\n /** How a destructive verb is made safe — see `UseCaseReversible`. */\n reversible?: UseCaseReversible;\n /** The verb Undo runs, by key. */\n inverse?: string;\n /** The states a record must be in for the verb to be offered on it. */\n availableWhen?: UseCaseAvailability;\n /**\n * The form a surface opens to ask for this verb's {@link takesInput}, by\n * name; the host supplies it. Without one, a verb that takes input is\n * offered by no generic surface.\n */\n form?: string;\n /**\n * `true` when the verb needs a body: its use case declares a `payload`. A\n * generic surface cannot ask for one, so it offers the verb only through\n * the {@link form} the verb names — never as a button that posts nothing.\n * Absent on a verb that needs none.\n */\n takesInput?: true;\n /** The named variant set this verb resolves between. */\n variants?: string;\n /** The named recipe this verb starts a flow from. */\n recipe?: string;\n /**\n * What this verb resolves to **for the caller asking** — present only on a\n * served `$metadata` document, computed per principal.\n */\n composition?: UseCaseComposition;\n}\n\n/** Which variant, and which flow, a verb resolves to for one caller. */\nexport interface UseCaseComposition {\n useCase: string;\n variant: string;\n recipe?: string;\n slipVersion?: number;\n /** The `id@n` references the recipe can pin, in order. */\n fragments?: readonly string[];\n}\n\n/**\n * Resolves the use cases declared against an entity, in declaration order.\n *\n * Unlike {@link describeEntityColumns}, this is only trustworthy where the\n * use-case modules have been loaded: a `@useCase()` class registers itself when\n * its module evaluates. On a service that is the composition root's job, and\n * a host's register should fail the build on a class its package barrel does\n * not export.\n * A browser never calls this — it fetches the descriptors instead, so no\n * use-case implementation reaches a client bundle.\n */\nexport function describeEntityUseCases<TEntity extends Entity>(\n entityConstructor: EntityConstructor<TEntity>,\n): UseCaseDescriptor[] {\n return extractMetaUseCases(entityConstructor).map(metaUseCase => ({\n key: metaUseCase.key,\n binding: metaUseCase.binding,\n placement: metaUseCase.placement,\n alsoAt: metaUseCase.alsoAt,\n labelKey: metaUseCase.labelKey,\n keywordsKey: metaUseCase.keywordsKey,\n confirm: metaUseCase.confirm,\n reversible: metaUseCase.reversible,\n inverse: metaUseCase.inverse,\n availableWhen: metaUseCase.availableWhen,\n emphasis: metaUseCase.emphasis,\n priority: metaUseCase.priority,\n rowInline: metaUseCase.rowInline,\n shortcut: metaUseCase.shortcut,\n form: metaUseCase.form,\n ...(metaUseCase.payload === undefined ? {} : { takesInput: true as const }),\n variants: metaUseCase.variants,\n recipe: metaUseCase.recipe,\n }));\n}\n\n/**\n * Whether a surface offers `descriptor` on `record`: always, for a verb that\n * declares no {@link UseCaseAvailability}; otherwise only once the record has\n * arrived and its member holds one of the declared states. A record still in\n * flight offers none of its state-bound verbs, rather than all of them for a\n * moment.\n *\n * Presentation only — the verb's handler is what refuses an illegal move.\n */\nexport function isUseCaseAvailable(\n descriptor: Pick<UseCaseDescriptor, 'availableWhen'>,\n record: object | undefined,\n): boolean {\n const availability = descriptor.availableWhen;\n if (availability === undefined) return true;\n if (record === undefined) return false;\n const state = (record as Readonly<Record<string, unknown>>)[\n availability.member\n ];\n return typeof state === 'string' && availability.in.includes(state);\n}\n"],"names":["extractMetaUseCases","describeEntityUseCases","entityConstructor","map","metaUseCase","key","binding","placement","alsoAt","labelKey","keywordsKey","confirm","reversible","inverse","availableWhen","emphasis","priority","rowInline","shortcut","form","payload","undefined","takesInput","variants","recipe","isUseCaseAvailable","descriptor","record","availability","state","member","in","includes"],"mappings":";AACA,SAASA,mBAAmB,QAAQ,sBAAsB;AAqE1D;;;;;;;;;;CAUC,GACD,OAAO,SAASC,uBACdC,iBAA6C;IAE7C,OAAOF,oBAAoBE,mBAAmBC,GAAG,CAACC,CAAAA,cAAgB;YAChEC,KAAKD,YAAYC,GAAG;YACpBC,SAASF,YAAYE,OAAO;YAC5BC,WAAWH,YAAYG,SAAS;YAChCC,QAAQJ,YAAYI,MAAM;YAC1BC,UAAUL,YAAYK,QAAQ;YAC9BC,aAAaN,YAAYM,WAAW;YACpCC,SAASP,YAAYO,OAAO;YAC5BC,YAAYR,YAAYQ,UAAU;YAClCC,SAAST,YAAYS,OAAO;YAC5BC,eAAeV,YAAYU,aAAa;YACxCC,UAAUX,YAAYW,QAAQ;YAC9BC,UAAUZ,YAAYY,QAAQ;YAC9BC,WAAWb,YAAYa,SAAS;YAChCC,UAAUd,YAAYc,QAAQ;YAC9BC,MAAMf,YAAYe,IAAI;WAClBf,YAAYgB,OAAO,KAAKC,YAAY,CAAC,IAAI;YAAEC,YAAY;QAAc;YACzEC,UAAUnB,YAAYmB,QAAQ;YAC9BC,QAAQpB,YAAYoB,MAAM;;AAE9B;AAEA;;;;;;;;CAQC,GACD,OAAO,SAASC,mBACdC,UAAoD,EACpDC,MAA0B;IAE1B,MAAMC,eAAeF,WAAWZ,aAAa;IAC7C,IAAIc,iBAAiBP,WAAW,OAAO;IACvC,IAAIM,WAAWN,WAAW,OAAO;IACjC,MAAMQ,QAAQ,AAACF,MAA4C,CACzDC,aAAaE,MAAM,CACpB;IACD,OAAO,OAAOD,UAAU,YAAYD,aAAaG,EAAE,CAACC,QAAQ,CAACH;AAC/D"}
|
|
@@ -26,8 +26,11 @@ export interface EntityUseCaseRunner {
|
|
|
26
26
|
* Runs a verb on one record, or on nothing for an unbound verb. A verb that
|
|
27
27
|
* starts a flow answers {@link Pending}; one that finished answers
|
|
28
28
|
* {@link Settled} with what the service sent back.
|
|
29
|
+
*
|
|
30
|
+
* `payload` is the body a verb that {@link UseCaseDescriptor.takesInput}
|
|
31
|
+
* needs, as its form gathered it; a verb that takes none is run without.
|
|
29
32
|
*/
|
|
30
|
-
run(useCase: UseCaseDescriptor, id?: EntityId): Effect.Effect<WriteResult<unknown>, EntifixFailure>;
|
|
33
|
+
run(useCase: UseCaseDescriptor, id?: EntityId, payload?: unknown): Effect.Effect<WriteResult<unknown>, EntifixFailure>;
|
|
31
34
|
/** Runs a collection verb on a selection, one outcome per record. */
|
|
32
35
|
bulk(useCase: UseCaseDescriptor, selection: EntitySelection<Entity>): Effect.Effect<readonly BulkOutcome[], EntifixFailure>;
|
|
33
36
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-case-runner.d.ts","sourceRoot":"","sources":["../../src/use-case-runner/use-case-runner.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAErC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4DAA4D,CAAC;AACpG,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mEAAmE,CAAC;AACxG,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD;;;;;;;GAOG;AACH,eAAO,MAAM,QAAQ,GACnB,WAAW,MAAM,EACjB,YAAY,MAAM,EAClB,SAAS,cAAc,KACtB,IAAI,MAAM,EAG0B,CAAC;AAExC;;;;;GAKG;AACH,MAAM,WAAW,mBAAmB;IAClC
|
|
1
|
+
{"version":3,"file":"use-case-runner.d.ts","sourceRoot":"","sources":["../../src/use-case-runner/use-case-runner.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAErC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4DAA4D,CAAC;AACpG,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mEAAmE,CAAC;AACxG,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD;;;;;;;GAOG;AACH,eAAO,MAAM,QAAQ,GACnB,WAAW,MAAM,EACjB,YAAY,MAAM,EAClB,SAAS,cAAc,KACtB,IAAI,MAAM,EAG0B,CAAC;AAExC;;;;;GAKG;AACH,MAAM,WAAW,mBAAmB;IAClC;;;;;;;OAOG;IACH,GAAG,CACD,OAAO,EAAE,iBAAiB,EAC1B,EAAE,CAAC,EAAE,QAAQ,EACb,OAAO,CAAC,EAAE,OAAO,GAChB,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,OAAO,CAAC,EAAE,cAAc,CAAC,CAAC;IACvD,qEAAqE;IACrE,IAAI,CACF,OAAO,EAAE,iBAAiB,EAC1B,SAAS,EAAE,eAAe,CAAC,MAAM,CAAC,GACjC,MAAM,CAAC,MAAM,CAAC,SAAS,WAAW,EAAE,EAAE,cAAc,CAAC,CAAC;CAC1D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/use-case-runner/use-case-runner.ts"],"sourcesContent":["import type { Effect } from 'effect';\n\nimport type { UseCaseDescriptor } from '../entity-definition/describe/describe-entity-use-cases.js';\nimport type { UseCaseBinding } from '../entity-definition/meta-entities/meta-use-case/meta-use-case.js';\nimport type { EntifixFailure } from '../failure/failure.js';\nimport type { BulkOutcome } from '../types/BulkOutcome.js';\nimport type { Entity, EntityId } from '../types/Entity.js';\nimport type { EntitySelection } from '../types/EntitySelection.js';\nimport type { WriteResult } from './write-result.js';\n\n/**\n * The path a verb is served at, from its entity's key, its own key and its\n * binding\n * ([ADR 0020](../../../../../docs/adr/0020-endpoints-are-descriptors-and-the-shell-builds-an-httpapi.md)):\n * a verb on one record is `POST /api/<entity>/:id/<verb>`, one on a selection\n * or on nothing is `POST /api/<entity>/<verb>`. The shell serves it there and a\n * client calls it there, so the two cannot disagree.\n */\nexport const verbPath = (\n entityKey: string,\n useCaseKey: string,\n binding: UseCaseBinding,\n): `/${string}` =>\n binding === 'entity'\n ? `/api/${entityKey}/:id/${useCaseKey}`\n : `/api/${entityKey}/${useCaseKey}`;\n\n/**\n * Runs an entity's verbs for a screen — over REST against the service that\n * serves them, or in-process for a host whose records live in the browser.\n * Chosen at composition, the way a repository is, so a generated screen runs\n * a verb without knowing which.\n */\nexport interface EntityUseCaseRunner {\n /**\n * Runs a verb on one record, or on nothing for an unbound verb. A verb that\n * starts a flow answers {@link Pending}; one that finished answers\n * {@link Settled} with what the service sent back.\n */\n run(\n useCase: UseCaseDescriptor,\n id?: EntityId,\n ): Effect.Effect<WriteResult<unknown>, EntifixFailure>;\n /** Runs a collection verb on a selection, one outcome per record. */\n bulk(\n useCase: UseCaseDescriptor,\n selection: EntitySelection<Entity>,\n ): Effect.Effect<readonly BulkOutcome[], EntifixFailure>;\n}\n"],"names":["verbPath","entityKey","useCaseKey","binding"],"mappings":"AAUA;;;;;;;CAOC,GACD,OAAO,MAAMA,WAAW,CACtBC,WACAC,YACAC,UAEAA,YAAY,WACR,CAAC,KAAK,EAAEF,UAAU,KAAK,EAAEC,YAAY,GACrC,CAAC,KAAK,EAAED,UAAU,CAAC,EAAEC,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"sources":["../../src/use-case-runner/use-case-runner.ts"],"sourcesContent":["import type { Effect } from 'effect';\n\nimport type { UseCaseDescriptor } from '../entity-definition/describe/describe-entity-use-cases.js';\nimport type { UseCaseBinding } from '../entity-definition/meta-entities/meta-use-case/meta-use-case.js';\nimport type { EntifixFailure } from '../failure/failure.js';\nimport type { BulkOutcome } from '../types/BulkOutcome.js';\nimport type { Entity, EntityId } from '../types/Entity.js';\nimport type { EntitySelection } from '../types/EntitySelection.js';\nimport type { WriteResult } from './write-result.js';\n\n/**\n * The path a verb is served at, from its entity's key, its own key and its\n * binding\n * ([ADR 0020](../../../../../docs/adr/0020-endpoints-are-descriptors-and-the-shell-builds-an-httpapi.md)):\n * a verb on one record is `POST /api/<entity>/:id/<verb>`, one on a selection\n * or on nothing is `POST /api/<entity>/<verb>`. The shell serves it there and a\n * client calls it there, so the two cannot disagree.\n */\nexport const verbPath = (\n entityKey: string,\n useCaseKey: string,\n binding: UseCaseBinding,\n): `/${string}` =>\n binding === 'entity'\n ? `/api/${entityKey}/:id/${useCaseKey}`\n : `/api/${entityKey}/${useCaseKey}`;\n\n/**\n * Runs an entity's verbs for a screen — over REST against the service that\n * serves them, or in-process for a host whose records live in the browser.\n * Chosen at composition, the way a repository is, so a generated screen runs\n * a verb without knowing which.\n */\nexport interface EntityUseCaseRunner {\n /**\n * Runs a verb on one record, or on nothing for an unbound verb. A verb that\n * starts a flow answers {@link Pending}; one that finished answers\n * {@link Settled} with what the service sent back.\n *\n * `payload` is the body a verb that {@link UseCaseDescriptor.takesInput}\n * needs, as its form gathered it; a verb that takes none is run without.\n */\n run(\n useCase: UseCaseDescriptor,\n id?: EntityId,\n payload?: unknown,\n ): Effect.Effect<WriteResult<unknown>, EntifixFailure>;\n /** Runs a collection verb on a selection, one outcome per record. */\n bulk(\n useCase: UseCaseDescriptor,\n selection: EntitySelection<Entity>,\n ): Effect.Effect<readonly BulkOutcome[], EntifixFailure>;\n}\n"],"names":["verbPath","entityKey","useCaseKey","binding"],"mappings":"AAUA;;;;;;;CAOC,GACD,OAAO,MAAMA,WAAW,CACtBC,WACAC,YACAC,UAEAA,YAAY,WACR,CAAC,KAAK,EAAEF,UAAU,KAAK,EAAEC,YAAY,GACrC,CAAC,KAAK,EAAED,UAAU,CAAC,EAAEC,YAAY,CAAC"}
|
package/package.json
CHANGED