@getstrata/bootstrap 3.1.0 → 3.1.4
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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @getstrata/bootstrap changelog
|
|
2
2
|
|
|
3
|
+
## 3.1.4
|
|
4
|
+
|
|
5
|
+
- Synchronize package versions and dependency pins at 3.1.4 for the corrected starter release validation. No additional runtime changes in this package.
|
|
6
|
+
|
|
7
|
+
## 3.1.3
|
|
8
|
+
|
|
9
|
+
- Accept class models directly in `defineModelListener` while preserving explicit repository listeners and after-commit behavior.
|
|
10
|
+
|
|
11
|
+
## 3.1.2
|
|
12
|
+
|
|
13
|
+
- Describe application startup, routing, middleware and service configuration in npm metadata. Align the core peer dependency with 3.1.2.
|
|
14
|
+
|
|
15
|
+
## 3.1.1
|
|
16
|
+
|
|
17
|
+
- Synchronize the package version and core peer range for the 3.1.1 application-agent guide release.
|
|
18
|
+
|
|
3
19
|
## 3.1.0
|
|
4
20
|
|
|
5
21
|
- Preserve API/web classification when composing unclassified route maps, preventing generated browser pages from leaking into API-only OpenAPI output.
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ServiceDeclaration } from "@getstrata/core/contracts/services";
|
|
2
2
|
import type { RepositoryEffectsDeclaration } from "@getstrata/core/database/definitions";
|
|
3
|
+
import type { AnyModelClass, ModelAttributes } from "@getstrata/core/database/model";
|
|
3
4
|
import { type InfrastructureDiscoveryOptions } from "./infrastructureDiscovery";
|
|
4
5
|
/** Inert graph declarations, collected before application construction and pool effects. */
|
|
5
6
|
export interface ListenerDeclarations {
|
|
@@ -11,6 +12,7 @@ export interface DiscoverListenersOptions extends InfrastructureDiscoveryOptions
|
|
|
11
12
|
}
|
|
12
13
|
export declare function discoverListeners(options?: DiscoverListenersOptions): Promise<readonly ListenerDeclarations[]>;
|
|
13
14
|
/** Declare an after-commit listener; its lifetime belongs to the application graph. */
|
|
15
|
+
export declare function defineModelListener<C extends AnyModelClass>(model: C, action: import("@getstrata/core/database/definitions").RepositoryAction, handler: import("@getstrata/core/database/definitions").AfterCommitRepositoryListener<ModelAttributes<C["prototype"]>>): ListenerDeclarations;
|
|
14
16
|
export declare function defineModelListener<R extends object, K extends keyof R & string, T extends import("@getstrata/core/database/baseRepository").BaseRepository<R, K>>(repository: import("@getstrata/core/database/definitions").RepositoryDefinition<R, K, T>, action: import("@getstrata/core/database/definitions").RepositoryAction, handler: import("@getstrata/core/database/definitions").AfterCommitRepositoryListener<R>): ListenerDeclarations;
|
|
15
17
|
/** Subscribe when the application opens and unsubscribe when it stops. */
|
|
16
18
|
export declare function defineEventListener(event: string, handler: Parameters<import("@getstrata/core/events").EventBus["listen"]>[1]): ListenerDeclarations;
|
|
@@ -4,7 +4,7 @@ import { join as join2 } from "path";
|
|
|
4
4
|
import { APPLICATION_EVENT_BUS_TOKEN } from "@getstrata/bootstrap/providers/events";
|
|
5
5
|
import { resourceService, service } from "@getstrata/core/contracts/services";
|
|
6
6
|
import { createServiceToken } from "@getstrata/core/contracts/token";
|
|
7
|
-
import { repositoryEffects } from "@getstrata/core/database/definitions";
|
|
7
|
+
import { modelEffects, repositoryEffects } from "@getstrata/core/database/definitions";
|
|
8
8
|
|
|
9
9
|
// ../../src/bootstrap/infrastructureDiscovery.ts
|
|
10
10
|
import { readdir } from "fs/promises";
|
|
@@ -90,14 +90,22 @@ async function discoverListeners(options = {}) {
|
|
|
90
90
|
}
|
|
91
91
|
return Object.freeze(result);
|
|
92
92
|
}
|
|
93
|
+
function isListenerModel(value) {
|
|
94
|
+
return typeof value === "function";
|
|
95
|
+
}
|
|
93
96
|
function defineModelListener(repository, action, handler) {
|
|
94
|
-
const token = createServiceToken(`${repository.name}.${action}.listener`);
|
|
97
|
+
const token = createServiceToken(`${isListenerModel(repository) ? "model" : repository.name}.${action}.listener`);
|
|
95
98
|
return Object.freeze({
|
|
96
99
|
services: Object.freeze([
|
|
97
100
|
service(token, { lifetime: "application", dependencies: [], create: () => handler })
|
|
98
101
|
]),
|
|
99
102
|
repositoryEffects: Object.freeze([
|
|
100
|
-
|
|
103
|
+
isListenerModel(repository) ? modelEffects(repository, [
|
|
104
|
+
{
|
|
105
|
+
action,
|
|
106
|
+
afterCommit: token
|
|
107
|
+
}
|
|
108
|
+
]) : repositoryEffects(repository, [{ action, afterCommit: token }])
|
|
101
109
|
])
|
|
102
110
|
});
|
|
103
111
|
}
|
package/dist/index.js
CHANGED
|
@@ -1524,7 +1524,7 @@ function createEventsProvider(bus) {
|
|
|
1524
1524
|
// ../../src/bootstrap/discoverListeners.ts
|
|
1525
1525
|
import { resourceService as resourceService2, service as service2 } from "@getstrata/core/contracts/services";
|
|
1526
1526
|
import { createServiceToken as createServiceToken4 } from "@getstrata/core/contracts/token";
|
|
1527
|
-
import { repositoryEffects } from "@getstrata/core/database/definitions";
|
|
1527
|
+
import { modelEffects, repositoryEffects } from "@getstrata/core/database/definitions";
|
|
1528
1528
|
function snapshot(value, location) {
|
|
1529
1529
|
if (!value || typeof value !== "object")
|
|
1530
1530
|
throw new TypeError(`Invalid listener declarations at ${location}.`);
|
|
@@ -2247,7 +2247,7 @@ import { createServiceToken as createServiceToken5 } from "@getstrata/core/contr
|
|
|
2247
2247
|
import {
|
|
2248
2248
|
repositoryEffects as repositoryEffects2
|
|
2249
2249
|
} from "@getstrata/core/database/definitions";
|
|
2250
|
-
import { modelEffects, modelTable } from "@getstrata/core/database/model";
|
|
2250
|
+
import { modelEffects as modelEffects2, modelTable } from "@getstrata/core/database/model";
|
|
2251
2251
|
import { InvalidateCacheTagsJob as InvalidateCacheTagsJob2 } from "@getstrata/core/jobs/invalidateCacheTagsJob";
|
|
2252
2252
|
|
|
2253
2253
|
// ../../src/bootstrap/cache/modelCacheTags.ts
|
|
@@ -2283,7 +2283,7 @@ function createModelCacheInvalidationEffects(repositories, modules, tokens, mode
|
|
|
2283
2283
|
await queue.dispatch(new InvalidateCacheTagsJob2(cache), { tags: [...tags] });
|
|
2284
2284
|
}
|
|
2285
2285
|
}));
|
|
2286
|
-
effects.push(model ?
|
|
2286
|
+
effects.push(model ? modelEffects2(model, [{ action, afterCommit: listener }]) : repositoryEffects2(repository, [{ action, afterCommit: listener }]));
|
|
2287
2287
|
}
|
|
2288
2288
|
}
|
|
2289
2289
|
return Object.freeze({
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getstrata/bootstrap",
|
|
3
|
-
"version": "3.1.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "3.1.4",
|
|
4
|
+
"description": "Application startup, routing, middleware, and service configuration for Strata.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": {
|
|
@@ -246,7 +246,7 @@
|
|
|
246
246
|
"access": "public"
|
|
247
247
|
},
|
|
248
248
|
"peerDependencies": {
|
|
249
|
-
"@getstrata/core": "^3.1.
|
|
249
|
+
"@getstrata/core": "^3.1.4",
|
|
250
250
|
"typescript": "^5.9.0 || ^6.0.0 || ^7.0.0"
|
|
251
251
|
},
|
|
252
252
|
"engines": {
|