@nwire/messages 0.12.0 → 0.13.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.
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { z, ZodType } from "zod";
|
|
2
|
-
import { type SourceLocation } from "./source-location.js";
|
|
3
2
|
/**
|
|
4
3
|
* Workspace alias for "any zod schema". Zod 4 dropped the `ZodTypeAny`
|
|
5
4
|
* export; this alias keeps the rest of the codebase reading naturally
|
|
@@ -103,8 +102,6 @@ export interface EventMessageOf<TSchema extends ZodTypeAny> {
|
|
|
103
102
|
export type EventDefinition<TSchema extends ZodTypeAny = ZodTypeAny> = EventDefinitionMeta<TSchema> & ((payload: z.output<TSchema>) => EventMessageOf<TSchema>) & {
|
|
104
103
|
/** Module-manifest visibility marker. See `defineWorkflow.public()` notes. */
|
|
105
104
|
readonly $public?: true;
|
|
106
|
-
/** Where the event was declared. Studio uses this for IDE-open links. */
|
|
107
|
-
readonly $source?: SourceLocation;
|
|
108
105
|
/** Return a callable event clone with `$public: true`. */
|
|
109
106
|
public: () => EventDefinition<TSchema>;
|
|
110
107
|
};
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import { captureSourceLocation } from "./source-location.js";
|
|
2
1
|
export function defineCommand(def) {
|
|
3
2
|
return def;
|
|
4
3
|
}
|
|
5
4
|
export function defineEvent(def) {
|
|
6
|
-
const $source = captureSourceLocation();
|
|
7
5
|
// Infer scope from visibility when not explicit.
|
|
8
6
|
const scope = def.scope ??
|
|
9
7
|
(def.visibility === "internal"
|
|
@@ -43,7 +41,6 @@ export function defineEvent(def) {
|
|
|
43
41
|
version: { value: def.version, enumerable: true },
|
|
44
42
|
toString: { value: () => def.name, enumerable: false },
|
|
45
43
|
public: { value: publicMethod, enumerable: false, configurable: true },
|
|
46
|
-
$source: { value: $source, enumerable: false, configurable: true },
|
|
47
44
|
});
|
|
48
45
|
return factory;
|
|
49
46
|
}
|
package/dist/messages.d.ts
CHANGED
|
@@ -10,5 +10,4 @@
|
|
|
10
10
|
export { defineCommand, defineEvent, type CommandDefinition, type EventDefinition, type EventDefinitionMeta, type EventMessageOf, type CommandPayload, type EventPayload, type EventVisibility, type EventOutcome, type EventScope, type ZodTypeAny, } from "./message-contracts.js";
|
|
11
11
|
export { NoopCommand } from "./commands/noop.command.js";
|
|
12
12
|
export { ServiceBootedEvent } from "./events/service-booted.event.js";
|
|
13
|
-
export { captureSourceLocation, type SourceLocation } from "./source-location.js";
|
|
14
13
|
export { VALIDATED, markValidated, isValidated, type Validated } from "./validated.js";
|
package/dist/messages.js
CHANGED
|
@@ -10,5 +10,4 @@
|
|
|
10
10
|
export { defineCommand, defineEvent, } from "./message-contracts.js";
|
|
11
11
|
export { NoopCommand } from "./commands/noop.command.js";
|
|
12
12
|
export { ServiceBootedEvent } from "./events/service-booted.event.js";
|
|
13
|
-
export { captureSourceLocation } from "./source-location.js";
|
|
14
13
|
export { VALIDATED, markValidated, isValidated } from "./validated.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nwire/messages",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.0",
|
|
4
4
|
"description": "Nwire — typed command and event contracts. defineCommand, defineEvent with public/internal visibility. Zod-validated; shareable across the backend, frontends, BFFs.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"commands",
|