@spine-event-engine/core 2.0.0-snapshot.2

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.
@@ -0,0 +1,682 @@
1
+ import type { DescField, Message, MessageInitShape, MessageShape, Registry } from "@bufbuild/protobuf";
2
+ import type { GenExtension, GenFile, GenMessage } from "@bufbuild/protobuf/codegenv2";
3
+ import { type Any, type FileOptions } from "@bufbuild/protobuf/wkt";
4
+ import { type Command, type CommandContext, type CommandId, type Event, type EventContext, type EventId, type ConstraintViolation, type ProtoModule, type ValidationError } from "@spine-event-engine/proto";
5
+ /**
6
+ * Standard Protobuf `Any` prefix used when a file has no Spine type URL option.
7
+ */
8
+ export declare const DEFAULT_TYPE_URL_PREFIX = "type.googleapis.com";
9
+ /**
10
+ * Protobuf-ES schema shape accepted by the Spine TS type registry.
11
+ */
12
+ export type MessageSchema = GenMessage<Message>;
13
+ type InterfaceSchemas = readonly [MessageSchema, ...MessageSchema[]];
14
+ type InterfaceMember<Schemas extends InterfaceSchemas> = MessageShape<Schemas[number]>;
15
+ declare const MESSAGE_INTERFACE_BRAND: unique symbol;
16
+ /**
17
+ * Immutable nominal membership token for generated Protobuf message interfaces.
18
+ *
19
+ * The token preserves the concrete non-empty schema tuple used to define an
20
+ * interface. Use {@link MessageInterfaces} to create a token with its `define`
21
+ * factory and validate a runtime candidate with its `is` guard.
22
+ *
23
+ * @typeParam TInterface The object shape implemented by every member message.
24
+ * @typeParam Schemas The concrete non-empty tuple of member schemas.
25
+ */
26
+ export interface MessageInterface<TInterface extends object, Schemas extends InterfaceSchemas> {
27
+ /**
28
+ * Deduplicated immutable generated message schemas that belong to this interface.
29
+ */
30
+ readonly schemas: readonly [Schemas[number], ...Schemas[number][]];
31
+ /**
32
+ * Nominal compile-time association with the represented interface shape.
33
+ */
34
+ readonly [MESSAGE_INTERFACE_BRAND]: TInterface;
35
+ }
36
+ /**
37
+ * Creates and validates nominal generated message-interface tokens.
38
+ */
39
+ export declare const MessageInterfaces: Readonly<{
40
+ readonly define: <TInterface extends object, const Schemas extends InterfaceSchemas>(schemas: InterfaceMember<Schemas> extends TInterface ? Schemas : never) => MessageInterface<TInterface, Schemas>;
41
+ readonly is: (value: unknown) => value is MessageInterface<object, InterfaceSchemas>;
42
+ }>;
43
+ /**
44
+ * Structured result returned by {@link Validate.message}.
45
+ */
46
+ export type MessageValidationResult = {
47
+ /**
48
+ * The message satisfied all single-message validation constraints.
49
+ */
50
+ readonly valid: true;
51
+ /**
52
+ * Successful validation has no constraint violations.
53
+ */
54
+ readonly violations: readonly [];
55
+ /**
56
+ * Successful validation does not allocate a validation error message.
57
+ */
58
+ readonly error: undefined;
59
+ } | {
60
+ /**
61
+ * The message failed validation or the validation runtime failed.
62
+ */
63
+ readonly valid: false;
64
+ /**
65
+ * Invalid validation results always carry at least one constraint violation.
66
+ */
67
+ readonly violations: readonly [ConstraintViolation, ...ConstraintViolation[]];
68
+ /**
69
+ * Repo-local Spine validation error message for the violations.
70
+ */
71
+ readonly error: ValidationError;
72
+ };
73
+ /**
74
+ * Framework-owned state transition validation request.
75
+ */
76
+ export interface TransitionValidationRequest<Schema extends MessageSchema = MessageSchema> {
77
+ /**
78
+ * Schema shared by the previous and proposed message states.
79
+ */
80
+ readonly schema: Schema;
81
+ /**
82
+ * Previous committed state, absent when creating a new state.
83
+ */
84
+ readonly previous: MessageShape<Schema> | undefined;
85
+ /**
86
+ * Proposed next state to validate before commit.
87
+ */
88
+ readonly next: MessageShape<Schema>;
89
+ }
90
+ /**
91
+ * Rule adapter for stateful validation such as Spine `(set_once)`.
92
+ */
93
+ export interface TransitionValidationRule<Schema extends MessageSchema = MessageSchema> {
94
+ /**
95
+ * Returns transition-only constraint violations for the proposed state change.
96
+ * @param request The previous and proposed state change.
97
+ * @returns The constraint violations found by this rule.
98
+ */
99
+ validateTransition(request: TransitionValidationRequest<Schema>): readonly ConstraintViolation[];
100
+ }
101
+ /**
102
+ * Structured result returned by {@link Validate.transition}.
103
+ */
104
+ export type TransitionValidationResult = MessageValidationResult;
105
+ /**
106
+ * Error thrown when a Protobuf message fails Spine single-message validation.
107
+ */
108
+ export declare class ValidationException extends Error {
109
+ #private;
110
+ /**
111
+ * Constraint violations captured from the structured validation error.
112
+ */
113
+ readonly violations: readonly ConstraintViolation[];
114
+ /**
115
+ * Creates an exception from structured Spine validation error data.
116
+ * @param messageData The validation error represented by this exception.
117
+ */
118
+ constructor(messageData: ValidationError);
119
+ /**
120
+ * Returns the structured Spine `ValidationError` message data.
121
+ * @returns The validation error message.
122
+ */
123
+ asMessage(): ValidationError;
124
+ }
125
+ /**
126
+ * A nominal domain rejection carrying its generated Protobuf message.
127
+ */
128
+ export declare class RejectionThrowable<Schema extends MessageSchema = MessageSchema> extends Error {
129
+ #private;
130
+ private constructor();
131
+ /**
132
+ * Returns the generated Protobuf-ES schema for the rejected domain signal.
133
+ * @returns The rejection schema.
134
+ */
135
+ get schema(): Schema;
136
+ /**
137
+ * Returns a defensive clone of the snapshotted rejection message.
138
+ * @returns The cloned rejection message.
139
+ */
140
+ get messageData(): MessageShape<Schema>;
141
+ /**
142
+ * Returns a defensive clone matching Spine JVM's throwable contract.
143
+ * @returns The cloned rejection message.
144
+ */
145
+ messageThrown(): MessageShape<Schema>;
146
+ /**
147
+ * Creates a nominal throwable from a validated generated rejection message.
148
+ * @param schema The generated rejection schema.
149
+ * @param input The rejection message fields.
150
+ * @returns The validated nominal rejection throwable.
151
+ */
152
+ static create<Schema extends MessageSchema>(schema: Schema, input: MessageInitShape<Schema>): RejectionThrowable<Schema>;
153
+ /**
154
+ * Checks whether a value is a factory-created domain rejection throwable.
155
+ * @param value The value to inspect.
156
+ * @returns Whether the value is a trusted rejection throwable.
157
+ */
158
+ static is(value: unknown): value is RejectionThrowable;
159
+ private static assertSchema;
160
+ private static snapshot;
161
+ }
162
+ /**
163
+ * Validates Spine messages and proposed state transitions.
164
+ */
165
+ export declare const Validate: {
166
+ /**
167
+ * Creates a repo-local validation error from constraint violations.
168
+ * @param violations The violations to include.
169
+ * @returns The validation error.
170
+ */
171
+ readonly createError: (violations: readonly ConstraintViolation[]) => ValidationError;
172
+ /**
173
+ * Validates one Protobuf message through the Spine TS validation facade.
174
+ * @param schema The message schema.
175
+ * @param message The message to validate.
176
+ * @returns The sanitized validation result.
177
+ */
178
+ readonly message: <Schema extends MessageSchema>(schema: Schema, message: MessageShape<Schema>) => MessageValidationResult;
179
+ /**
180
+ * Validates one Protobuf message and throws for constraint violations.
181
+ * @param schema The message schema.
182
+ * @param message The message to validate.
183
+ * @returns The validated message.
184
+ */
185
+ readonly check: <Schema extends MessageSchema>(schema: Schema, message: MessageShape<Schema>) => MessageShape<Schema>;
186
+ /**
187
+ * Validates a previous/next state pair with framework-owned transition rules.
188
+ * @param request The state transition.
189
+ * @param rules The rules to apply.
190
+ * @returns The sanitized transition result.
191
+ */
192
+ readonly transition: <Schema extends MessageSchema>(request: TransitionValidationRequest<Schema>, rules?: readonly TransitionValidationRule<Schema>[]) => TransitionValidationResult;
193
+ };
194
+ /**
195
+ * Options for registering a schema in a {@link TypeRegistry}.
196
+ */
197
+ export interface RegisterTypeOptions {
198
+ /**
199
+ * Explicit type URL for precomputed/generated metadata.
200
+ *
201
+ * Most callers should omit this and let the registry derive the URL from the
202
+ * schema file's Spine `type_url_prefix` option.
203
+ */
204
+ readonly typeUrl?: string;
205
+ }
206
+ /**
207
+ * Descriptor-backed metadata for a registered Protobuf message schema.
208
+ */
209
+ export interface TypeMetadata<Schema extends MessageSchema = MessageSchema> {
210
+ /**
211
+ * Fully qualified Protobuf message name, without a leading dot.
212
+ */
213
+ readonly fullTypeName: Schema["typeName"];
214
+ /**
215
+ * Canonical type URL used in `google.protobuf.Any` and Spine routing.
216
+ */
217
+ readonly typeUrl: string;
218
+ /**
219
+ * Generated Protobuf-ES schema for this message.
220
+ */
221
+ readonly schema: Schema;
222
+ /**
223
+ * Alias for the schema as the Protobuf-ES message descriptor.
224
+ */
225
+ readonly descriptor: Schema;
226
+ /**
227
+ * File descriptor that declared the message.
228
+ */
229
+ readonly fileDescriptor: GenFile;
230
+ /**
231
+ * Protobuf file name with the `.proto` suffix restored.
232
+ */
233
+ readonly fileName: string;
234
+ /**
235
+ * Prefix that produced {@link TypeMetadata.typeUrl}.
236
+ */
237
+ readonly typeUrlPrefix: string;
238
+ /**
239
+ * First declared field, preserving Protobuf source declaration order.
240
+ */
241
+ readonly firstField: DescField | undefined;
242
+ /**
243
+ * First declared field name, when the descriptor exposes one.
244
+ */
245
+ readonly firstFieldName: string | undefined;
246
+ /**
247
+ * Checks whether a file option is set on this schema's file descriptor.
248
+ * @param option The file option extension.
249
+ * @returns Whether the option is present.
250
+ */
251
+ hasFileOption<Value>(option: FileOptionExtension<Value>): boolean;
252
+ /**
253
+ * Reads a file option from this schema's file descriptor.
254
+ * @param option The file option extension.
255
+ * @returns The extension value.
256
+ */
257
+ getFileOption<Value>(option: FileOptionExtension<Value>): Value;
258
+ }
259
+ /**
260
+ * Protobuf extension descriptor whose extendee is `google.protobuf.FileOptions`.
261
+ */
262
+ export type FileOptionExtension<Value = unknown> = GenExtension<FileOptions, Value>;
263
+ /**
264
+ * Read-only lookup surface for a registry whose registrations are already fixed.
265
+ */
266
+ export interface TypeRegistryLookup {
267
+ /**
268
+ * Finds metadata by fully qualified Protobuf type name.
269
+ * @param fullTypeName The Protobuf type name.
270
+ * @returns Matching metadata, if registered.
271
+ */
272
+ findByFullName(fullTypeName: string): TypeMetadata | undefined;
273
+ /**
274
+ * Finds metadata by canonical type URL.
275
+ * @param typeUrl The canonical type URL.
276
+ * @returns Matching metadata, if registered.
277
+ */
278
+ findByTypeUrl(typeUrl: string): TypeMetadata | undefined;
279
+ /**
280
+ * Finds metadata by generated schema identity.
281
+ * @param schema The generated message schema.
282
+ * @returns Matching metadata, if registered.
283
+ */
284
+ findBySchema<Schema extends MessageSchema>(schema: Schema): TypeMetadata<Schema> | undefined;
285
+ /**
286
+ * Gets metadata by fully qualified Protobuf type name or throws a descriptive error.
287
+ * @param fullTypeName The Protobuf type name.
288
+ * @returns The registered metadata.
289
+ */
290
+ getByFullName(fullTypeName: string): TypeMetadata;
291
+ /**
292
+ * Gets metadata by canonical type URL or throws a descriptive error.
293
+ * @param typeUrl The canonical type URL.
294
+ * @returns The registered metadata.
295
+ */
296
+ getByTypeUrl(typeUrl: string): TypeMetadata;
297
+ /**
298
+ * Gets metadata by generated schema identity or throws a descriptive error.
299
+ * @param schema The generated message schema.
300
+ * @returns The registered metadata.
301
+ */
302
+ getBySchema<Schema extends MessageSchema>(schema: Schema): TypeMetadata<Schema>;
303
+ /**
304
+ * Returns all registered metadata in registration order.
305
+ * @returns The registered metadata entries.
306
+ */
307
+ list(): readonly TypeMetadata[];
308
+ }
309
+ /**
310
+ * Options for deriving a schema type URL.
311
+ */
312
+ export interface DeriveTypeUrlOptions {
313
+ /**
314
+ * Prefix used when the schema file has no Spine `type_url_prefix` option.
315
+ * Trailing `/` separators are removed; empty or whitespace-containing values
316
+ * are rejected with `TypeError`.
317
+ */
318
+ readonly fallbackPrefix?: string;
319
+ }
320
+ /**
321
+ * Options for Spine-aware `google.protobuf.Any` payload packing.
322
+ */
323
+ export interface PackAnyOptions {
324
+ /**
325
+ * Validate the enclosed domain message before serialization.
326
+ *
327
+ * Validation is enabled by default. Set this to `false` only for messages
328
+ * already validated by a trusted caller.
329
+ */
330
+ readonly validate?: boolean;
331
+ }
332
+ /**
333
+ * Input for creating a generated Spine `Command` envelope from a domain message.
334
+ */
335
+ export interface PackCommandInput<Schema extends MessageSchema = MessageSchema> extends PackAnyOptions {
336
+ /**
337
+ * Caller-supplied generated command ID.
338
+ */
339
+ readonly id: CommandId;
340
+ /**
341
+ * Caller-supplied generated command context.
342
+ */
343
+ readonly context: CommandContext;
344
+ /**
345
+ * Schema of the enclosed domain command message.
346
+ */
347
+ readonly schema: Schema;
348
+ /**
349
+ * Already-built domain command message to validate and pack.
350
+ */
351
+ readonly message: MessageShape<Schema>;
352
+ }
353
+ /**
354
+ * Input for creating a generated Spine `Event` envelope from a domain message.
355
+ */
356
+ export interface PackEventInput<Schema extends MessageSchema = MessageSchema> extends PackAnyOptions {
357
+ /**
358
+ * Caller-supplied generated event ID.
359
+ */
360
+ readonly id: EventId;
361
+ /**
362
+ * Caller-supplied generated event context.
363
+ */
364
+ readonly context: EventContext;
365
+ /**
366
+ * Schema of the enclosed domain event message.
367
+ */
368
+ readonly schema: Schema;
369
+ /**
370
+ * Already-built domain event message to validate and pack.
371
+ */
372
+ readonly message: MessageShape<Schema>;
373
+ }
374
+ /**
375
+ * Derives canonical Spine type URLs and validates explicit URLs.
376
+ */
377
+ export declare const TypeUrls: {
378
+ /**
379
+ * Calculates the deterministic type URL for a Protobuf-ES message schema.
380
+ * @param schema The message schema.
381
+ * @param options The fallback options.
382
+ * @returns The canonical type URL.
383
+ */
384
+ readonly derive: (schema: MessageSchema, options?: DeriveTypeUrlOptions) => string;
385
+ /**
386
+ * Returns the type URL prefix that applies to a schema.
387
+ * @param schema The message schema.
388
+ * @param fallbackPrefix The fallback prefix.
389
+ * @returns The canonical prefix.
390
+ */
391
+ readonly prefix: (schema: MessageSchema, fallbackPrefix?: string) => string;
392
+ /**
393
+ * Resolves an explicit or derived type URL for a schema registration.
394
+ * @param schema The message schema.
395
+ * @param explicitTypeUrl The explicit type URL.
396
+ * @returns The resolved type URL.
397
+ */
398
+ readonly resolve: (schema: MessageSchema, explicitTypeUrl: string | undefined) => string;
399
+ /**
400
+ * Validates an explicit type URL for a schema registration.
401
+ * @param schema The message schema.
402
+ * @param typeUrl The type URL to validate.
403
+ */
404
+ readonly validate: (schema: MessageSchema, typeUrl: string) => void;
405
+ };
406
+ /**
407
+ * Packs and unpacks Spine messages in `google.protobuf.Any` envelopes.
408
+ */
409
+ export declare const AnyMessages: {
410
+ /**
411
+ * Packs a message into `Any`, omitting unknown fields from binary output.
412
+ * @param schema The message schema.
413
+ * @param message The message to pack.
414
+ * @param options The packing options.
415
+ * @returns The packed Any message.
416
+ */
417
+ readonly pack: <Schema extends MessageSchema>(schema: Schema, message: MessageShape<Schema>, options?: PackAnyOptions) => Any;
418
+ /**
419
+ * Unpacks an `Any` when its type URL exactly matches the requested schema.
420
+ * @param packed The packed message.
421
+ * @param schema The expected schema.
422
+ * @returns The unpacked message, when valid.
423
+ */
424
+ readonly unpack: <Schema extends MessageSchema>(packed: Any, schema: Schema) => MessageShape<Schema> | undefined;
425
+ /**
426
+ * Unpacks an `Any` when its exact type URL is registered.
427
+ * @param registry The schema registry.
428
+ * @param packed The packed message.
429
+ * @returns The unpacked message, when valid.
430
+ */
431
+ readonly unpackUsing: (registry: TypeRegistryLookup, packed: Any) => Message | undefined;
432
+ };
433
+ /**
434
+ * Converts one value to and from its stable string representation.
435
+ */
436
+ export interface Stringifier<T> {
437
+ /**
438
+ * Restores a value from its string representation.
439
+ * @param value The stored string.
440
+ * @returns The restored value.
441
+ */
442
+ fromString(value: string): T;
443
+ /**
444
+ * Converts a value to its string representation.
445
+ * @param value The value to convert.
446
+ * @returns The stored string.
447
+ */
448
+ toString(value: T): string;
449
+ }
450
+ /**
451
+ * Supplies reversible default stringifiers for generated Protobuf messages.
452
+ */
453
+ export declare const Stringifiers: {
454
+ /**
455
+ * Creates the default compact Proto JSON stringifier for a message schema.
456
+ * @param schema The generated message schema.
457
+ * @param types The optional generated-type registry used to expand `Any` values.
458
+ * @returns A reversible schema-bound stringifier.
459
+ */
460
+ readonly forMessage: <Schema extends MessageSchema>(schema: Schema, types?: TypeRegistryLookup | Registry) => Stringifier<MessageShape<Schema>>;
461
+ /**
462
+ * Creates a reversible stringifier for one supported singular field.
463
+ *
464
+ * Scalar, bytes, enum, and message fields are supported. Numeric text is
465
+ * canonical, finite, and range-checked; `float` values are normalized to
466
+ * binary32. Repeated and map fields are rejected.
467
+ *
468
+ * @param field The Protobuf field descriptor.
469
+ * @param types The optional generated-type registry used by message fields.
470
+ * @returns A stringifier for the field's runtime value.
471
+ */
472
+ readonly forField: (field: DescField, types?: TypeRegistryLookup | Registry) => Stringifier<unknown>;
473
+ };
474
+ /**
475
+ * Holds schema-bound custom stringifiers with Proto JSON defaults.
476
+ */
477
+ export declare class StringifierRegistry {
478
+ #private;
479
+ /**
480
+ * Creates an empty registry or a snapshot of another registry.
481
+ *
482
+ * @param source The optional registry to copy.
483
+ */
484
+ constructor(source?: StringifierRegistry);
485
+ /**
486
+ * Registers or replaces the stringifier for one generated message type.
487
+ * @param schema The generated message schema.
488
+ * @param stringifier The reversible stringifier.
489
+ */
490
+ register<Schema extends MessageSchema>(schema: Schema, stringifier: Stringifier<MessageShape<Schema>>): void;
491
+ /**
492
+ * Sets the generated-type registry used by default message stringifiers.
493
+ *
494
+ * @param types Resolves message types embedded in `Any` values.
495
+ */
496
+ setTypeRegistry(types: TypeRegistryLookup): void;
497
+ /**
498
+ * Returns the custom stringifier or the default compact Proto JSON mapping.
499
+ * @param schema The generated message schema.
500
+ * @returns The schema-bound stringifier.
501
+ */
502
+ forMessage<Schema extends MessageSchema>(schema: Schema): Stringifier<MessageShape<Schema>>;
503
+ /**
504
+ * Returns the configured reversible mapping for one supported singular field.
505
+ *
506
+ * Scalar, bytes, enum, and message fields are supported. Numeric text is
507
+ * canonical, finite, and range-checked; `float` values are normalized to
508
+ * binary32. Repeated and map fields are rejected. Registered message mappings
509
+ * take precedence over compact Proto JSON defaults.
510
+ *
511
+ * @param field The Protobuf field descriptor.
512
+ * @returns A stringifier for the field's runtime value.
513
+ */
514
+ forField(field: DescField): Stringifier<unknown>;
515
+ }
516
+ /**
517
+ * Primitive identifier kinds supported by Spine JVM storage.
518
+ */
519
+ export type PrimitiveIdentifierType = "string" | "int32" | "int64";
520
+ interface IdentifierCodec {
521
+ /**
522
+ * Packs a message-valued identifier.
523
+ *
524
+ * @param schema The generated identifier schema.
525
+ * @param value The identifier value.
526
+ * @returns The packed identifier.
527
+ */
528
+ pack<Schema extends MessageSchema>(schema: Schema, value: MessageShape<Schema>): Any;
529
+ /**
530
+ * Packs a string identifier.
531
+ *
532
+ * @param type The string identifier kind.
533
+ * @param value The identifier value.
534
+ * @returns The packed identifier.
535
+ */
536
+ pack(type: "string", value: string): Any;
537
+ /**
538
+ * Packs an `int32` identifier.
539
+ *
540
+ * @param type The `int32` identifier kind.
541
+ * @param value The identifier value.
542
+ * @returns The packed identifier.
543
+ */
544
+ pack(type: "int32", value: number): Any;
545
+ /**
546
+ * Packs an `int64` identifier.
547
+ *
548
+ * @param type The `int64` identifier kind.
549
+ * @param value The identifier value.
550
+ * @returns The packed identifier.
551
+ */
552
+ pack(type: "int64", value: bigint): Any;
553
+ /**
554
+ * Unpacks a message-valued identifier.
555
+ *
556
+ * @param schema The generated identifier schema.
557
+ * @param value The packed identifier.
558
+ * @returns The decoded identifier, or `undefined` for another type.
559
+ */
560
+ unpack<Schema extends MessageSchema>(schema: Schema, value: Any): MessageShape<Schema> | undefined;
561
+ /**
562
+ * Unpacks a string identifier.
563
+ *
564
+ * @param type The string identifier kind.
565
+ * @param value The packed identifier.
566
+ * @returns The decoded identifier, or `undefined` for another type.
567
+ */
568
+ unpack(type: "string", value: Any): string | undefined;
569
+ /**
570
+ * Unpacks an `int32` identifier.
571
+ *
572
+ * @param type The `int32` identifier kind.
573
+ * @param value The packed identifier.
574
+ * @returns The decoded identifier, or `undefined` for another type.
575
+ */
576
+ unpack(type: "int32", value: Any): number | undefined;
577
+ /**
578
+ * Unpacks an `int64` identifier.
579
+ *
580
+ * @param type The `int64` identifier kind.
581
+ * @param value The packed identifier.
582
+ * @returns The decoded identifier, or `undefined` for another type.
583
+ */
584
+ unpack(type: "int64", value: Any): bigint | undefined;
585
+ }
586
+ /**
587
+ * Packs and unpacks the identifier types supported by Spine JVM storage.
588
+ */
589
+ export declare const Identifiers: IdentifierCodec;
590
+ /**
591
+ * Creates generated Spine command and event envelopes.
592
+ */
593
+ export declare const SignalEnvelopes: {
594
+ /**
595
+ * Packs a generated Spine command envelope from caller-supplied data.
596
+ * @param input The command envelope input.
597
+ * @returns The packed command.
598
+ */
599
+ readonly command: <Schema extends MessageSchema>(input: PackCommandInput<Schema>) => Command;
600
+ /**
601
+ * Packs a generated Spine event envelope from caller-supplied data.
602
+ * @param input The event envelope input.
603
+ * @returns The packed event.
604
+ */
605
+ readonly event: <Schema extends MessageSchema>(input: PackEventInput<Schema>) => Event;
606
+ };
607
+ /**
608
+ * Registry for Protobuf schemas, Spine type URLs, and descriptor metadata.
609
+ */
610
+ export declare class TypeRegistry {
611
+ #private;
612
+ /**
613
+ * Creates a registry and optionally registers schemas immediately.
614
+ * @param schemas The schemas to register.
615
+ */
616
+ constructor(schemas?: Iterable<MessageSchema>);
617
+ /**
618
+ * Creates a registry from modules in deterministic dependency-first order.
619
+ * @param modules The modules to compose.
620
+ * @returns The composed registry.
621
+ */
622
+ static from(...modules: readonly ProtoModule[]): TypeRegistry;
623
+ /**
624
+ * Creates a registry containing the currently curated Spine schemas.
625
+ * @returns The mutable curated registry.
626
+ */
627
+ static spineCore(): TypeRegistry;
628
+ /**
629
+ * Registers one schema and returns its immutable metadata.
630
+ * @param schema The generated message schema.
631
+ * @param options Optional explicit type URL.
632
+ * @returns The registered schema metadata.
633
+ */
634
+ register<Schema extends MessageSchema>(schema: Schema, options?: RegisterTypeOptions): TypeMetadata<Schema>;
635
+ /**
636
+ * Finds metadata by fully qualified Protobuf type name.
637
+ * @param fullTypeName The Protobuf type name.
638
+ * @returns Matching metadata, if registered.
639
+ */
640
+ findByFullName(fullTypeName: string): TypeMetadata | undefined;
641
+ /**
642
+ * Finds metadata by canonical type URL.
643
+ * @param typeUrl The canonical type URL.
644
+ * @returns Matching metadata, if registered.
645
+ */
646
+ findByTypeUrl(typeUrl: string): TypeMetadata | undefined;
647
+ /**
648
+ * Finds metadata by generated schema identity.
649
+ * @param schema The generated message schema.
650
+ * @returns Matching metadata, if registered.
651
+ */
652
+ findBySchema<Schema extends MessageSchema>(schema: Schema): TypeMetadata<Schema> | undefined;
653
+ /**
654
+ * Gets metadata by fully qualified Protobuf type name or throws a descriptive error.
655
+ * @param fullTypeName The Protobuf type name.
656
+ * @returns The registered metadata.
657
+ */
658
+ getByFullName(fullTypeName: string): TypeMetadata;
659
+ /**
660
+ * Gets metadata by canonical type URL or throws a descriptive error.
661
+ * @param typeUrl The canonical type URL.
662
+ * @returns The registered metadata.
663
+ */
664
+ getByTypeUrl(typeUrl: string): TypeMetadata;
665
+ /**
666
+ * Gets metadata by generated schema identity or throws a descriptive error.
667
+ * @param schema The generated message schema.
668
+ * @returns The registered metadata.
669
+ */
670
+ getBySchema<Schema extends MessageSchema>(schema: Schema): TypeMetadata<Schema>;
671
+ /**
672
+ * Returns all registered metadata in registration order.
673
+ * @returns The registered metadata entries.
674
+ */
675
+ list(): readonly TypeMetadata[];
676
+ }
677
+ /**
678
+ * Shared registry for the first curated Spine schema set.
679
+ */
680
+ export declare const spineCoreRegistry: TypeRegistryLookup;
681
+ export {};
682
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AA0BA,OAAO,KAAK,EACV,SAAS,EACT,OAAO,EACP,gBAAgB,EAChB,YAAY,EACZ,QAAQ,EACT,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAEtF,OAAO,EAKL,KAAK,GAAG,EACR,KAAK,WAAW,EACjB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAEL,KAAK,OAAO,EACZ,KAAK,cAAc,EAEnB,KAAK,SAAS,EASd,KAAK,KAAK,EACV,KAAK,YAAY,EAEjB,KAAK,OAAO,EAoBZ,KAAK,mBAAmB,EACxB,KAAK,WAAW,EAChB,KAAK,eAAe,EACrB,MAAM,2BAA2B,CAAC;AASnC;;GAEG;AACH,eAAO,MAAM,uBAAuB,wBAAwB,CAAC;AAE7D;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,UAAU,CA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