@cowliss/cli 0.5.0 → 0.7.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,11 +1,11 @@
1
- import { n as Duration, r as GuestEvent, t as Trigger } from "./index-BDj02EsQ.js";
1
+ import { i as GuestEvent, n as Trigger, r as TriggerInput, t as Duration } from "./index-3PMqJKmc.js";
2
2
  //#region src/guest/journeys.d.ts
3
3
  /** The event a journey runs for, or the one a `waitForEvent` resolved with. */
4
4
  type Event = GuestEvent;
5
5
  /**
6
6
  * A profile as the capability layer hands it back: the recipient of this
7
- * execution (`api.profile.get()`) or another profile in the same org and
8
- * environment (`api.profiles.get(id)`). A fresh read on every call.
7
+ * execution (`api.profile.get()`) or another profile in the same org
8
+ * (`api.profiles.get(id)`). A fresh read on every call.
9
9
  */
10
10
  type Profile = {
11
11
  /** The Cowliss-generated profile id (`usr_`). */
@@ -23,7 +23,7 @@ type EmailSendResult = {
23
23
  status: string;
24
24
  };
25
25
  /**
26
- * A capability that failed host-side (an unknown destination, invalid
26
+ * A capability that failed host-side (an unknown webhook, invalid
27
27
  * props, a profile that is not there). The failure is journaled, so a
28
28
  * journey that catches it takes the same branch on every replay.
29
29
  */
@@ -68,11 +68,16 @@ type Api = {
68
68
  template: Key;
69
69
  props: TemplateProps<Key>;
70
70
  /**
71
- * Send this one mail from a different sender identity than the
72
- * journey's own. A name the organization has configured, resolved in
73
- * the environment the execution is running in.
71
+ * Send this one mail from a different address than the journey's own:
72
+ * `"billing@acme.com"` or `"Billing <billing@acme.com>"`. The domain
73
+ * must be one your organization has verified, or the send is skipped.
74
74
  */
75
- senderIdentity?: string;
75
+ from?: string;
76
+ /**
77
+ * Where a reply to this one mail goes, instead of the from-address.
78
+ * Any address: nothing is sent from it.
79
+ */
80
+ replyTo?: string;
76
81
  }): Promise<EmailSendResult>;
77
82
  webhook(args: {
78
83
  destination: string;
@@ -116,22 +121,41 @@ type Api = {
116
121
  type JourneyConfig = {
117
122
  trigger: Trigger;
118
123
  /**
119
- * A fixed purpose (`emailMarketing`, `dataProcessing`) or one this
120
- * project declares in `cow.json`. The key's shape is checked here; that
121
- * the org declares it is checked when the release is deployed.
124
+ * Why this journey contacts someone: `marketing`, `transactional`, or a
125
+ * purpose this project declares in `cow.json`. The key's shape is checked
126
+ * here; that the org declares it is checked when the release is deployed.
122
127
  */
123
128
  purpose: string;
124
129
  /**
125
- * The sender identity every `api.send.email` in this journey goes out as:
126
- * the name of one your organization has configured, or `cowliss-default`
127
- * for the address Cowliss gives you with nothing to set up. A single send
130
+ * How often one recipient may enter this journey. A marketing journey
131
+ * enrolls each recipient once, ever; give it a `cooldown` and it re-opens
132
+ * that long after their last completed run. A transactional journey
133
+ * enrolls on every trigger — three orders are three receipts — so it
134
+ * takes no cooldown and `cow build` refuses one.
135
+ *
136
+ * History counts: adding a cooldown to a journey that has been running
137
+ * for months measures from runs that already completed.
138
+ */
139
+ enrollment?: {
140
+ cooldown: Duration;
141
+ };
142
+ /**
143
+ * One plain sentence saying what this journey does for the person who
144
+ * gets it. Shown wherever the journey is read. Optional; at most 500
145
+ * characters.
146
+ */
147
+ description?: string;
148
+ /**
149
+ * The address every `api.send.email` in this journey goes out as:
150
+ * `"billing@acme.com"` or `"Billing <billing@acme.com>"`. A single send
128
151
  * can override it.
129
152
  *
130
- * Required, and named here rather than in a settings page, so the address
131
- * a journey sends from is readable in the journey's own source. It is
132
- * resolved per environment, which is why it is a name and not an id.
153
+ * Required, on a domain your organization has verified: there is no
154
+ * address Cowliss lends you. Named here rather than in a settings page,
155
+ * so the address a journey sends from is readable in the journey's own
156
+ * source.
133
157
  */
134
- senderIdentity: string;
158
+ from: string;
135
159
  /** The author's labels; the dashboard's only grouping. Defaults to none. */
136
160
  tags: string[];
137
161
  };
@@ -141,13 +165,18 @@ type Journey = JourneyConfig & {
141
165
  /**
142
166
  * Author a journey. Throws at definition time on an invalid config.
143
167
  *
144
- * There is no environment gate here: a journey runs wherever it is enabled,
145
- * and nowhere else (ADR 0011). A source that still passes `environments` is
146
- * a typecheck error in `cow build`, which is where the author can fix it.
168
+ * There is no environment gate here: an organization has one data space, and
169
+ * a journey runs wherever it is on and nowhere else (ADR 0011, ADR 0013).
147
170
  */
148
- declare function defineJourney(input: Omit<JourneyConfig, "tags"> & {
171
+ declare function defineJourney(input: Omit<JourneyConfig, "tags" | "trigger"> & {
172
+ /**
173
+ * What starts it: `{ event }`, or `{ segment }` carrying the predicate
174
+ * list of the segment this journey enrolls from. Written form, so a
175
+ * predicate can leave `match` and `atLeast` out.
176
+ */
177
+ trigger: TriggerInput;
149
178
  tags?: string[];
150
179
  run: (event: Event, api: Api) => Promise<void>;
151
180
  }): Journey;
152
181
  //#endregion
153
- export { Api, CapabilityError, CowTemplates, type Duration, EmailSendResult, Event, Journey, JourneyConfig, Profile, type Trigger, defineJourney };
182
+ export { Api, CapabilityError, CowTemplates, type Duration, EmailSendResult, Event, Journey, JourneyConfig, Profile, type Trigger, type TriggerInput, defineJourney };
@@ -1,3 +1,3 @@
1
- import { n as defineJourney, t as CapabilityError } from "./journeys-C8j8Sqvl.js";
1
+ import { n as defineJourney, t as CapabilityError } from "./journeys-Dpsp225V.js";
2
2
 
3
3
  export { CapabilityError, defineJourney };
@@ -1,4 +1,4 @@
1
- import { t as runGuest } from "./driver-14FnzM-h.js";
1
+ import { t as runGuest } from "./driver-C1bsCjZT.js";
2
2
 
3
3
  //#region src/guest/wasi.ts
4
4
  const STDIN = 0;