@ddd-ts-kit/kernel 0.11.0 → 0.12.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.
Files changed (58) hide show
  1. package/README.md +28 -4
  2. package/dist/application/cache/cache-purge-payload.d.ts +5 -0
  3. package/dist/application/cache/cache-purge-payload.d.ts.map +1 -0
  4. package/dist/application/cache/cache-purge-payload.js +2 -0
  5. package/dist/application/cache/cache-purge-payload.js.map +1 -0
  6. package/dist/application/cache/cache-purge-request.d.ts +19 -0
  7. package/dist/application/cache/cache-purge-request.d.ts.map +1 -0
  8. package/dist/application/cache/cache-purge-request.js +24 -0
  9. package/dist/application/cache/cache-purge-request.js.map +1 -0
  10. package/dist/application/cache/cache-tag.d.ts +8 -0
  11. package/dist/application/cache/cache-tag.d.ts.map +1 -0
  12. package/dist/application/cache/cache-tag.js +10 -0
  13. package/dist/application/cache/cache-tag.js.map +1 -0
  14. package/dist/application/cache/tenant-cache-tags.d.ts +7 -0
  15. package/dist/application/cache/tenant-cache-tags.d.ts.map +1 -0
  16. package/dist/application/cache/tenant-cache-tags.js +13 -0
  17. package/dist/application/cache/tenant-cache-tags.js.map +1 -0
  18. package/dist/application/persistence/expect-version.d.ts +13 -0
  19. package/dist/application/persistence/expect-version.d.ts.map +1 -0
  20. package/dist/application/persistence/expect-version.js +16 -0
  21. package/dist/application/persistence/expect-version.js.map +1 -0
  22. package/dist/application/ports/cache-invalidation.d.ts +11 -0
  23. package/dist/application/ports/cache-invalidation.d.ts.map +1 -0
  24. package/dist/application/ports/cache-invalidation.js +13 -0
  25. package/dist/application/ports/cache-invalidation.js.map +1 -0
  26. package/dist/application/ports/cache-purger.d.ts +9 -0
  27. package/dist/application/ports/cache-purger.d.ts.map +1 -0
  28. package/dist/application/ports/cache-purger.js +11 -0
  29. package/dist/application/ports/cache-purger.js.map +1 -0
  30. package/dist/domain/errors/precondition-failed-error.d.ts +12 -0
  31. package/dist/domain/errors/precondition-failed-error.d.ts.map +1 -0
  32. package/dist/domain/errors/precondition-failed-error.js +12 -0
  33. package/dist/domain/errors/precondition-failed-error.js.map +1 -0
  34. package/dist/index.d.ts +13 -0
  35. package/dist/index.d.ts.map +1 -1
  36. package/dist/index.js +13 -0
  37. package/dist/index.js.map +1 -1
  38. package/dist/infrastructure/cache/published-cache-invalidation.d.ts +33 -0
  39. package/dist/infrastructure/cache/published-cache-invalidation.d.ts.map +1 -0
  40. package/dist/infrastructure/cache/published-cache-invalidation.js +35 -0
  41. package/dist/infrastructure/cache/published-cache-invalidation.js.map +1 -0
  42. package/dist/infrastructure/cache/purging-publisher.d.ts +18 -0
  43. package/dist/infrastructure/cache/purging-publisher.d.ts.map +1 -0
  44. package/dist/infrastructure/cache/purging-publisher.js +33 -0
  45. package/dist/infrastructure/cache/purging-publisher.js.map +1 -0
  46. package/dist/infrastructure/cache/repeated-cache-purger.d.ts +25 -0
  47. package/dist/infrastructure/cache/repeated-cache-purger.d.ts.map +1 -0
  48. package/dist/infrastructure/cache/repeated-cache-purger.js +37 -0
  49. package/dist/infrastructure/cache/repeated-cache-purger.js.map +1 -0
  50. package/dist/infrastructure/in-memory/in-memory-cache-invalidation.d.ts +7 -0
  51. package/dist/infrastructure/in-memory/in-memory-cache-invalidation.d.ts.map +1 -0
  52. package/dist/infrastructure/in-memory/in-memory-cache-invalidation.js +8 -0
  53. package/dist/infrastructure/in-memory/in-memory-cache-invalidation.js.map +1 -0
  54. package/dist/infrastructure/in-memory/in-memory-cache-purger.d.ts +13 -0
  55. package/dist/infrastructure/in-memory/in-memory-cache-purger.d.ts.map +1 -0
  56. package/dist/infrastructure/in-memory/in-memory-cache-purger.js +23 -0
  57. package/dist/infrastructure/in-memory/in-memory-cache-purger.js.map +1 -0
  58. package/package.json +1 -1
package/README.md CHANGED
@@ -12,18 +12,18 @@ npm i @ddd-ts-kit/kernel
12
12
 
13
13
  | Area | Exports |
14
14
  |---|---|
15
- | Domain | `Entity`, `AggregateRoot` (version, recorded events), `ValueObject`, `DomainEvent`, `DomainError` with a stable `code`, `ConceptError` (the errors of one concept, each built by a static factory: see "Domain errors"), `isRefusal`, `CodeOf`, `RefusalOf`, `Refusal`, `RefusalFacts`, the generic `InvariantViolation`, `NotFoundError`, `ConflictError`, `ConcurrencyError`, `Result` with `ok`, `err`, `unwrap` |
15
+ | Domain | `Entity`, `AggregateRoot` (version, recorded events), `ValueObject`, `DomainEvent`, `DomainError` with a stable `code`, `ConceptError` (the errors of one concept, each built by a static factory: see "Domain errors"), `isRefusal`, `CodeOf`, `RefusalOf`, `Refusal`, `RefusalFacts`, the generic `InvariantViolation`, `NotFoundError`, `ConflictError`, `ConcurrencyError`, `PreconditionFailedError`, `Result` with `ok`, `err`, `unwrap` |
16
16
  | Ports | `Clock`, `IdGenerator`, `UnitOfWork`, `Repository` (abstract classes: each one is its own injection token), `UseCase`, `DependencyKind` (the roles a binding declares, read by di, tracing and aspects: `repository`, `gateway`, `external`, `use-case`, `publisher`, `consumer`, `domain-event-handler`, `job`) |
17
17
  | Buses | `Command`, `Query`, `CommandBus`, `QueryBus`, `BusMiddleware`, the in-process `InMemoryCommandBus` and `InMemoryQueryBus` (`register(type, handler, { context })` names the bounded context in `MessageInfo`), `unitOfWorkMiddleware` |
18
18
  | Events | `IntegrationEvent`, `IntegrationEventPublisher`, `IntegrationEventSubscriber`, `EventBus` (both at once), `EventSubscribers` (the subscriber of each bounded context), `ProcessedEventStore`, `idempotent`, `InMemoryEventBus`, `DomainEventDispatcher`, `IntegrationEventCallback` and `DomainEventCallback` (the functions a subscriber and a dispatcher are given), `executionContextOfEvent`, `inEventScope`, `scopedPublisher`, `EventDelivery` (what a provider says of one delivery: attempt, last attempt, transport, source, consumer), `messagingSystemOf` |
19
19
  | Domain events and the unit of work | `dispatchingOnSave` (the wrapper that makes a repository hand over what the aggregates it is given recorded), `announceDomainEvents`, `withinUnitOfWork` (what every `UnitOfWork.run` is built on: queue, dispatch before the commit, `after-commit` phase), `unitOfWorkStage` and `UnitOfWorkStage`, `DomainEventPhase`, `DomainEventSubscription`, `SaveAfterCommitError`, `AfterCommitFailure`, `reportAfterCommitFailures`, `InMemoryDomainEventDispatcher` |
20
20
  | Actor | `Actor`, `AuthorizedCommand`, `AuthorizedQuery`, `ActorContext` |
21
- | Standard interfaces | `Session`, `ExecutionContext` and `ExecutionScope`, `Logger`, `Metrics`, `ErrorReporter`, `Cache`, `Lock`, `RateLimiter`, `Page` and `PageRequest`, `AuditStamp`, `TenantScoped`, `AuditTrail`, `AuditReader` and `AuditEntry` |
21
+ | Standard interfaces | `Session`, `ExecutionContext` and `ExecutionScope`, `Logger`, `Metrics`, `ErrorReporter`, `Cache`, `CacheInvalidation` and `CachePurger` (with `cacheTag`, `tenantCacheTags`, `CachePurgeRequest`, `PublishedCacheInvalidation`, `PurgingPublisher`, `RepeatedCachePurger`: see "Purging the HTTP caches"), `Lock`, `RateLimiter`, `Page` and `PageRequest`, `AuditStamp`, `TenantScoped`, `AuditTrail`, `AuditReader` and `AuditEntry` |
22
22
  | Scheduled jobs | `JobScheduler`, `ScheduledJob`, `JobExecution`, `JobSchedule`, `JobOptions`, `JobDefinition`, `JobRun`, `JobDescription`, `parseJobSchedule`, `describeJobSchedule`, `jobPolicy`, `executionContextOfJob` |
23
23
  | Read side | `Criteria`, `defineCriteria`, `validateCriteria`, `scoped`, `planCriteria`, `evaluateCriteria`, `pageOfPlan`, `hydrate`, `ReadModelStore`, `stampOf`, `TableReadModelStore`, `ProjectionRebuild`, `InMemoryReadModelStore` (see "Criteria", "Hydration" and "Projections") |
24
- | Persistence helpers | `optimisticUpdate`, `schemaNameOf`, `stampCreation`, `stampUpdate`, `tenantScopeOf`, `encodeCursor`, `decodeCursor` |
24
+ | Persistence helpers | `optimisticUpdate`, `expectVersion` (the version a caller read, `If-Match` over HTTP, still the current one, else `PreconditionFailedError`: 412), `schemaNameOf`, `stampCreation`, `stampUpdate`, `tenantScopeOf`, `encodeCursor`, `decodeCursor` |
25
25
  | Error reporting | `ErrorReporter`, `ErrorReport`, `errorReportOf`, `reportOnce`, `isUnexpectedError`, `errorReportingMiddleware`, `DeadLetterReports`, `reportProcessFailures`, `NoopErrorReporter` |
26
- | Doubles | `FixedClock`, `SequentialIdGenerator`, `InMemoryUnitOfWork`, `FixedActorContext`, `FixedExecutionScope`, `InMemoryLogger`, `InMemoryMetrics`, `InMemoryErrorReporter`, `InMemoryCache`, `InMemoryLock`, `InMemoryRateLimiter` |
26
+ | Doubles | `FixedClock`, `SequentialIdGenerator`, `InMemoryUnitOfWork`, `FixedActorContext`, `FixedExecutionScope`, `InMemoryLogger`, `InMemoryMetrics`, `InMemoryErrorReporter`, `InMemoryCache`, `InMemoryCacheInvalidation`, `InMemoryCachePurger`, `InMemoryLock`, `InMemoryRateLimiter` |
27
27
  | Declarations (`@ddd-ts-kit/kernel/declarations`) | `Requires`, `Public`, `CommandHandler`, `QueryHandler`, `IntegrationEventHandler`, `DomainEventHandler`, `Scheduled`, `Projection`, `On`, `Repository`, `Gateway`, `Adapter`, `Policy`, `injected`, `injectedDependencies`, `declarationOf`, `listDeclarations`, `Token`, `describeToken`, `tokenIdentity`, `portDefect` |
28
28
 
29
29
  The rules these blocks serve are in `docs/ARCHITECTURE.md`.
@@ -763,6 +763,30 @@ The key carries the type of its value. `InMemoryCache(clock, { maxEntries? })` e
763
763
  `Clock` and is bounded. `tenantCacheKey<Quote>(scope, 'quote', pair)` is the same key confined to
764
764
  the tenant of the work in progress: what one tenant cached is never served to another.
765
765
 
766
+ ### Purging the HTTP caches
767
+
768
+ Two ports, so that a use case can never purge before its commit:
769
+
770
+ | Port | Called by | Does |
771
+ |---|---|---|
772
+ | `CacheInvalidation.invalidate(tags)` | a `before-commit` handler of the domain event that changed what the answers show | asks for the tags to be purged once the work commits; `domain-events/transactional-before-commit` allows it |
773
+ | `CachePurger.purge(tags)` | the relay of the outbox, never a use case (refused before the commit) | purges a shared cache now: `InMemoryCachePurger` here, Varnish and the CDNs in `@ddd-ts-kit/http/purgers` |
774
+
775
+ `cacheTag('calendar', id)` names a resource (`calendar:c-1`, the identifier percent-encoded),
776
+ `cacheTag('calendar')` every resource of a kind; the routes of `@ddd-ts-kit/http` tag their
777
+ answers with the same function. `PublishedCacheInvalidation({ publisher, ids, clock, scope, perTenant? })`,
778
+ what `kernelModule()` of `@ddd-ts-kit/di` binds, publishes one `CachePurgeRequest` on the
779
+ publisher, the tags under the tenant of the work (`tenantCacheTags`) when `perTenant` is set, as
780
+ a multi-tenant application whose answers are tagged per tenant sets it (work that names no tenant
781
+ is then refused with `NoCurrentTenantError`: its purge would meet no answer): behind an outbox it
782
+ is a row of the transaction, gone with a rollback, kept across a crash after the commit.
783
+ `new PurgingPublisher(purger, broker)` is what the relay publishes through: the purge requests
784
+ go to the purger, the other events to the broker, and a failed purge throws so that the relay
785
+ retries it. `new RepeatedCachePurger(purger, { againAfterMs, onFailure? })` purges, then the same
786
+ tags once more `againAfterMs` later, for a read that loaded the previous state before the commit
787
+ and reached the cache after the first purge; the second purge is best effort, reported to
788
+ `onFailure`. `InMemoryCacheInvalidation` remembers the tags asked for (`invalidated`), for specs.
789
+
766
790
  ### Lock
767
791
 
768
792
  ```ts
@@ -0,0 +1,5 @@
1
+ /** What a purge request carries: the tags to purge, already filed under their tenant. */
2
+ export interface CachePurgePayload {
3
+ readonly tags: readonly string[];
4
+ }
5
+ //# sourceMappingURL=cache-purge-payload.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cache-purge-payload.d.ts","sourceRoot":"","sources":["../../../src/application/cache/cache-purge-payload.ts"],"names":[],"mappings":"AAAA,yFAAyF;AACzF,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,CAAC;CAClC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=cache-purge-payload.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cache-purge-payload.js","sourceRoot":"","sources":["../../../src/application/cache/cache-purge-payload.ts"],"names":[],"mappings":""}
@@ -0,0 +1,19 @@
1
+ import type { IntegrationEvent } from '../events/integration-event.js';
2
+ import type { CachePurgePayload } from './cache-purge-payload.js';
3
+ /**
4
+ * The message that asks for tags to be purged once the work that asked has committed. It
5
+ * travels as an integration event on the outbox of the application, so it commits or rolls back
6
+ * with that work, and the relay hands it to a `CachePurger` instead of the broker. It is a
7
+ * message of the kit, never part of the published language of a context.
8
+ */
9
+ export declare const CachePurgeRequest: {
10
+ readonly type: "kit.cache.purge-requested";
11
+ readonly version: 1;
12
+ readonly of: (tags: readonly string[], meta: {
13
+ readonly id: string;
14
+ readonly occurredAt: string;
15
+ }) => IntegrationEvent<CachePurgePayload>;
16
+ /** The tags a purge request names; `undefined` for any other event. */
17
+ readonly tagsOf: (event: IntegrationEvent) => readonly string[] | undefined;
18
+ };
19
+ //# sourceMappingURL=cache-purge-request.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cache-purge-request.d.ts","sourceRoot":"","sources":["../../../src/application/cache/cache-purge-request.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AACvE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAKlE;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB;aAC5B,IAAI;aACJ,OAAO;aAEP,EAAE,SACM,SAAS,MAAM,EAAE,QACjB;QAAE,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;KAAE,KACzD,gBAAgB,CAAC,iBAAiB,CAAC;IAItC,uEAAuE;aACvE,MAAM,UAAQ,gBAAgB,KAAG,SAAS,MAAM,EAAE,GAAG,SAAS;CAStD,CAAC"}
@@ -0,0 +1,24 @@
1
+ const TYPE = 'kit.cache.purge-requested';
2
+ const VERSION = 1;
3
+ /**
4
+ * The message that asks for tags to be purged once the work that asked has committed. It
5
+ * travels as an integration event on the outbox of the application, so it commits or rolls back
6
+ * with that work, and the relay hands it to a `CachePurger` instead of the broker. It is a
7
+ * message of the kit, never part of the published language of a context.
8
+ */
9
+ export const CachePurgeRequest = {
10
+ type: TYPE,
11
+ version: VERSION,
12
+ of(tags, meta) {
13
+ return { id: meta.id, type: TYPE, version: VERSION, occurredAt: meta.occurredAt, payload: { tags: [...tags] } };
14
+ },
15
+ /** The tags a purge request names; `undefined` for any other event. */
16
+ tagsOf(event) {
17
+ if (event.type !== TYPE || typeof event.payload !== 'object' || event.payload === null) {
18
+ return undefined;
19
+ }
20
+ const tags = Reflect.get(event.payload, 'tags');
21
+ return Array.isArray(tags) ? tags.filter((tag) => typeof tag === 'string') : undefined;
22
+ },
23
+ };
24
+ //# sourceMappingURL=cache-purge-request.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cache-purge-request.js","sourceRoot":"","sources":["../../../src/application/cache/cache-purge-request.ts"],"names":[],"mappings":"AAGA,MAAM,IAAI,GAAG,2BAA2B,CAAC;AACzC,MAAM,OAAO,GAAG,CAAC,CAAC;AAElB;;;;;GAKG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,IAAI,EAAE,IAAI;IACV,OAAO,EAAE,OAAO;IAEhB,EAAE,CACA,IAAuB,EACvB,IAA0D;QAE1D,OAAO,EAAE,EAAE,EAAE,IAAI,CAAC,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,CAAC,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC;IAClH,CAAC;IAED,uEAAuE;IACvE,MAAM,CAAC,KAAuB;QAC5B,IAAI,KAAK,CAAC,IAAI,KAAK,IAAI,IAAI,OAAO,KAAK,CAAC,OAAO,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,KAAK,IAAI,EAAE,CAAC;YACvF,OAAO,SAAS,CAAC;QACnB,CAAC;QAED,MAAM,IAAI,GAAY,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QAEzD,OAAO,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,EAAiB,EAAE,CAAC,OAAO,GAAG,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IACxG,CAAC;CACO,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * The tag a shared cache files an answer under, for the resource it shows: `cacheTag('calendar',
3
+ * 'c-1')` is `calendar:c-1`, `cacheTag('calendar')` names every calendar. The answer and the purge
4
+ * name a resource with the same function, so they always meet. The identifier is percent-encoded:
5
+ * a tag holds no space and no comma, which separate tags in the headers of the caches.
6
+ */
7
+ export declare function cacheTag(resource: string, id?: string | number): string;
8
+ //# sourceMappingURL=cache-tag.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cache-tag.d.ts","sourceRoot":"","sources":["../../../src/application/cache/cache-tag.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAEvE"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * The tag a shared cache files an answer under, for the resource it shows: `cacheTag('calendar',
3
+ * 'c-1')` is `calendar:c-1`, `cacheTag('calendar')` names every calendar. The answer and the purge
4
+ * name a resource with the same function, so they always meet. The identifier is percent-encoded:
5
+ * a tag holds no space and no comma, which separate tags in the headers of the caches.
6
+ */
7
+ export function cacheTag(resource, id) {
8
+ return id === undefined ? resource : `${resource}:${encodeURIComponent(String(id))}`;
9
+ }
10
+ //# sourceMappingURL=cache-tag.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cache-tag.js","sourceRoot":"","sources":["../../../src/application/cache/cache-tag.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,UAAU,QAAQ,CAAC,QAAgB,EAAE,EAAoB;IAC7D,OAAO,EAAE,KAAK,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,QAAQ,IAAI,kBAAkB,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC;AACvF,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * The tags of a tenant: each one under the identifier of the tenant, `acme/calendar:c-1`, so
3
+ * that a purge for one tenant never reaches the answers of another, and a kind (`calendar`) is
4
+ * purged tenant by tenant. Without a tenant, the tags as they are.
5
+ */
6
+ export declare function tenantCacheTags(tags: readonly string[], tenantId: string | undefined): readonly string[];
7
+ //# sourceMappingURL=tenant-cache-tags.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tenant-cache-tags.d.ts","sourceRoot":"","sources":["../../../src/application/cache/tenant-cache-tags.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,EAAE,QAAQ,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,MAAM,EAAE,CAQxG"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * The tags of a tenant: each one under the identifier of the tenant, `acme/calendar:c-1`, so
3
+ * that a purge for one tenant never reaches the answers of another, and a kind (`calendar`) is
4
+ * purged tenant by tenant. Without a tenant, the tags as they are.
5
+ */
6
+ export function tenantCacheTags(tags, tenantId) {
7
+ if (tenantId === undefined) {
8
+ return tags;
9
+ }
10
+ const prefix = `${encodeURIComponent(tenantId)}/`;
11
+ return tags.map((tag) => `${prefix}${tag}`);
12
+ }
13
+ //# sourceMappingURL=tenant-cache-tags.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tenant-cache-tags.js","sourceRoot":"","sources":["../../../src/application/cache/tenant-cache-tags.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAAC,IAAuB,EAAE,QAA4B;IACnF,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;QAC3B,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,MAAM,GAAG,GAAG,kBAAkB,CAAC,QAAQ,CAAC,GAAG,CAAC;IAElD,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,MAAM,GAAG,GAAG,EAAE,CAAC,CAAC;AAC9C,CAAC"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Refuses to change an element whose version is not the one the caller read: the version an
3
+ * HTTP client sent in `If-Match`, handed over in the command. Nothing is checked when the caller
4
+ * named none.
5
+ *
6
+ * const calendar = await this.calendars.findById(command.calendarId);
7
+ * expectVersion(calendar, command.expectedVersion);
8
+ */
9
+ export declare function expectVersion(element: {
10
+ readonly id: string | number;
11
+ readonly version: number;
12
+ }, expected: number | undefined): void;
13
+ //# sourceMappingURL=expect-version.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"expect-version.d.ts","sourceRoot":"","sources":["../../../src/application/persistence/expect-version.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAC3B,OAAO,EAAE;IAAE,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;CAAE,EACnE,QAAQ,EAAE,MAAM,GAAG,SAAS,GAC3B,IAAI,CAQN"}
@@ -0,0 +1,16 @@
1
+ import { PreconditionFailedError } from '../../domain/errors/precondition-failed-error.js';
2
+ /**
3
+ * Refuses to change an element whose version is not the one the caller read: the version an
4
+ * HTTP client sent in `If-Match`, handed over in the command. Nothing is checked when the caller
5
+ * named none.
6
+ *
7
+ * const calendar = await this.calendars.findById(command.calendarId);
8
+ * expectVersion(calendar, command.expectedVersion);
9
+ */
10
+ export function expectVersion(element, expected) {
11
+ if (expected === undefined || element.version === expected) {
12
+ return;
13
+ }
14
+ throw new PreconditionFailedError(`${element.id} is at version ${element.version}, and the change was made on version ${expected}.`);
15
+ }
16
+ //# sourceMappingURL=expect-version.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"expect-version.js","sourceRoot":"","sources":["../../../src/application/persistence/expect-version.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,kDAAkD,CAAC;AAE3F;;;;;;;GAOG;AACH,MAAM,UAAU,aAAa,CAC3B,OAAmE,EACnE,QAA4B;IAE5B,IAAI,QAAQ,KAAK,SAAS,IAAI,OAAO,CAAC,OAAO,KAAK,QAAQ,EAAE,CAAC;QAC3D,OAAO;IACT,CAAC;IAED,MAAM,IAAI,uBAAuB,CAC/B,GAAG,OAAO,CAAC,EAAE,kBAAkB,OAAO,CAAC,OAAO,wCAAwC,QAAQ,GAAG,CAClG,CAAC;AACJ,CAAC"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Asks for the answers filed under the tags (`cacheTag('calendar', id)`) to be purged from the
3
+ * shared caches once the work in progress has committed: never when it rolls back, and even when
4
+ * the process stops right after the commit. Called by a `before-commit` handler of the domain
5
+ * event that changed what those answers show. A multi-tenant application files them under the
6
+ * tenant of the work.
7
+ */
8
+ export declare abstract class CacheInvalidation {
9
+ abstract invalidate(tags: readonly string[]): Promise<void>;
10
+ }
11
+ //# sourceMappingURL=cache-invalidation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cache-invalidation.d.ts","sourceRoot":"","sources":["../../../src/application/ports/cache-invalidation.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,8BAAsB,iBAAiB;IAKrC,QAAQ,CAAC,UAAU,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC7D"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Asks for the answers filed under the tags (`cacheTag('calendar', id)`) to be purged from the
3
+ * shared caches once the work in progress has committed: never when it rolls back, and even when
4
+ * the process stops right after the commit. Called by a `before-commit` handler of the domain
5
+ * event that changed what those answers show. A multi-tenant application files them under the
6
+ * tenant of the work.
7
+ */
8
+ export class CacheInvalidation {
9
+ static {
10
+ Object.defineProperty(this, 'tokenKey', { value: 'kernel.CacheInvalidation' });
11
+ }
12
+ }
13
+ //# sourceMappingURL=cache-invalidation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cache-invalidation.js","sourceRoot":"","sources":["../../../src/application/ports/cache-invalidation.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,OAAgB,iBAAiB;IACrC;QACE,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,UAAU,EAAE,EAAE,KAAK,EAAE,0BAA0B,EAAE,CAAC,CAAC;IACjF,CAAC;CAGF"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Removes from a shared cache (Varnish, a CDN) every answer filed under one of the tags, now.
3
+ * Idempotent: a tag nothing is filed under purges nothing, and purging twice is purging once.
4
+ * A use case never calls it: it asks `CacheInvalidation`, which purges after its commit.
5
+ */
6
+ export declare abstract class CachePurger {
7
+ abstract purge(tags: readonly string[]): Promise<void>;
8
+ }
9
+ //# sourceMappingURL=cache-purger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cache-purger.d.ts","sourceRoot":"","sources":["../../../src/application/ports/cache-purger.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,8BAAsB,WAAW;IAK/B,QAAQ,CAAC,KAAK,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACxD"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Removes from a shared cache (Varnish, a CDN) every answer filed under one of the tags, now.
3
+ * Idempotent: a tag nothing is filed under purges nothing, and purging twice is purging once.
4
+ * A use case never calls it: it asks `CacheInvalidation`, which purges after its commit.
5
+ */
6
+ export class CachePurger {
7
+ static {
8
+ Object.defineProperty(this, 'tokenKey', { value: 'kernel.CachePurger' });
9
+ }
10
+ }
11
+ //# sourceMappingURL=cache-purger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cache-purger.js","sourceRoot":"","sources":["../../../src/application/ports/cache-purger.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,OAAgB,WAAW;IAC/B;QACE,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,UAAU,EAAE,EAAE,KAAK,EAAE,oBAAoB,EAAE,CAAC,CAAC;IAC3E,CAAC;CAGF"}
@@ -0,0 +1,12 @@
1
+ import { DomainError } from './domain-error.js';
2
+ /** The code of a write refused because the version the caller read is no longer the current one. */
3
+ export declare const PRECONDITION_FAILED = "PRECONDITION_FAILED";
4
+ /**
5
+ * The caller acted on a version of the element it read, and the element changed since: answered
6
+ * 412 over HTTP, where the version came in `If-Match`. Unlike a `ConcurrencyError`, nobody wrote
7
+ * at the same instant: the caller read long enough ago for somebody else to write in between.
8
+ */
9
+ export declare class PreconditionFailedError extends DomainError {
10
+ readonly code = "PRECONDITION_FAILED";
11
+ }
12
+ //# sourceMappingURL=precondition-failed-error.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"precondition-failed-error.d.ts","sourceRoot":"","sources":["../../../src/domain/errors/precondition-failed-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,oGAAoG;AACpG,eAAO,MAAM,mBAAmB,wBAAwB,CAAC;AAEzD;;;;GAIG;AACH,qBAAa,uBAAwB,SAAQ,WAAW;IACtD,QAAQ,CAAC,IAAI,yBAAuB;CACrC"}
@@ -0,0 +1,12 @@
1
+ import { DomainError } from './domain-error.js';
2
+ /** The code of a write refused because the version the caller read is no longer the current one. */
3
+ export const PRECONDITION_FAILED = 'PRECONDITION_FAILED';
4
+ /**
5
+ * The caller acted on a version of the element it read, and the element changed since: answered
6
+ * 412 over HTTP, where the version came in `If-Match`. Unlike a `ConcurrencyError`, nobody wrote
7
+ * at the same instant: the caller read long enough ago for somebody else to write in between.
8
+ */
9
+ export class PreconditionFailedError extends DomainError {
10
+ code = PRECONDITION_FAILED;
11
+ }
12
+ //# sourceMappingURL=precondition-failed-error.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"precondition-failed-error.js","sourceRoot":"","sources":["../../../src/domain/errors/precondition-failed-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,oGAAoG;AACpG,MAAM,CAAC,MAAM,mBAAmB,GAAG,qBAAqB,CAAC;AAEzD;;;;GAIG;AACH,MAAM,OAAO,uBAAwB,SAAQ,WAAW;IAC7C,IAAI,GAAG,mBAAmB,CAAC;CACrC"}
package/dist/index.d.ts CHANGED
@@ -14,6 +14,7 @@ export * from './domain/errors/domain-error.js';
14
14
  export * from './domain/errors/invariant-violation.js';
15
15
  export * from './domain/errors/is-refusal.js';
16
16
  export * from './domain/errors/not-found-error.js';
17
+ export * from './domain/errors/precondition-failed-error.js';
17
18
  export * from './domain/errors/refusal-facts.js';
18
19
  export * from './domain/errors/refusal-of.js';
19
20
  export * from './domain/errors/refusal.js';
@@ -63,6 +64,10 @@ export * from './application/audit/tenant-scoped.js';
63
64
  export * from './application/audit/update-stamp.js';
64
65
  export * from './application/background/index.js';
65
66
  export * from './application/cache/cache-key.js';
67
+ export * from './application/cache/cache-purge-payload.js';
68
+ export * from './application/cache/cache-purge-request.js';
69
+ export * from './application/cache/cache-tag.js';
70
+ export * from './application/cache/tenant-cache-tags.js';
66
71
  export * from './application/cache/tenant-cache-key.js';
67
72
  export * from './application/dependency-kind.js';
68
73
  export * from './application/error-reporting/error-origin.js';
@@ -156,12 +161,15 @@ export * from './application/pagination/page.js';
156
161
  export * from './application/pagination/sort-direction.js';
157
162
  export * from './application/pagination/sort.js';
158
163
  export * from './application/persistence/append-changes.js';
164
+ export * from './application/persistence/expect-version.js';
159
165
  export * from './application/persistence/optimistic-update.js';
160
166
  export * from './application/persistence/schema-name-of.js';
161
167
  export * from './application/ports/actor-context.js';
162
168
  export * from './application/ports/audit-reader.js';
163
169
  export * from './application/ports/audit-trail.js';
164
170
  export * from './application/ports/cache.js';
171
+ export * from './application/ports/cache-invalidation.js';
172
+ export * from './application/ports/cache-purger.js';
165
173
  export * from './application/ports/checkpoint-store.js';
166
174
  export * from './application/ports/clock.js';
167
175
  export * from './application/ports/command-bus.js';
@@ -255,6 +263,9 @@ export * from './infrastructure/context/async-local-storage-execution-scope.js';
255
263
  export * from './infrastructure/context/fixed-actor-context.js';
256
264
  export * from './infrastructure/context/fixed-execution-scope.js';
257
265
  export * from './infrastructure/context/scoped-actor-context.js';
266
+ export * from './infrastructure/cache/published-cache-invalidation.js';
267
+ export * from './infrastructure/cache/purging-publisher.js';
268
+ export * from './infrastructure/cache/repeated-cache-purger.js';
258
269
  export * from './infrastructure/error-reporting/dead-letter-error.js';
259
270
  export * from './infrastructure/error-reporting/dead-letter-reports.js';
260
271
  export * from './infrastructure/error-reporting/report-process-failures.js';
@@ -301,6 +312,8 @@ export * from './infrastructure/id/sequential-id-generator.js';
301
312
  export * from './infrastructure/id/uuid-generator.js';
302
313
  export * from './infrastructure/in-memory/error-reporting-middleware.js';
303
314
  export * from './infrastructure/in-memory/in-memory-cache.js';
315
+ export * from './infrastructure/in-memory/in-memory-cache-invalidation.js';
316
+ export * from './infrastructure/in-memory/in-memory-cache-purger.js';
304
317
  export * from './infrastructure/in-memory/in-memory-checkpoint-store.js';
305
318
  export * from './infrastructure/in-memory/in-memory-command-bus.js';
306
319
  export * from './infrastructure/in-memory/in-memory-domain-event-dispatcher.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC;AAC3C,cAAc,0BAA0B,CAAC;AACzC,cAAc,oBAAoB,CAAC;AACnC,cAAc,8CAA8C,CAAC;AAC7D,cAAc,+CAA+C,CAAC;AAC9D,cAAc,qC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;AAC3D,cAAc,uCAAuC,CAAC;AACtD,cAAc,gDAAgD,CAAC;AAC/D,cAAc,uCAAuC,CAAC;AACtD,cAAc,0DAA0D,CAAC;AACzE,cAAc,+CAA+C,CAAC;AAC9D,cAAc,4DAA4D,CAAC;AAC3E,cAAc,sDAAsD,CAAC;AACrE,cAAc,0DAA0D,CAAC;AACzE,cAAc,qDAAqD,CAAC;AACpE,cAAc,iEAAiE,CAAC;AAChF,cAAc,wDAAwD,CAAC;AACvE,cAAc,mDAAmD,CAAC;AAClE,cAAc,qDAAqD,CAAC;AACpE,cAAc,8CAA8C,CAAC;AAC7D,cAAc,gDAAgD,CAAC;AAC/D,cAAc,iDAAiD,CAAC;AAChE,cAAc,uDAAuD,CAAC;AACtE,cAAc,+DAA+D,CAAC;AAC9E,cAAc,mDAAmD,CAAC;AAClE,cAAc,0DAA0D,CAAC;AACzE,cAAc,0DAA0D,CAAC;AACzE,cAAc,wDAAwD,CAAC;AACvE,cAAc,2DAA2D,CAAC;AAC1E,cAAc,sDAAsD,CAAC;AACrE,cAAc,sDAAsD,CAAC;AACrE,cAAc,6CAA6C,CAAC;AAC5D,cAAc,uDAAuD,CAAC;AACtE,cAAc,0DAA0D,CAAC;AACzE,cAAc,4DAA4D,CAAC;AAC3E,cAAc,mDAAmD,CAAC;AAClE,cAAc,wDAAwD,CAAC;AACvE,cAAc,wCAAwC,CAAC;AACvD,cAAc,uDAAuD,CAAC;AACtE,cAAc,+CAA+C,CAAC;AAC9D,cAAc,8CAA8C,CAAC;AAC7D,cAAc,sCAAsC,CAAC;AACrD,cAAc,uCAAuC,CAAC;AACtD,cAAc,6CAA6C,CAAC;AAC5D,cAAc,mDAAmD,CAAC;AAClE,cAAc,uDAAuD,CAAC;AACtE,cAAc,uDAAuD,CAAC"}
package/dist/index.js CHANGED
@@ -14,6 +14,7 @@ export * from './domain/errors/domain-error.js';
14
14
  export * from './domain/errors/invariant-violation.js';
15
15
  export * from './domain/errors/is-refusal.js';
16
16
  export * from './domain/errors/not-found-error.js';
17
+ export * from './domain/errors/precondition-failed-error.js';
17
18
  export * from './domain/errors/refusal-facts.js';
18
19
  export * from './domain/errors/refusal-of.js';
19
20
  export * from './domain/errors/refusal.js';
@@ -63,6 +64,10 @@ export * from './application/audit/tenant-scoped.js';
63
64
  export * from './application/audit/update-stamp.js';
64
65
  export * from './application/background/index.js';
65
66
  export * from './application/cache/cache-key.js';
67
+ export * from './application/cache/cache-purge-payload.js';
68
+ export * from './application/cache/cache-purge-request.js';
69
+ export * from './application/cache/cache-tag.js';
70
+ export * from './application/cache/tenant-cache-tags.js';
66
71
  export * from './application/cache/tenant-cache-key.js';
67
72
  export * from './application/dependency-kind.js';
68
73
  export * from './application/error-reporting/error-origin.js';
@@ -156,12 +161,15 @@ export * from './application/pagination/page.js';
156
161
  export * from './application/pagination/sort-direction.js';
157
162
  export * from './application/pagination/sort.js';
158
163
  export * from './application/persistence/append-changes.js';
164
+ export * from './application/persistence/expect-version.js';
159
165
  export * from './application/persistence/optimistic-update.js';
160
166
  export * from './application/persistence/schema-name-of.js';
161
167
  export * from './application/ports/actor-context.js';
162
168
  export * from './application/ports/audit-reader.js';
163
169
  export * from './application/ports/audit-trail.js';
164
170
  export * from './application/ports/cache.js';
171
+ export * from './application/ports/cache-invalidation.js';
172
+ export * from './application/ports/cache-purger.js';
165
173
  export * from './application/ports/checkpoint-store.js';
166
174
  export * from './application/ports/clock.js';
167
175
  export * from './application/ports/command-bus.js';
@@ -255,6 +263,9 @@ export * from './infrastructure/context/async-local-storage-execution-scope.js';
255
263
  export * from './infrastructure/context/fixed-actor-context.js';
256
264
  export * from './infrastructure/context/fixed-execution-scope.js';
257
265
  export * from './infrastructure/context/scoped-actor-context.js';
266
+ export * from './infrastructure/cache/published-cache-invalidation.js';
267
+ export * from './infrastructure/cache/purging-publisher.js';
268
+ export * from './infrastructure/cache/repeated-cache-purger.js';
258
269
  export * from './infrastructure/error-reporting/dead-letter-error.js';
259
270
  export * from './infrastructure/error-reporting/dead-letter-reports.js';
260
271
  export * from './infrastructure/error-reporting/report-process-failures.js';
@@ -301,6 +312,8 @@ export * from './infrastructure/id/sequential-id-generator.js';
301
312
  export * from './infrastructure/id/uuid-generator.js';
302
313
  export * from './infrastructure/in-memory/error-reporting-middleware.js';
303
314
  export * from './infrastructure/in-memory/in-memory-cache.js';
315
+ export * from './infrastructure/in-memory/in-memory-cache-invalidation.js';
316
+ export * from './infrastructure/in-memory/in-memory-cache-purger.js';
304
317
  export * from './infrastructure/in-memory/in-memory-checkpoint-store.js';
305
318
  export * from './infrastructure/in-memory/in-memory-command-bus.js';
306
319
  export * from './infrastructure/in-memory/in-memory-domain-event-dispatcher.js';
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC;AAC3C,cAAc,0BAA0B,CAAC;AACzC,cAAc,oBAAoB,CAAC;AACnC,cAAc,8CAA8C,CAAC;AAC7D,cAAc,+CAA+C,CAAC;AAC9D,cAAc,qCAAqC,CAAC;AACpD,cAAc,oDAAoD,CAAC;AACnE,cAAc,4BAA4B,CAAC;AAC3C,cAAc,kCAAkC,CAAC;AACjD,cAAc,sCAAsC,CAAC;AACrD,cAAc,mCAAmC,CAAC;AAClD,cAAc,sCAAsC,CAAC;AACrD,cAAc,iCAAiC,CAAC;AAChD,cAAc,wCAAwC,CAAC;AACvD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,oCAAoC,CAAC;AACnD,cAAc,kCAAkC,CAAC;AACjD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC;AACtC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,iCAAiC,CAAC;AAChD,cAAc,0BAA0B,CAAC;AACzC,cAAc,wCAAwC,CAAC;AACvD,cAAc,yCAAy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,cAAc,wDAAwD,CAAC;AACvE,cAAc,2DAA2D,CAAC;AAC1E,cAAc,sDAAsD,CAAC;AACrE,cAAc,sDAAsD,CAAC;AACrE,cAAc,6CAA6C,CAAC;AAC5D,cAAc,uDAAuD,CAAC;AACtE,cAAc,0DAA0D,CAAC;AACzE,cAAc,4DAA4D,CAAC;AAC3E,cAAc,mDAAmD,CAAC;AAClE,cAAc,wDAAwD,CAAC;AACvE,cAAc,wCAAwC,CAAC;AACvD,cAAc,uDAAuD,CAAC;AACtE,cAAc,+CAA+C,CAAC;AAC9D,cAAc,8CAA8C,CAAC;AAC7D,cAAc,sCAAsC,CAAC;AACrD,cAAc,uCAAuC,CAAC;AACtD,cAAc,6CAA6C,CAAC;AAC5D,cAAc,mDAAmD,CAAC;AAClE,cAAc,uDAAuD,CAAC;AACtE,cAAc,uDAAuD,CAAC"}
@@ -0,0 +1,33 @@
1
+ import type { CacheInvalidation } from '../../application/ports/cache-invalidation.js';
2
+ import type { Clock } from '../../application/ports/clock.js';
3
+ import type { ExecutionScope } from '../../application/ports/execution-scope.js';
4
+ import type { IdGenerator } from '../../application/ports/id-generator.js';
5
+ import type { IntegrationEventPublisher } from '../../application/ports/integration-event-publisher.js';
6
+ export interface PublishedCacheInvalidationOptions {
7
+ /** The publisher of the application: with an outbox, the purge request commits with the work. */
8
+ readonly publisher: IntegrationEventPublisher;
9
+ readonly ids: IdGenerator;
10
+ readonly clock: Clock;
11
+ /** Where the tenant of the work is read, to file the tags under it. */
12
+ readonly scope: ExecutionScope;
13
+ /**
14
+ * Files the tags under the tenant of the work, for a multi-tenant application whose answers are
15
+ * tagged per tenant too (`cacheTags.perTenant` of `@ddd-ts-kit/http`). Default `false`: the two
16
+ * sides must agree, or the purges miss. Work that names no tenant (a job, a system actor) is then
17
+ * refused (`NoCurrentTenantError`): its purge would meet no answer.
18
+ */
19
+ readonly perTenant?: boolean;
20
+ }
21
+ /**
22
+ * Publishes a purge request on the publisher of the application, the tags under the tenant of the
23
+ * work when `perTenant` says so. Behind an outbox, the request is
24
+ * written in the transaction of the work: a rollback takes it away, a commit keeps it until the
25
+ * relay hands it to the `CachePurger` (see `PurgingPublisher`), even across a restart.
26
+ */
27
+ export declare class PublishedCacheInvalidation implements CacheInvalidation {
28
+ private readonly options;
29
+ constructor(options: PublishedCacheInvalidationOptions);
30
+ invalidate(tags: readonly string[]): Promise<void>;
31
+ private filed;
32
+ }
33
+ //# sourceMappingURL=published-cache-invalidation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"published-cache-invalidation.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/cache/published-cache-invalidation.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;AACvF,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kCAAkC,CAAC;AAC9D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4CAA4C,CAAC;AACjF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yCAAyC,CAAC;AAC3E,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,wDAAwD,CAAC;AAExG,MAAM,WAAW,iCAAiC;IAChD,iGAAiG;IACjG,QAAQ,CAAC,SAAS,EAAE,yBAAyB,CAAC;IAC9C,QAAQ,CAAC,GAAG,EAAE,WAAW,CAAC;IAC1B,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC;IACtB,uEAAuE;IACvE,QAAQ,CAAC,KAAK,EAAE,cAAc,CAAC;IAC/B;;;;;OAKG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC;CAC9B;AAED;;;;;GAKG;AACH,qBAAa,0BAA2B,YAAW,iBAAiB;IACtD,OAAO,CAAC,QAAQ,CAAC,OAAO;IAApC,YAA6B,OAAO,EAAE,iCAAiC,EAAI;IAErE,UAAU,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAWvD;IAED,OAAO,CAAC,KAAK;CAad"}
@@ -0,0 +1,35 @@
1
+ import { CachePurgeRequest } from '../../application/cache/cache-purge-request.js';
2
+ import { NoCurrentTenantError } from '../../application/audit/no-current-tenant-error.js';
3
+ import { tenantCacheTags } from '../../application/cache/tenant-cache-tags.js';
4
+ /**
5
+ * Publishes a purge request on the publisher of the application, the tags under the tenant of the
6
+ * work when `perTenant` says so. Behind an outbox, the request is
7
+ * written in the transaction of the work: a rollback takes it away, a commit keeps it until the
8
+ * relay hands it to the `CachePurger` (see `PurgingPublisher`), even across a restart.
9
+ */
10
+ export class PublishedCacheInvalidation {
11
+ options;
12
+ constructor(options) {
13
+ this.options = options;
14
+ }
15
+ async invalidate(tags) {
16
+ const distinct = [...new Set(tags)];
17
+ if (distinct.length === 0) {
18
+ return;
19
+ }
20
+ const { publisher, ids, clock } = this.options;
21
+ const filed = this.filed(distinct);
22
+ await publisher.publish([CachePurgeRequest.of(filed, { id: ids.next(), occurredAt: clock.now().toISOString() })]);
23
+ }
24
+ filed(tags) {
25
+ if (this.options.perTenant !== true) {
26
+ return tags;
27
+ }
28
+ const tenantId = this.options.scope.current()?.tenantId;
29
+ if (tenantId === undefined) {
30
+ throw new NoCurrentTenantError();
31
+ }
32
+ return tenantCacheTags(tags, tenantId);
33
+ }
34
+ }
35
+ //# sourceMappingURL=published-cache-invalidation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"published-cache-invalidation.js","sourceRoot":"","sources":["../../../src/infrastructure/cache/published-cache-invalidation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,gDAAgD,CAAC;AACnF,OAAO,EAAE,oBAAoB,EAAE,MAAM,oDAAoD,CAAC;AAC1F,OAAO,EAAE,eAAe,EAAE,MAAM,8CAA8C,CAAC;AAuB/E;;;;;GAKG;AACH,MAAM,OAAO,0BAA0B;IACR,OAAO;IAApC,YAA6B,OAA0C;uBAA1C,OAAO;IAAsC,CAAC;IAE3E,KAAK,CAAC,UAAU,CAAC,IAAuB;QACtC,MAAM,QAAQ,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC;QAEpC,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC1B,OAAO;QACT,CAAC;QAED,MAAM,EAAE,SAAS,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC,OAAO,CAAC;QAC/C,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;QAEnC,MAAM,SAAS,CAAC,OAAO,CAAC,CAAC,iBAAiB,CAAC,EAAE,CAAC,KAAK,EAAE,EAAE,EAAE,EAAE,GAAG,CAAC,IAAI,EAAE,EAAE,UAAU,EAAE,KAAK,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC;IACpH,CAAC;IAEO,KAAK,CAAC,IAAuB;QACnC,IAAI,IAAI,CAAC,OAAO,CAAC,SAAS,KAAK,IAAI,EAAE,CAAC;YACpC,OAAO,IAAI,CAAC;QACd,CAAC;QAED,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,EAAE,EAAE,QAAQ,CAAC;QAExD,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;YAC3B,MAAM,IAAI,oBAAoB,EAAE,CAAC;QACnC,CAAC;QAED,OAAO,eAAe,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IACzC,CAAC;CACF"}
@@ -0,0 +1,18 @@
1
+ import type { IntegrationEvent } from '../../application/events/integration-event.js';
2
+ import type { CachePurger } from '../../application/ports/cache-purger.js';
3
+ import type { IntegrationEventPublisher } from '../../application/ports/integration-event-publisher.js';
4
+ /**
5
+ * What the outbox relay publishes through: the purge requests go to the `CachePurger`, every
6
+ * other event to the provider. A purge that fails throws, so the relay retries the record as it
7
+ * retries a publication; purging is idempotent, and a request delivered twice purges twice.
8
+ *
9
+ * new OutboxRelay({ store, publisher: new PurgingPublisher(new VarnishCachePurger(...), broker), clock })
10
+ */
11
+ export declare class PurgingPublisher implements IntegrationEventPublisher {
12
+ private readonly purger;
13
+ private readonly next;
14
+ readonly messagingSystem?: string;
15
+ constructor(purger: CachePurger, next: IntegrationEventPublisher);
16
+ publish(events: readonly IntegrationEvent[]): Promise<void>;
17
+ }
18
+ //# sourceMappingURL=purging-publisher.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"purging-publisher.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/cache/purging-publisher.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,+CAA+C,CAAC;AAEtF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yCAAyC,CAAC;AAC3E,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,wDAAwD,CAAC;AAExG;;;;;;GAMG;AACH,qBAAa,gBAAiB,YAAW,yBAAyB;IAI9D,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,IAAI;IAJvB,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC;IAElC,YACmB,MAAM,EAAE,WAAW,EACnB,IAAI,EAAE,yBAAyB,EAOjD;IAEK,OAAO,CAAC,MAAM,EAAE,SAAS,gBAAgB,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAWhE;CACF"}
@@ -0,0 +1,33 @@
1
+ import { CachePurgeRequest } from '../../application/cache/cache-purge-request.js';
2
+ import { messagingSystemOf } from '../../application/events/messaging-system-of.js';
3
+ /**
4
+ * What the outbox relay publishes through: the purge requests go to the `CachePurger`, every
5
+ * other event to the provider. A purge that fails throws, so the relay retries the record as it
6
+ * retries a publication; purging is idempotent, and a request delivered twice purges twice.
7
+ *
8
+ * new OutboxRelay({ store, publisher: new PurgingPublisher(new VarnishCachePurger(...), broker), clock })
9
+ */
10
+ export class PurgingPublisher {
11
+ purger;
12
+ next;
13
+ messagingSystem;
14
+ constructor(purger, next) {
15
+ this.purger = purger;
16
+ this.next = next;
17
+ const system = messagingSystemOf(next);
18
+ if (system !== undefined) {
19
+ this.messagingSystem = system;
20
+ }
21
+ }
22
+ async publish(events) {
23
+ const tags = events.flatMap((event) => CachePurgeRequest.tagsOf(event) ?? []);
24
+ const others = events.filter((event) => CachePurgeRequest.tagsOf(event) === undefined);
25
+ if (tags.length > 0) {
26
+ await this.purger.purge([...new Set(tags)]);
27
+ }
28
+ if (others.length > 0) {
29
+ await this.next.publish(others);
30
+ }
31
+ }
32
+ }
33
+ //# sourceMappingURL=purging-publisher.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"purging-publisher.js","sourceRoot":"","sources":["../../../src/infrastructure/cache/purging-publisher.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,gDAAgD,CAAC;AAEnF,OAAO,EAAE,iBAAiB,EAAE,MAAM,iDAAiD,CAAC;AAIpF;;;;;;GAMG;AACH,MAAM,OAAO,gBAAgB;IAIR,MAAM;IACN,IAAI;IAJd,eAAe,CAAU;IAElC,YACmB,MAAmB,EACnB,IAA+B;sBAD/B,MAAM;oBACN,IAAI;QAErB,MAAM,MAAM,GAAG,iBAAiB,CAAC,IAAI,CAAC,CAAC;QAEvC,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;YACzB,IAAI,CAAC,eAAe,GAAG,MAAM,CAAC;QAChC,CAAC;IACH,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,MAAmC;QAC/C,MAAM,IAAI,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,iBAAiB,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC;QAC9E,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,iBAAiB,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,SAAS,CAAC,CAAC;QAEvF,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACpB,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAC9C,CAAC;QAED,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACtB,MAAM,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QAClC,CAAC;IACH,CAAC;CACF"}
@@ -0,0 +1,25 @@
1
+ import type { CachePurger } from '../../application/ports/cache-purger.js';
2
+ export interface RepeatedCachePurgerOptions {
3
+ /** How long after a purge the same tags are purged again: longer than the slowest read of the application. */
4
+ readonly againAfterMs: number;
5
+ /** Waits that long. Defaults to a timer that keeps no process alive; a test hands a wait it releases. */
6
+ readonly wait?: (ms: number) => Promise<void>;
7
+ /** Told of a second purge that failed: the first one was confirmed, and nothing retries the second. */
8
+ readonly onFailure?: (error: unknown, tags: readonly string[]) => void;
9
+ }
10
+ /**
11
+ * Purges, then purges the same tags once more a little later. A read that loaded the previous
12
+ * state before the commit can reach the cache after the first purge, and be kept as fresh for
13
+ * its whole `s-maxage`: the second purge removes it. The first purge is the one the relay waits
14
+ * for and retries; the second is best effort, and lost if the process stops before it.
15
+ *
16
+ * new PurgingPublisher(new RepeatedCachePurger(varnish, { againAfterMs: 2_000 }), broker)
17
+ */
18
+ export declare class RepeatedCachePurger implements CachePurger {
19
+ private readonly purger;
20
+ private readonly options;
21
+ constructor(purger: CachePurger, options: RepeatedCachePurgerOptions);
22
+ purge(tags: readonly string[]): Promise<void>;
23
+ private purgeAgain;
24
+ }
25
+ //# sourceMappingURL=repeated-cache-purger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"repeated-cache-purger.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/cache/repeated-cache-purger.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yCAAyC,CAAC;AAE3E,MAAM,WAAW,0BAA0B;IACzC,8GAA8G;IAC9G,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,yGAAyG;IACzG,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9C,uGAAuG;IACvG,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,MAAM,EAAE,KAAK,IAAI,CAAC;CACxE;AAED;;;;;;;GAOG;AACH,qBAAa,mBAAoB,YAAW,WAAW;IAEnD,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,OAAO;IAF1B,YACmB,MAAM,EAAE,WAAW,EACnB,OAAO,EAAE,0BAA0B,EAClD;IAEE,KAAK,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAMlD;YAEa,UAAU;CAQzB"}
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Purges, then purges the same tags once more a little later. A read that loaded the previous
3
+ * state before the commit can reach the cache after the first purge, and be kept as fresh for
4
+ * its whole `s-maxage`: the second purge removes it. The first purge is the one the relay waits
5
+ * for and retries; the second is best effort, and lost if the process stops before it.
6
+ *
7
+ * new PurgingPublisher(new RepeatedCachePurger(varnish, { againAfterMs: 2_000 }), broker)
8
+ */
9
+ export class RepeatedCachePurger {
10
+ purger;
11
+ options;
12
+ constructor(purger, options) {
13
+ this.purger = purger;
14
+ this.options = options;
15
+ }
16
+ async purge(tags) {
17
+ await this.purger.purge(tags);
18
+ if (tags.length > 0) {
19
+ void this.purgeAgain(tags);
20
+ }
21
+ }
22
+ async purgeAgain(tags) {
23
+ try {
24
+ await (this.options.wait ?? sleep)(this.options.againAfterMs);
25
+ await this.purger.purge(tags);
26
+ }
27
+ catch (error) {
28
+ this.options.onFailure?.(error, tags);
29
+ }
30
+ }
31
+ }
32
+ function sleep(ms) {
33
+ return new Promise((resolve) => {
34
+ setTimeout(resolve, ms).unref();
35
+ });
36
+ }
37
+ //# sourceMappingURL=repeated-cache-purger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"repeated-cache-purger.js","sourceRoot":"","sources":["../../../src/infrastructure/cache/repeated-cache-purger.ts"],"names":[],"mappings":"AAWA;;;;;;;GAOG;AACH,MAAM,OAAO,mBAAmB;IAEX,MAAM;IACN,OAAO;IAF1B,YACmB,MAAmB,EACnB,OAAmC;sBADnC,MAAM;uBACN,OAAO;IACvB,CAAC;IAEJ,KAAK,CAAC,KAAK,CAAC,IAAuB;QACjC,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAE9B,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACpB,KAAK,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;QAC7B,CAAC;IACH,CAAC;IAEO,KAAK,CAAC,UAAU,CAAC,IAAuB;QAC9C,IAAI,CAAC;YACH,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,IAAI,KAAK,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;YAC9D,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAChC,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;QACxC,CAAC;IACH,CAAC;CACF;AAED,SAAS,KAAK,CAAC,EAAU;IACvB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC7B,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC;IAClC,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,7 @@
1
+ import type { CacheInvalidation } from '../../application/ports/cache-invalidation.js';
2
+ /** Remembers the tags the use cases asked to purge, for a spec to read: `invalidated`, in order. */
3
+ export declare class InMemoryCacheInvalidation implements CacheInvalidation {
4
+ readonly invalidated: string[];
5
+ invalidate(tags: readonly string[]): Promise<void>;
6
+ }
7
+ //# sourceMappingURL=in-memory-cache-invalidation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"in-memory-cache-invalidation.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/in-memory/in-memory-cache-invalidation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;AAEvF,oGAAoG;AACpG,qBAAa,yBAA0B,YAAW,iBAAiB;IACjE,QAAQ,CAAC,WAAW,EAAE,MAAM,EAAE,CAAM;IAE9B,UAAU,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAEvD;CACF"}
@@ -0,0 +1,8 @@
1
+ /** Remembers the tags the use cases asked to purge, for a spec to read: `invalidated`, in order. */
2
+ export class InMemoryCacheInvalidation {
3
+ invalidated = [];
4
+ async invalidate(tags) {
5
+ this.invalidated.push(...tags);
6
+ }
7
+ }
8
+ //# sourceMappingURL=in-memory-cache-invalidation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"in-memory-cache-invalidation.js","sourceRoot":"","sources":["../../../src/infrastructure/in-memory/in-memory-cache-invalidation.ts"],"names":[],"mappings":"AAEA,oGAAoG;AACpG,MAAM,OAAO,yBAAyB;IAC3B,WAAW,GAAa,EAAE,CAAC;IAEpC,KAAK,CAAC,UAAU,CAAC,IAAuB;QACtC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;IACjC,CAAC;CACF"}
@@ -0,0 +1,13 @@
1
+ import type { CachePurger } from '../../application/ports/cache-purger.js';
2
+ /**
3
+ * A shared cache in the memory of the process, for tests: `store` files an answer under its
4
+ * tags, `holds` says whether it is still there, `purged` lists every tag purged, in order.
5
+ */
6
+ export declare class InMemoryCachePurger implements CachePurger {
7
+ readonly purged: string[];
8
+ private readonly answers;
9
+ store(key: string, tags: readonly string[]): void;
10
+ holds(key: string): boolean;
11
+ purge(tags: readonly string[]): Promise<void>;
12
+ }
13
+ //# sourceMappingURL=in-memory-cache-purger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"in-memory-cache-purger.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/in-memory/in-memory-cache-purger.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yCAAyC,CAAC;AAE3E;;;GAGG;AACH,qBAAa,mBAAoB,YAAW,WAAW;IACrD,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,CAAM;IAE/B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA0C;IAElE,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,IAAI,CAEhD;IAED,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAE1B;IAEK,KAAK,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAQlD;CACF"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * A shared cache in the memory of the process, for tests: `store` files an answer under its
3
+ * tags, `holds` says whether it is still there, `purged` lists every tag purged, in order.
4
+ */
5
+ export class InMemoryCachePurger {
6
+ purged = [];
7
+ answers = new Map();
8
+ store(key, tags) {
9
+ this.answers.set(key, new Set(tags));
10
+ }
11
+ holds(key) {
12
+ return this.answers.has(key);
13
+ }
14
+ async purge(tags) {
15
+ this.purged.push(...tags);
16
+ for (const [key, filed] of this.answers) {
17
+ if (tags.some((tag) => filed.has(tag))) {
18
+ this.answers.delete(key);
19
+ }
20
+ }
21
+ }
22
+ }
23
+ //# sourceMappingURL=in-memory-cache-purger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"in-memory-cache-purger.js","sourceRoot":"","sources":["../../../src/infrastructure/in-memory/in-memory-cache-purger.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,MAAM,OAAO,mBAAmB;IACrB,MAAM,GAAa,EAAE,CAAC;IAEd,OAAO,GAAG,IAAI,GAAG,EAA+B,CAAC;IAElE,KAAK,CAAC,GAAW,EAAE,IAAuB;QACxC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC;IACvC,CAAC;IAED,KAAK,CAAC,GAAW;QACf,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC/B,CAAC;IAED,KAAK,CAAC,KAAK,CAAC,IAAuB;QACjC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;QAE1B,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YACxC,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;gBACvC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YAC3B,CAAC;QACH,CAAC;IACH,CAAC;CACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ddd-ts-kit/kernel",
3
- "version": "0.11.0",
3
+ "version": "0.12.0",
4
4
  "description": "Framework-agnostic DDD building blocks, application ports and an in-memory event bus.",
5
5
  "license": "MIT",
6
6
  "repository": {