@hogsend/core 0.14.0 → 0.17.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hogsend/core",
3
- "version": "0.14.0",
3
+ "version": "0.17.0",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -32,7 +32,7 @@
32
32
  "drizzle-orm": "^0.45.2",
33
33
  "iana-db-timezones": "^0.3.0",
34
34
  "zod": "^4.4.3",
35
- "@hogsend/db": "^0.14.0"
35
+ "@hogsend/db": "^0.17.0"
36
36
  },
37
37
  "devDependencies": {
38
38
  "@types/node": "latest",
@@ -1,6 +1,44 @@
1
+ import type { CriteriaBuilder } from "../conditions/builder.js";
1
2
  import type { DurationObject } from "../duration.js";
2
3
  import type { PropertyCondition } from "./conditions.js";
3
4
 
5
+ /**
6
+ * The builder surface available to a journey `where` function — property
7
+ * terminals only. Trigger/exit conditions evaluate against the TRIGGERING
8
+ * event's properties; counts, windows, and engagement belong in bucket
9
+ * criteria or `ctx.history`, not here.
10
+ */
11
+ export type JourneyWhereBuilder = Pick<CriteriaBuilder, "prop">;
12
+
13
+ /**
14
+ * Authoring form of `trigger.where` / `exitOn[].where`: the stored data form
15
+ * (`PropertyCondition[]`), or a builder function resolved ONCE at
16
+ * `defineJourney` time into the byte-identical POJOs —
17
+ * `where: (b) => b.prop("score").lte(6)`. The function never executes
18
+ * per-user, so conditions stay introspectable data everywhere downstream
19
+ * (registry, admin routes, Studio).
20
+ */
21
+ export type JourneyWhere =
22
+ | PropertyCondition[]
23
+ | ((b: JourneyWhereBuilder) => PropertyCondition | PropertyCondition[]);
24
+
25
+ /**
26
+ * What `defineJourney` ACCEPTS. The stored {@link JourneyMeta} (registry,
27
+ * schema, HTTP) keeps plain `PropertyCondition[]` — only the authoring
28
+ * surface widens.
29
+ */
30
+ export interface JourneyMetaInput
31
+ extends Omit<JourneyMeta, "trigger" | "exitOn"> {
32
+ trigger: {
33
+ event: string;
34
+ where?: JourneyWhere;
35
+ };
36
+ exitOn?: Array<{
37
+ event: string;
38
+ where?: JourneyWhere;
39
+ }>;
40
+ }
41
+
4
42
  export interface JourneyMeta {
5
43
  id: string;
6
44
  name: string;