@hasna/events 0.1.15 → 0.1.17
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 +16 -5
- package/dist/cli/index.js +554 -53
- package/dist/commander.js +481 -20
- package/dist/durable.js +524 -34
- package/dist/index.js +486 -20
- package/dist/ssrf.js +222 -0
- package/dist/storage.js +120 -15
- package/dist/transports.js +355 -1
- package/fixtures/hasna.app_event.v1.json +2 -2
- package/package.json +7 -2
- package/types/app-home.d.ts +33 -0
- package/types/durable.d.ts +2 -0
- package/types/index.d.ts +1 -0
- package/types/ssrf.d.ts +59 -0
- package/types/storage.d.ts +2 -2
- package/types/transports.d.ts +23 -0
package/README.md
CHANGED
|
@@ -8,8 +8,19 @@ This package is local-first. By default it stores JSON files under `~/.hasna/eve
|
|
|
8
8
|
- `events.json`
|
|
9
9
|
- `deliveries.json`
|
|
10
10
|
|
|
11
|
-
The
|
|
12
|
-
|
|
11
|
+
The data home is resolved through the shared `@hasna/paths` resolver, in this order:
|
|
12
|
+
|
|
13
|
+
1. The CLI `--dir` flag (highest precedence);
|
|
14
|
+
2. the exact-app `HASNA_EVENTS_DIR` override, then the legacy
|
|
15
|
+
`HASNA_EVENTS_HOME` fallback;
|
|
16
|
+
3. the `@hasna/paths`-resolved XDG data home (`HASNA_DATA_HOME`/`~/.local/share/hasna/events`),
|
|
17
|
+
adopted once `HASNA_DATA_HOME` is set or the store has been physically migrated there
|
|
18
|
+
(`events.json` exists at that home);
|
|
19
|
+
4. the legacy `~/.hasna/events` default.
|
|
20
|
+
|
|
21
|
+
Nothing moves on its own: the package keeps reading and writing whichever home is
|
|
22
|
+
effective, and the legacy `~/.hasna/events` stays effective until an operator opts into
|
|
23
|
+
the XDG layout or the store is migrated to it.
|
|
13
24
|
|
|
14
25
|
## Storage Runtime Contract
|
|
15
26
|
|
|
@@ -137,9 +148,9 @@ const client = new EventsClient({ catalog, validateCatalogTypes: true });
|
|
|
137
148
|
// Registered type with an invalid payload throws EventValidationError
|
|
138
149
|
// BEFORE the event is stored or delivered.
|
|
139
150
|
await client.emit({
|
|
140
|
-
source: "
|
|
151
|
+
source: "publish",
|
|
141
152
|
type: "release.published",
|
|
142
|
-
data: { appId: "
|
|
153
|
+
data: { appId: "todos" },
|
|
143
154
|
});
|
|
144
155
|
```
|
|
145
156
|
|
|
@@ -520,7 +531,7 @@ events channels add events --id nested-route --transport command -- handle todos
|
|
|
520
531
|
events channels match open-source-task-route \
|
|
521
532
|
--source todos \
|
|
522
533
|
--type task.created \
|
|
523
|
-
--metadata '{"project_path":"/home/hasna/workspace/hasna/
|
|
534
|
+
--metadata '{"project_path":"/home/hasna/workspace/repos/hasna/events","route_enabled":true}'
|
|
524
535
|
|
|
525
536
|
events channels test open-source-task-route --honor-filters \
|
|
526
537
|
--source todos \
|