@boboddy/sdk 0.3.1 → 0.4.2

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/dist/client.js CHANGED
@@ -1069,7 +1069,7 @@ class StepExecutions extends HeyApiClient {
1069
1069
  class PipelineDefinitions extends HeyApiClient {
1070
1070
  createPipelineDefinition(options) {
1071
1071
  return (options.client ?? this.client).post({
1072
- url: "/api/linear-pipeline-definitions",
1072
+ url: "/api/pipeline-definitions",
1073
1073
  ...options,
1074
1074
  headers: {
1075
1075
  "Content-Type": "application/json",
@@ -1079,7 +1079,7 @@ class PipelineDefinitions extends HeyApiClient {
1079
1079
  }
1080
1080
  upsertPipelineDefinition(options) {
1081
1081
  return (options.client ?? this.client).put({
1082
- url: "/api/linear-pipeline-definitions",
1082
+ url: "/api/pipeline-definitions",
1083
1083
  ...options,
1084
1084
  headers: {
1085
1085
  "Content-Type": "application/json",
@@ -1088,14 +1088,14 @@ class PipelineDefinitions extends HeyApiClient {
1088
1088
  });
1089
1089
  }
1090
1090
  archivePipelineDefinition(options) {
1091
- return (options.client ?? this.client).put({ url: "/api/linear-pipeline-definitions/{linearPipelineDefinitionId}/archive", ...options });
1091
+ return (options.client ?? this.client).put({ url: "/api/pipeline-definitions/{pipelineDefinitionId}/archive", ...options });
1092
1092
  }
1093
1093
  unarchivePipelineDefinition(options) {
1094
- return (options.client ?? this.client).put({ url: "/api/linear-pipeline-definitions/{linearPipelineDefinitionId}/unarchive", ...options });
1094
+ return (options.client ?? this.client).put({ url: "/api/pipeline-definitions/{pipelineDefinitionId}/unarchive", ...options });
1095
1095
  }
1096
1096
  addPipelineStep(options) {
1097
1097
  return (options.client ?? this.client).post({
1098
- url: "/api/linear-pipeline-definitions/{linearPipelineDefinitionId}/steps",
1098
+ url: "/api/pipeline-definitions/{pipelineDefinitionId}/steps",
1099
1099
  ...options,
1100
1100
  headers: {
1101
1101
  "Content-Type": "application/json",
@@ -1104,11 +1104,11 @@ class PipelineDefinitions extends HeyApiClient {
1104
1104
  });
1105
1105
  }
1106
1106
  removePipelineStep(options) {
1107
- return (options.client ?? this.client).delete({ url: "/api/linear-pipeline-definitions/{linearPipelineDefinitionId}/steps/{linearPipelineStepDefinitionId}", ...options });
1107
+ return (options.client ?? this.client).delete({ url: "/api/pipeline-definitions/{pipelineDefinitionId}/steps/{pipelineStepDefinitionId}", ...options });
1108
1108
  }
1109
1109
  updatePipelineStep(options) {
1110
1110
  return (options.client ?? this.client).put({
1111
- url: "/api/linear-pipeline-definitions/{linearPipelineDefinitionId}/steps/{linearPipelineStepDefinitionId}",
1111
+ url: "/api/pipeline-definitions/{pipelineDefinitionId}/steps/{pipelineStepDefinitionId}",
1112
1112
  ...options,
1113
1113
  headers: {
1114
1114
  "Content-Type": "application/json",
@@ -1118,7 +1118,7 @@ class PipelineDefinitions extends HeyApiClient {
1118
1118
  }
1119
1119
  setPipelineStepAdvancementPolicy(options) {
1120
1120
  return (options.client ?? this.client).put({
1121
- url: "/api/linear-pipeline-definitions/{linearPipelineDefinitionId}/steps/{linearPipelineStepDefinitionId}/advancement-policy",
1121
+ url: "/api/pipeline-definitions/{pipelineDefinitionId}/steps/{pipelineStepDefinitionId}/advancement-policy",
1122
1122
  ...options,
1123
1123
  headers: {
1124
1124
  "Content-Type": "application/json",
@@ -1127,20 +1127,20 @@ class PipelineDefinitions extends HeyApiClient {
1127
1127
  });
1128
1128
  }
1129
1129
  getPipelineDefinition(options) {
1130
- return (options.client ?? this.client).get({ url: "/api/linear-pipeline-definitions/{linearPipelineDefinitionId}", ...options });
1130
+ return (options.client ?? this.client).get({ url: "/api/pipeline-definitions/{pipelineDefinitionId}", ...options });
1131
1131
  }
1132
1132
  listPipelineDefinitions(options) {
1133
- return (options.client ?? this.client).get({ url: "/api/projects/{projectId}/linear-pipeline-definitions", ...options });
1133
+ return (options.client ?? this.client).get({ url: "/api/projects/{projectId}/pipeline-definitions", ...options });
1134
1134
  }
1135
1135
  }
1136
1136
 
1137
1137
  class PipelineExecutions extends HeyApiClient {
1138
1138
  listPipelineExecutions(options) {
1139
- return (options.client ?? this.client).get({ url: "/api/linear-pipeline-executions", ...options });
1139
+ return (options.client ?? this.client).get({ url: "/api/pipeline-executions", ...options });
1140
1140
  }
1141
1141
  createPipelineExecution(options) {
1142
1142
  return (options.client ?? this.client).post({
1143
- url: "/api/linear-pipeline-executions",
1143
+ url: "/api/pipeline-executions",
1144
1144
  ...options,
1145
1145
  headers: {
1146
1146
  "Content-Type": "application/json",
@@ -1149,17 +1149,17 @@ class PipelineExecutions extends HeyApiClient {
1149
1149
  });
1150
1150
  }
1151
1151
  startPipelineExecution(options) {
1152
- return (options.client ?? this.client).put({ url: "/api/linear-pipeline-executions/{linearPipelineExecutionId}/start", ...options });
1152
+ return (options.client ?? this.client).put({ url: "/api/pipeline-executions/{pipelineExecutionId}/start", ...options });
1153
1153
  }
1154
1154
  queueFirstPipelineStepRun(options) {
1155
- return (options.client ?? this.client).post({ url: "/api/linear-pipeline-executions/{linearPipelineExecutionId}/step-runs/first", ...options });
1155
+ return (options.client ?? this.client).post({ url: "/api/pipeline-executions/{pipelineExecutionId}/step-runs/first", ...options });
1156
1156
  }
1157
1157
  markPipelineStepRunRunning(options) {
1158
- return (options.client ?? this.client).put({ url: "/api/linear-pipeline-executions/{linearPipelineExecutionId}/step-runs/{linearPipelineStepRunId}/running", ...options });
1158
+ return (options.client ?? this.client).put({ url: "/api/pipeline-executions/{pipelineExecutionId}/step-runs/{pipelineStepRunId}/running", ...options });
1159
1159
  }
1160
1160
  applyPipelineStepResult(options) {
1161
1161
  return (options.client ?? this.client).post({
1162
- url: "/api/linear-pipeline-executions/{linearPipelineExecutionId}/step-runs/{linearPipelineStepRunId}/results",
1162
+ url: "/api/pipeline-executions/{pipelineExecutionId}/step-runs/{pipelineStepRunId}/results",
1163
1163
  ...options,
1164
1164
  headers: {
1165
1165
  "Content-Type": "application/json",
@@ -1169,7 +1169,17 @@ class PipelineExecutions extends HeyApiClient {
1169
1169
  }
1170
1170
  acceptPipelineStepRun(options) {
1171
1171
  return (options.client ?? this.client).post({
1172
- url: "/api/linear-pipeline-executions/{linearPipelineExecutionId}/step-runs/{linearPipelineStepRunId}/accept",
1172
+ url: "/api/pipeline-executions/{pipelineExecutionId}/step-runs/{pipelineStepRunId}/accept",
1173
+ ...options,
1174
+ headers: {
1175
+ "Content-Type": "application/json",
1176
+ ...options.headers
1177
+ }
1178
+ });
1179
+ }
1180
+ acceptPipelineCohort(options) {
1181
+ return (options.client ?? this.client).post({
1182
+ url: "/api/pipeline-executions/{pipelineExecutionId}/cohorts/{originNodeDefinitionId}/accept",
1173
1183
  ...options,
1174
1184
  headers: {
1175
1185
  "Content-Type": "application/json",
@@ -1179,7 +1189,7 @@ class PipelineExecutions extends HeyApiClient {
1179
1189
  }
1180
1190
  rerunPipelineExecution(options) {
1181
1191
  return (options.client ?? this.client).post({
1182
- url: "/api/linear-pipeline-executions/{linearPipelineExecutionId}/rerun",
1192
+ url: "/api/pipeline-executions/{pipelineExecutionId}/rerun",
1183
1193
  ...options,
1184
1194
  headers: {
1185
1195
  "Content-Type": "application/json",
@@ -1188,19 +1198,32 @@ class PipelineExecutions extends HeyApiClient {
1188
1198
  });
1189
1199
  }
1190
1200
  cancelPipelineExecution(options) {
1191
- return (options.client ?? this.client).put({ url: "/api/linear-pipeline-executions/{linearPipelineExecutionId}/cancel", ...options });
1201
+ return (options.client ?? this.client).put({ url: "/api/pipeline-executions/{pipelineExecutionId}/cancel", ...options });
1202
+ }
1203
+ cancelPipelineExecutions(options) {
1204
+ return (options.client ?? this.client).put({
1205
+ url: "/api/pipeline-executions/batch/cancel",
1206
+ ...options,
1207
+ headers: {
1208
+ "Content-Type": "application/json",
1209
+ ...options.headers
1210
+ }
1211
+ });
1192
1212
  }
1193
1213
  getPipelineExecution(options) {
1194
- return (options.client ?? this.client).get({ url: "/api/linear-pipeline-executions/{linearPipelineExecutionId}", ...options });
1214
+ return (options.client ?? this.client).get({ url: "/api/pipeline-executions/{pipelineExecutionId}", ...options });
1215
+ }
1216
+ getPipelineExecutionRoutedChain(options) {
1217
+ return (options.client ?? this.client).get({ url: "/api/pipeline-executions/{pipelineExecutionId}/routed-chain", ...options });
1195
1218
  }
1196
1219
  countPipelineExecutionsByPipeline(options) {
1197
- return (options.client ?? this.client).get({ url: "/api/linear-pipeline-executions/counts/by-pipeline", ...options });
1220
+ return (options.client ?? this.client).get({ url: "/api/pipeline-executions/counts/by-pipeline", ...options });
1198
1221
  }
1199
1222
  listPipelineDefinitionStepRollups(options) {
1200
- return (options.client ?? this.client).get({ url: "/api/linear-pipeline-executions/step-rollups/by-definition/{linearPipelineDefinitionId}", ...options });
1223
+ return (options.client ?? this.client).get({ url: "/api/pipeline-executions/step-rollups/by-definition/{pipelineDefinitionId}", ...options });
1201
1224
  }
1202
1225
  listPipelineDefinitionStepRuns(options) {
1203
- return (options.client ?? this.client).get({ url: "/api/linear-pipeline-executions/step-runs/by-definition/{linearPipelineDefinitionId}", ...options });
1226
+ return (options.client ?? this.client).get({ url: "/api/pipeline-executions/step-runs/by-definition/{pipelineDefinitionId}", ...options });
1204
1227
  }
1205
1228
  }
1206
1229
 
@@ -1211,6 +1234,19 @@ class WorkItems extends HeyApiClient {
1211
1234
  getWorkItem(options) {
1212
1235
  return (options.client ?? this.client).get({ url: "/api/work-items/{workItemId}", ...options });
1213
1236
  }
1237
+ editWorkItem(options) {
1238
+ return (options.client ?? this.client).patch({
1239
+ url: "/api/work-items/{workItemId}",
1240
+ ...options,
1241
+ headers: {
1242
+ "Content-Type": "application/json",
1243
+ ...options.headers
1244
+ }
1245
+ });
1246
+ }
1247
+ listWorkItemChildren(options) {
1248
+ return (options.client ?? this.client).get({ url: "/api/work-items/{workItemId}/children", ...options });
1249
+ }
1214
1250
  createWorkItem(options) {
1215
1251
  return (options.client ?? this.client).post({
1216
1252
  url: "/api/work-items",
@@ -1261,6 +1297,16 @@ class WorkItems extends HeyApiClient {
1261
1297
  }
1262
1298
  });
1263
1299
  }
1300
+ setWorkItemParent(options) {
1301
+ return (options.client ?? this.client).patch({
1302
+ url: "/api/work-items/{workItemId}/parent",
1303
+ ...options,
1304
+ headers: {
1305
+ "Content-Type": "application/json",
1306
+ ...options.headers
1307
+ }
1308
+ });
1309
+ }
1264
1310
  }
1265
1311
 
1266
1312
  class WorkItemComments extends HeyApiClient {
@@ -1302,6 +1348,25 @@ class WorkItemComments extends HeyApiClient {
1302
1348
  }
1303
1349
  }
1304
1350
 
1351
+ class WorkItemBlocks extends HeyApiClient {
1352
+ listWorkItemBlocks(options) {
1353
+ return (options.client ?? this.client).get({ url: "/api/work-item-blocks", ...options });
1354
+ }
1355
+ createWorkItemBlock(options) {
1356
+ return (options.client ?? this.client).post({
1357
+ url: "/api/work-item-blocks",
1358
+ ...options,
1359
+ headers: {
1360
+ "Content-Type": "application/json",
1361
+ ...options.headers
1362
+ }
1363
+ });
1364
+ }
1365
+ deleteWorkItemBlock(options) {
1366
+ return (options.client ?? this.client).delete({ url: "/api/work-item-blocks/{blockId}", ...options });
1367
+ }
1368
+ }
1369
+
1305
1370
  class ProjectContext extends HeyApiClient {
1306
1371
  listProjectContextEntries(options) {
1307
1372
  return (options.client ?? this.client).get({ url: "/api/projects/{projectId}/context-entries", ...options });
@@ -1510,6 +1575,10 @@ class BoboddyClient extends HeyApiClient {
1510
1575
  get workItemComments() {
1511
1576
  return this._workItemComments ??= new WorkItemComments({ client: this.client });
1512
1577
  }
1578
+ _workItemBlocks;
1579
+ get workItemBlocks() {
1580
+ return this._workItemBlocks ??= new WorkItemBlocks({ client: this.client });
1581
+ }
1513
1582
  _projectContext;
1514
1583
  get projectContext() {
1515
1584
  return this._projectContext ??= new ProjectContext({ client: this.client });
@@ -1670,6 +1739,7 @@ export {
1670
1739
  createBoboddyClient,
1671
1740
  WorkItems,
1672
1741
  WorkItemComments,
1742
+ WorkItemBlocks,
1673
1743
  Username,
1674
1744
  UserNotifications,
1675
1745
  StepExecutions,
@@ -0,0 +1,117 @@
1
+ /** Restricted outcome domain for both `advanceEach` and `advanceAll`. */
2
+ export declare const cohortAdvancementEventTypeValues: readonly ["continue", "block"];
3
+ export type CohortAdvancementEventType = (typeof cohortAdvancementEventTypeValues)[number];
4
+ export type StepSignalsListConditionOperator = "equal" | "notEqual" | "lessThan" | "lessThanInclusive" | "greaterThan" | "greaterThanInclusive" | "in" | "notIn" | "contains" | "doesNotContain";
5
+ export type StepSignalsListTransformOp = {
6
+ op: "pluck";
7
+ signalKey: string;
8
+ } | {
9
+ op: "filter";
10
+ operator: StepSignalsListConditionOperator;
11
+ value: unknown;
12
+ } | {
13
+ op: "sortBy";
14
+ direction: "asc" | "desc";
15
+ } | {
16
+ op: "unique";
17
+ };
18
+ export type StepSignalsListReducerOp = {
19
+ op: "count";
20
+ } | {
21
+ op: "sum";
22
+ } | {
23
+ op: "avg";
24
+ } | {
25
+ op: "min";
26
+ } | {
27
+ op: "max";
28
+ } | {
29
+ op: "booleanAll";
30
+ } | {
31
+ op: "booleanAny";
32
+ } | {
33
+ op: "join";
34
+ separator: string;
35
+ } | {
36
+ op: "first";
37
+ } | {
38
+ op: "last";
39
+ };
40
+ /** Wire-format `ctx.stepSignalsList`-derived value, hoisted onto the `cohortGate` node. */
41
+ export type SerializedStepSignalsListDefinition = {
42
+ key: string;
43
+ ops: StepSignalsListTransformOp[];
44
+ reducer: StepSignalsListReducerOp;
45
+ };
46
+ /**
47
+ * An inline `ctx.stepSignalsList`-derived token, embedded in a rule's
48
+ * condition tree at the position a signal key would normally go. At
49
+ * serialize time, hoisted into the `cohortGate` node's
50
+ * `stepSignalsListDefinitions` and replaced by its bare `key` — the same
51
+ * "author inline, hoist, replace with bare key" discipline
52
+ * `extractInlineComputedSignals` already runs for `Computed.*`.
53
+ */
54
+ export type InlineStepSignalsListValue<TKey extends string = string> = {
55
+ readonly _tag: "step_signals_list";
56
+ readonly key: TKey;
57
+ readonly ops: StepSignalsListTransformOp[];
58
+ readonly reducer: StepSignalsListReducerOp;
59
+ };
60
+ /**
61
+ * A leaf condition, restricted to the cohort's own fact vocabulary: a bare
62
+ * fact name (`branchOutcomes.total()`/`.count(outcome)`, or a
63
+ * `ctx.stepSignalsList`-derived key) or an inline `InlineStepSignalsListValue`
64
+ * token (hoisted at serialize time). `value` may itself be a dynamic
65
+ * fact-reference (`{ fact: "branchCount" }`) — the same
66
+ * json-rules-engine-native mechanism `branchOutcomes.every()` compiles to.
67
+ */
68
+ export type CohortSignalCondition = {
69
+ readonly _tag: "signal";
70
+ signal: string | InlineStepSignalsListValue;
71
+ operator: StepSignalsListConditionOperator;
72
+ value: unknown;
73
+ };
74
+ export type CohortAllCondition = {
75
+ readonly _tag: "all";
76
+ conditions: CohortRuleCondition[];
77
+ };
78
+ export type CohortAnyCondition = {
79
+ readonly _tag: "any";
80
+ conditions: CohortRuleCondition[];
81
+ };
82
+ export type CohortRuleCondition = CohortSignalCondition | CohortAllCondition | CohortAnyCondition;
83
+ export type CohortRule = {
84
+ readonly _tag: "rule";
85
+ mode: "all" | "any";
86
+ conditions: CohortRuleCondition[];
87
+ outcome: CohortAdvancementEventType;
88
+ outcomeJson?: Record<string, unknown> | null;
89
+ };
90
+ export type SerializedCohortRule = {
91
+ conditions: Record<string, unknown>;
92
+ event: {
93
+ type: CohortAdvancementEventType;
94
+ params?: Record<string, unknown>;
95
+ };
96
+ };
97
+ /** Serialized shape expected by core's `CohortAdvancementPolicyDefinition`. */
98
+ export type SerializedCohortAdvancementPolicy = {
99
+ rules: SerializedCohortRule[];
100
+ defaultEventType: CohortAdvancementEventType;
101
+ defaultEventParamsJson: Record<string, unknown> | null;
102
+ };
103
+ export type CohortAdvancementPolicy = {
104
+ default: CohortAdvancementEventType;
105
+ defaultParamsJson?: Record<string, unknown> | null;
106
+ rules?: CohortRule[];
107
+ };
108
+ /** Serializes an authored `CohortAdvancementPolicy` (`advanceEach`/`advanceAll`) to its wire shape. */
109
+ export declare function serializeCohortAdvancementPolicy(policy: CohortAdvancementPolicy | undefined): SerializedCohortAdvancementPolicy;
110
+ /**
111
+ * Walks a `CohortAdvancementPolicy`'s rules tree, extracts every inline
112
+ * `ctx.stepSignalsList`-derived token embedded in a `CohortSignalCondition
113
+ * .signal` position, dedupes by key, and returns the resulting
114
+ * `stepSignalsListDefinitions` — the `cohortGate` node's counterpart to
115
+ * `extractInlineComputedSignals`.
116
+ */
117
+ export declare function extractInlineStepSignalsListDefinitions(policy: CohortAdvancementPolicy | undefined): SerializedStepSignalsListDefinition[];
@@ -0,0 +1,126 @@
1
+ import { type CohortAdvancementEventType, type CohortRule, type CohortRuleCondition, type CohortSignalCondition, type StepSignalsListConditionOperator } from "./cohort-advancement-policy";
2
+ declare const LEAF_BRAND: unique symbol;
3
+ declare const GROUP_BRAND: unique symbol;
4
+ /**
5
+ * A leaf condition + outcome attacher for the cohort scope
6
+ * (`advanceEach`/`advanceAll`). Built by `signal(key).<op>(value)`,
7
+ * `stepSignalsList.pluck(...).<reducer>()`, or `branchOutcomes.total()`/
8
+ * `.count(...)` chained with a comparator. Nestable inside `all()`/`any()`,
9
+ * or terminable with `.then(outcome)` — restricted to `continue`/`block`
10
+ * (AC4: no `route`/`complete`, unlike a regular step's `RuleLeaf`).
11
+ */
12
+ export interface CohortRuleLeaf {
13
+ readonly [LEAF_BRAND]: CohortSignalCondition;
14
+ then(outcome: CohortAdvancementEventType, paramsJson?: Record<string, unknown>): CohortRule;
15
+ }
16
+ /** A grouped condition + outcome attacher. Built by `all(...)` or `any(...)`. */
17
+ export interface CohortRuleGroup {
18
+ readonly [GROUP_BRAND]: {
19
+ mode: "all" | "any";
20
+ conditions: CohortRuleCondition[];
21
+ };
22
+ then(outcome: CohortAdvancementEventType, paramsJson?: Record<string, unknown>): CohortRule;
23
+ }
24
+ type CohortNestable = CohortRuleLeaf | CohortRuleGroup;
25
+ /**
26
+ * A comparator-bound reference into the cohort scope's facts — a branch's
27
+ * own signal (`advanceEach`), a `branchOutcomes.total()`/`.count(outcome)`
28
+ * aggregate, or a `stepSignalsList` reducer's result (`advanceAll`).
29
+ * Calling any comparator produces a `CohortRuleLeaf`.
30
+ */
31
+ export interface CohortSignalRef<TValue = unknown> {
32
+ eq(value: TValue): CohortRuleLeaf;
33
+ ne(value: TValue): CohortRuleLeaf;
34
+ gt(value: number): CohortRuleLeaf;
35
+ gte(value: number): CohortRuleLeaf;
36
+ lt(value: number): CohortRuleLeaf;
37
+ lte(value: number): CohortRuleLeaf;
38
+ in(values: ReadonlyArray<TValue>): CohortRuleLeaf;
39
+ notIn(values: ReadonlyArray<TValue>): CohortRuleLeaf;
40
+ contains(value: unknown): CohortRuleLeaf;
41
+ doesNotContain(value: unknown): CohortRuleLeaf;
42
+ }
43
+ type SignalValue<TSignalKeys extends string, TSignalTypeMap extends Partial<Record<string, unknown>>, K extends TSignalKeys> = K extends keyof TSignalTypeMap ? TSignalTypeMap[K] : unknown;
44
+ /**
45
+ * `advanceEach`'s callback context: one fan-out branch's own step result,
46
+ * evaluated the same way a regular step's `.advance()` evaluates its own
47
+ * signals (`evaluateBranchAgainstPolicy` — the same shared rules-engine
48
+ * pass, just restricted to `continue`/`block`). No `route`/`complete`, and
49
+ * — unlike `.advance()`'s `AdvanceCtx` — no `avg`/`sum`/`min`/`max`/`count`/
50
+ * `booleanAny`/`booleanAll` computed-signal factories: core's `fanOut` node
51
+ * config has no `computedSignalDefinitions` field to hoist them onto and
52
+ * `evaluateBranchAgainstPolicy` never resolves them, so exposing them here
53
+ * would silently produce dead wire fields. A later ticket can add that
54
+ * support to core first, then extend this ctx to match.
55
+ */
56
+ export interface AdvanceEachCtx<TSignalKeys extends string = string, TSignalTypeMap extends Partial<Record<string, unknown>> = Record<string, unknown>> {
57
+ signal<K extends TSignalKeys>(key: K): CohortSignalRef<SignalValue<TSignalKeys, TSignalTypeMap, K>>;
58
+ stepSignals: {
59
+ [K in TSignalKeys]: CohortSignalRef<SignalValue<TSignalKeys, TSignalTypeMap, K>>;
60
+ };
61
+ all(...refs: CohortNestable[]): CohortRuleGroup;
62
+ any(...refs: CohortNestable[]): CohortRuleGroup;
63
+ }
64
+ export interface AdvanceEachResult {
65
+ default: CohortAdvancementEventType;
66
+ rules?: CohortRule[];
67
+ }
68
+ export declare function makeAdvanceEachCtx<TSignalKeys extends string, TSignalTypeMap extends Partial<Record<string, unknown>> = Record<string, unknown>>(): AdvanceEachCtx<TSignalKeys, TSignalTypeMap>;
69
+ /** The 4-value branch outcome classification (mirrors core's `branchOutcomeValues`). */
70
+ export declare const branchOutcomeValues: readonly ["continue", "block", "error", "abandoned"];
71
+ export type BranchOutcome = (typeof branchOutcomeValues)[number];
72
+ /**
73
+ * A `ctx.stepSignalsList`-derived op-list builder: seeded by `.pluck(key)`,
74
+ * optionally narrowed/reshaped by `.filter()`/`.sortBy()`/`.unique()`, then
75
+ * finalized by exactly one reducer into a comparator-bound
76
+ * `CohortSignalRef` — the same "author fluently, hoist to a serializable
77
+ * definition" shape `Computed.*` uses, but resolved server-side against a
78
+ * cohort's real per-branch signals (`resolveStepSignalsListValue`) rather
79
+ * than a single step's own signals.
80
+ */
81
+ export interface StepSignalsListValueRef {
82
+ filter(operator: StepSignalsListConditionOperator, value: unknown): StepSignalsListValueRef;
83
+ sortBy(direction?: "asc" | "desc"): StepSignalsListValueRef;
84
+ unique(): StepSignalsListValueRef;
85
+ count(): CohortSignalRef;
86
+ sum(): CohortSignalRef;
87
+ avg(): CohortSignalRef;
88
+ min(): CohortSignalRef;
89
+ max(): CohortSignalRef;
90
+ booleanAll(): CohortSignalRef;
91
+ booleanAny(): CohortSignalRef;
92
+ join(separator?: string): CohortSignalRef;
93
+ first(): CohortSignalRef;
94
+ last(): CohortSignalRef;
95
+ }
96
+ /**
97
+ * `advanceAll`'s callback context: the whole cohort's aggregate branch
98
+ * outcomes (`branchOutcomes`) and any per-branch signal aggregation
99
+ * (`stepSignalsList`) — evaluated exactly once per cohort
100
+ * (`evaluateCohortAgainstPolicy`). Restricted to `continue`/`block`, no
101
+ * `stepSignals`/`route` (this is a whole-cohort decision, not one step's
102
+ * own).
103
+ */
104
+ export interface AdvanceAllCtx {
105
+ branchOutcomes: {
106
+ /** The cohort's total branch count. Compiles to fact `branchCount`. */
107
+ total(): CohortSignalRef<number>;
108
+ /** A single outcome's count across the cohort. Compiles to fact `${outcome}Count`. */
109
+ count(outcome: BranchOutcome): CohortSignalRef<number>;
110
+ /** True iff every branch resolved to this outcome. */
111
+ every(outcome: BranchOutcome): CohortRuleLeaf;
112
+ /** True iff at least one branch resolved to this outcome. */
113
+ some(outcome: BranchOutcome): CohortRuleLeaf;
114
+ };
115
+ stepSignalsList: {
116
+ pluck(signalKey: string): StepSignalsListValueRef;
117
+ };
118
+ all(...refs: CohortNestable[]): CohortRuleGroup;
119
+ any(...refs: CohortNestable[]): CohortRuleGroup;
120
+ }
121
+ export interface AdvanceAllResult {
122
+ default: CohortAdvancementEventType;
123
+ rules?: CohortRule[];
124
+ }
125
+ export declare function makeAdvanceAllCtx(): AdvanceAllCtx;
126
+ export {};
@@ -1,2 +1,4 @@
1
1
  export * from "./define-advancement-policy";
2
2
  export * from "./fluent-rules";
3
+ export * from "./cohort-advancement-policy";
4
+ export * from "./cohort-fluent-rules";