@hogsend/engine 0.55.0 → 0.57.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 +11 -11
- package/src/buckets/bucket-access.ts +5 -10
- package/src/buckets/check-membership.ts +91 -6
- package/src/index.ts +31 -1
- package/src/journeys/execute-journey-run.ts +56 -1
- package/src/journeys/journey-context.ts +59 -0
- package/src/lib/bucket-emit.test.ts +83 -2
- package/src/lib/bucket-emit.ts +16 -0
- package/src/lib/contacts.ts +1031 -141
- package/src/lib/crm-ingest.ts +9 -0
- package/src/lib/enrichment-ledger.ts +1 -1
- package/src/lib/feed.ts +64 -3
- package/src/lib/identity-service.ts +15 -2
- package/src/lib/ingestion.ts +191 -14
- package/src/lib/outbound.ts +3 -3
- package/src/lib/refine-chain.test.ts +83 -25
- package/src/lib/refine-chain.ts +124 -23
- package/src/lib/refine-traits.test.ts +74 -41
- package/src/lib/refine-traits.ts +107 -52
- package/src/lib/refine.ts +28 -27
- package/src/lib/tracking-events.ts +33 -6
- package/src/routes/admin/agent.ts +26 -0
- package/src/routes/admin/contacts.ts +65 -5
- package/src/routes/admin/identity.ts +197 -0
- package/src/routes/admin/index.ts +2 -0
- package/src/routes/contacts/index.ts +50 -7
- package/src/routes/events/index.ts +94 -6
- package/src/routes/feed/index.ts +36 -0
- package/src/routes/feed/recipient.ts +44 -2
- package/src/routes/lists/index.ts +21 -0
- package/src/routes/tracking/arrive.ts +42 -3
- package/src/worker.ts +18 -0
- package/src/workflows/bucket-backfill.ts +1 -1
- package/src/workflows/bucket-reconcile.ts +129 -4
- package/src/workflows/identity-alias-backfill.ts +448 -0
- package/src/workflows/import-contacts.ts +10 -0
- package/src/workflows/send-campaign.ts +31 -13
package/src/lib/bucket-emit.ts
CHANGED
|
@@ -51,6 +51,17 @@ export async function emitBucketTransition(opts: {
|
|
|
51
51
|
* the pin-less resolve (exactly the pre-pin behaviour).
|
|
52
52
|
*/
|
|
53
53
|
contactId?: string;
|
|
54
|
+
/**
|
|
55
|
+
* D1 creation guard for BOTH re-ingests below, inherited from the originating
|
|
56
|
+
* ingest via `checkBucketMembership`. `false` ⇒ the transition event stores
|
|
57
|
+
* and routes exactly as always, but mints no `contacts` row. This is the
|
|
58
|
+
* ONLY correct behavior when the producer has no `contactId` to pin with:
|
|
59
|
+
* degrading the pin instead would make the resolver read this transition's
|
|
60
|
+
* `userId` (the subject's canonical key, often its `anonymous_id`) as an
|
|
61
|
+
* EXTERNAL key and mint a phantom `external_id` twin (issue #608). Producers
|
|
62
|
+
* that legitimately create (the reconcile cron, backfill) leave it unset.
|
|
63
|
+
*/
|
|
64
|
+
allowCreate?: boolean;
|
|
54
65
|
epoch: number;
|
|
55
66
|
source?: BucketTransitionSource;
|
|
56
67
|
/** Carried on a `left` transition's properties → `ctx.reason`. */
|
|
@@ -80,6 +91,7 @@ export async function emitBucketTransition(opts: {
|
|
|
80
91
|
userId,
|
|
81
92
|
userEmail,
|
|
82
93
|
contactId,
|
|
94
|
+
allowCreate,
|
|
83
95
|
epoch,
|
|
84
96
|
source = "event",
|
|
85
97
|
reason,
|
|
@@ -141,6 +153,7 @@ export async function emitBucketTransition(opts: {
|
|
|
141
153
|
registry,
|
|
142
154
|
hatchet,
|
|
143
155
|
logger,
|
|
156
|
+
allowCreate,
|
|
144
157
|
event: {
|
|
145
158
|
event: eventName,
|
|
146
159
|
userId,
|
|
@@ -161,6 +174,9 @@ export async function emitBucketTransition(opts: {
|
|
|
161
174
|
registry,
|
|
162
175
|
hatchet,
|
|
163
176
|
logger,
|
|
177
|
+
// Same inherited refusal as the alias emit above — forwarding it on ONLY
|
|
178
|
+
// one leg would leave the ghost half-alive for generic-bound journeys.
|
|
179
|
+
allowCreate,
|
|
164
180
|
event: {
|
|
165
181
|
event: genericEvent,
|
|
166
182
|
userId,
|