@spine-event-engine/testing 2.0.0-snapshot.21 → 2.0.0-snapshot.23
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 +64 -15
- package/REFERENCE.md +40 -2
- package/dist/ai-test/ai-test-backend.d.ts +167 -0
- package/dist/ai-test/ai-test-backend.d.ts.map +1 -0
- package/dist/ai-test/ai-test-backend.js +134 -0
- package/dist/ai-test/ai-test-backend.js.map +1 -0
- package/dist/ai-test/scripted-attempts.d.ts +261 -0
- package/dist/ai-test/scripted-attempts.d.ts.map +1 -0
- package/dist/ai-test/scripted-attempts.js +607 -0
- package/dist/ai-test/scripted-attempts.js.map +1 -0
- package/dist/black-box/black-box.d.ts +42 -5
- package/dist/black-box/black-box.d.ts.map +1 -1
- package/dist/black-box/black-box.js +269 -17
- package/dist/black-box/black-box.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +7 -5
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import type { HistoryPage, HistoryRead } from "@spine-event-engine/ai";
|
|
1
2
|
import { type Message, type MessageShape } from "@bufbuild/protobuf";
|
|
2
3
|
import type { GenMessage } from "@bufbuild/protobuf/codegenv2";
|
|
3
4
|
import { type ClientRequest } from "@spine-event-engine/client-node";
|
|
4
|
-
import { type TenantId, type ZoneId, type Command, type Event } from "@spine-event-engine/proto";
|
|
5
|
-
import { BoundedContext, type BoundedContextBuilder } from "@spine-event-engine/server";
|
|
5
|
+
import { type TenantId, type ZoneId, type Command, type Event, type EventId } from "@spine-event-engine/proto";
|
|
6
|
+
import { BoundedContext, Agent, Repository, type BoundedContextBuilder, type ConcreteRepositoryEntityType, type RepositoryEntityId, type RepositoryEntityType, type RepositoryStateSchema } from "@spine-event-engine/server";
|
|
7
|
+
import type { AgentHistoryEntry } from "@spine-event-engine/proto/agent";
|
|
6
8
|
/**
|
|
7
9
|
* Fixed configuration for one runner-neutral BlackBox session.
|
|
8
10
|
*/
|
|
@@ -54,6 +56,7 @@ export interface BlackBoxScope extends ClientRequest {
|
|
|
54
56
|
* @param schema The schema of the event message.
|
|
55
57
|
* @param message The event message to post.
|
|
56
58
|
* @returns A promise that resolves after the event is posted.
|
|
59
|
+
* @typeParam Schema The domain schema that determines the accepted message shape.
|
|
57
60
|
*/
|
|
58
61
|
postEvent<Schema extends GenMessage<Message>>(schema: Schema, message: MessageShape<Schema>): Promise<void>;
|
|
59
62
|
/**
|
|
@@ -62,6 +65,7 @@ export interface BlackBoxScope extends ClientRequest {
|
|
|
62
65
|
* @param schema The schema of the external event message.
|
|
63
66
|
* @param message The external event message.
|
|
64
67
|
* @returns A promise that resolves after external event admission.
|
|
68
|
+
* @typeParam Schema The domain schema that determines the accepted message shape.
|
|
65
69
|
*/
|
|
66
70
|
postExternalEvent<Schema extends GenMessage<Message>>(schema: Schema, message: MessageShape<Schema>): Promise<void>;
|
|
67
71
|
}
|
|
@@ -70,6 +74,15 @@ export interface BlackBoxScope extends ClientRequest {
|
|
|
70
74
|
*/
|
|
71
75
|
export declare class BlackBox {
|
|
72
76
|
#private;
|
|
77
|
+
/**
|
|
78
|
+
* Captures the server, client, test options, and produced-signal observation.
|
|
79
|
+
*
|
|
80
|
+
* @param context The bounded context under test.
|
|
81
|
+
* @param server The started local server.
|
|
82
|
+
* @param client The client connected to that server.
|
|
83
|
+
* @param options The validated tenant, zone, and wait settings.
|
|
84
|
+
* @param observation The optional produced-signal observer.
|
|
85
|
+
*/
|
|
73
86
|
private constructor();
|
|
74
87
|
/**
|
|
75
88
|
* Starts an ephemeral local server and public client for a context or builder.
|
|
@@ -104,6 +117,24 @@ export declare class BlackBox {
|
|
|
104
117
|
* @returns The Events produced by this context.
|
|
105
118
|
*/
|
|
106
119
|
assertEvents(): readonly Event[];
|
|
120
|
+
/**
|
|
121
|
+
* Reads complete retained Agent history through its opaque full-history cursor.
|
|
122
|
+
*
|
|
123
|
+
* @typeParam EntityType Generated Agent class registered in this Bounded Context.
|
|
124
|
+
* @param target Exact typed Agent repository or its generated class.
|
|
125
|
+
* @param entityId Typed Agent identifier.
|
|
126
|
+
* @param request Positive page size and optional prior cursor.
|
|
127
|
+
* @returns Provider-backed entries newest first, with an older-page cursor when present.
|
|
128
|
+
*/
|
|
129
|
+
readAgentHistory<EntityType extends RepositoryEntityType & ConcreteRepositoryEntityType<EntityType>>(target: (Repository<EntityType> | EntityType) & (EntityType["prototype"] extends Agent<RepositoryEntityId<EntityType>, RepositoryStateSchema<EntityType>> ? unknown : never), entityId: NoInfer<RepositoryEntityId<EntityType>>, request: HistoryRead): Promise<HistoryPage<AgentHistoryEntry>>;
|
|
130
|
+
/**
|
|
131
|
+
* Reads original persisted System Event envelopes by exact IDs, in requested order.
|
|
132
|
+
* Missing IDs are omitted; repeated IDs return independent copies.
|
|
133
|
+
*
|
|
134
|
+
* @param ids Exact System Event IDs from retained Agent history.
|
|
135
|
+
* @returns Stored envelopes for this Bounded Context and fixed tenant.
|
|
136
|
+
*/
|
|
137
|
+
readSystemEvents(ids: readonly EventId[]): Promise<readonly Event[]>;
|
|
107
138
|
/**
|
|
108
139
|
* Reads repeatedly until the predicate accepts or the bounded wait expires.
|
|
109
140
|
*
|
|
@@ -111,14 +142,20 @@ export declare class BlackBox {
|
|
|
111
142
|
* @param accept The predicate that accepts a produced value.
|
|
112
143
|
* @param options Optional wait limits for this operation.
|
|
113
144
|
* @returns The first accepted value.
|
|
145
|
+
* @typeParam Value The value type carried through reading or delivery.
|
|
114
146
|
*/
|
|
115
147
|
eventually<Value>(read: () => Value | Promise<Value>, accept: (value: Value) => boolean, options?: Pick<BlackBoxOptions, "timeoutMs" | "intervalMs">): Promise<Value>;
|
|
116
148
|
/**
|
|
117
|
-
* Stops admission, cancels
|
|
149
|
+
* Stops admission, cancels registered subscriptions, and closes the client and server once.
|
|
118
150
|
*
|
|
119
151
|
* @returns A shared promise that resolves after cleanup completes.
|
|
120
152
|
*/
|
|
121
153
|
close(): Promise<void>;
|
|
154
|
+
/**
|
|
155
|
+
* Stops admission and waits, cancels subscriptions, and closes the client and server.
|
|
156
|
+
*
|
|
157
|
+
* @returns Completion after all cleanup settles, or an aggregate of failures.
|
|
158
|
+
*/
|
|
122
159
|
private closeOnce;
|
|
123
160
|
}
|
|
124
161
|
/**
|
|
@@ -129,13 +166,13 @@ export interface BlackBoxTestAccess {
|
|
|
129
166
|
* Creates a BlackBox with supplied closeable resources.
|
|
130
167
|
*
|
|
131
168
|
* @param resources The test client, server, and optional subscriptions.
|
|
132
|
-
* @returns A BlackBox
|
|
169
|
+
* @returns A BlackBox configured with the supplied resources.
|
|
133
170
|
*/
|
|
134
171
|
create(resources: BlackBoxTestResources): BlackBox;
|
|
135
172
|
/**
|
|
136
173
|
* Returns a generic subscription-like handle for lifecycle regression tests.
|
|
137
174
|
*
|
|
138
|
-
* @param blackBox The BlackBox
|
|
175
|
+
* @param blackBox The BlackBox tracking the handle.
|
|
139
176
|
* @param handle The cancelable async handle to track.
|
|
140
177
|
* @returns The tracked handle.
|
|
141
178
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"black-box.d.ts","sourceRoot":"","sources":["../../src/black-box/black-box.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"black-box.d.ts","sourceRoot":"","sources":["../../src/black-box/black-box.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACvE,OAAO,EAAiB,KAAK,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACpF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAKL,KAAK,aAAa,EAGnB,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EAQL,KAAK,QAAQ,EACb,KAAK,MAAM,EACX,KAAK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