@dudousxd/nestjs-durable-core 0.67.1 → 0.68.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/dist/index.cjs +159 -29
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +195 -11
- package/dist/index.d.ts +195 -11
- package/dist/index.js +153 -29
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1042,6 +1042,20 @@ interface StateStore {
|
|
|
1042
1042
|
* fall back to counting a {@link listRuns} result, which is correct but unbounded.
|
|
1043
1043
|
*/
|
|
1044
1044
|
runFacets?(query: RunFacetQuery): Promise<RunFacetRow[]>;
|
|
1045
|
+
/**
|
|
1046
|
+
* The distinct values of ONE filter axis over the runs matching `query`, with counts — what a
|
|
1047
|
+
* console's tenant/tag/attribute pickers list instead of asking an operator to type a value blind.
|
|
1048
|
+
*
|
|
1049
|
+
* Scoped by the SAME predicates the list is under (`query`), so the options narrow as the operator
|
|
1050
|
+
* narrows: picking a tenant leaves the tag picker offering only tags that tenant's runs actually
|
|
1051
|
+
* carry, and a picker never offers a value that would return an empty list.
|
|
1052
|
+
*
|
|
1053
|
+
* Bounded by {@link RunValueFacetOptions} — read its `scan` note before trusting a `tag` count.
|
|
1054
|
+
*
|
|
1055
|
+
* Optional: a store that omits it still works — the console falls back to free-text entry for these
|
|
1056
|
+
* filters, which is what it had before pickers existed.
|
|
1057
|
+
*/
|
|
1058
|
+
runValueFacets?(axis: RunValueAxis, query: RunFacetQuery, opts?: RunValueFacetOptions): Promise<RunValueFacetRow[]>;
|
|
1045
1059
|
listCheckpoints(runId: string): Promise<StepCheckpoint[]>;
|
|
1046
1060
|
/**
|
|
1047
1061
|
* The LATEST checkpoint for `runId` whose `name` equals `name` exactly (highest `seq` wins), or
|
|
@@ -1121,15 +1135,40 @@ type SearchAttributesSchema<A extends SearchAttributes = SearchAttributes> = Sta
|
|
|
1121
1135
|
* workflow declares via `@Workflow({ searchAttributes })`. Feed it straight into `WorkflowCtx<A>`:
|
|
1122
1136
|
* `WorkflowCtx<InferSearchAttributes<typeof mySchema>>`. */
|
|
1123
1137
|
type InferSearchAttributes<S extends StandardSchemaV1<unknown, SearchAttributes>> = StandardSchemaV1.InferOutput<S>;
|
|
1124
|
-
type AttributeOp = 'eq' | 'ne' | 'gt' | 'gte' | 'lt' | 'lte';
|
|
1125
|
-
/** One
|
|
1126
|
-
|
|
1138
|
+
type AttributeOp = 'eq' | 'ne' | 'gt' | 'gte' | 'lt' | 'lte' | 'in';
|
|
1139
|
+
/** One value a search attribute can hold, and so one operand a predicate compares against. */
|
|
1140
|
+
type AttributeValue = string | number | boolean;
|
|
1141
|
+
/**
|
|
1142
|
+
* One predicate over a run's {@link SearchAttributes}; a {@link RunQuery} ANDs them all.
|
|
1143
|
+
*
|
|
1144
|
+
* The scalar ops carry a single `value`. `in` carries a SET of values matched as OR, and it needs to
|
|
1145
|
+
* exist as its own op because ORing inside ONE predicate is the only way to express "tier is pro or
|
|
1146
|
+
* enterprise": two `eq` predicates on the same key are ANDed like every other pair, which no run can
|
|
1147
|
+
* satisfy. An empty `values` matches nothing, mirroring {@link RunQuery.statuses}.
|
|
1148
|
+
*/
|
|
1149
|
+
type AttributeFilter = {
|
|
1127
1150
|
key: string;
|
|
1128
|
-
op: AttributeOp
|
|
1129
|
-
value:
|
|
1130
|
-
|
|
1151
|
+
op: Exclude<AttributeOp, 'in'>;
|
|
1152
|
+
value: AttributeValue;
|
|
1153
|
+
values?: never;
|
|
1154
|
+
} | {
|
|
1155
|
+
key: string;
|
|
1156
|
+
op: 'in';
|
|
1157
|
+
values: AttributeValue[];
|
|
1158
|
+
value?: never;
|
|
1159
|
+
};
|
|
1160
|
+
/** The single-operand members of {@link AttributeFilter} — every op except the `in` set. */
|
|
1161
|
+
type ScalarAttributeFilter = Exclude<AttributeFilter, {
|
|
1162
|
+
op: 'in';
|
|
1163
|
+
}>;
|
|
1131
1164
|
interface RunQuery {
|
|
1132
1165
|
workflow?: string | undefined;
|
|
1166
|
+
/**
|
|
1167
|
+
* Match any of these workflows (`workflow IN (...)`). Same shape as {@link statuses}: ORed with
|
|
1168
|
+
* each other, ANDed with everything else, and further narrowed by a concurrent single `workflow`.
|
|
1169
|
+
* Empty array = matches nothing.
|
|
1170
|
+
*/
|
|
1171
|
+
workflows?: string[] | undefined;
|
|
1133
1172
|
status?: RunStatus | undefined;
|
|
1134
1173
|
/**
|
|
1135
1174
|
* Match any of these statuses (a `status IN (...)` filter). ORed together, and ANDed with the other
|
|
@@ -1141,6 +1180,13 @@ interface RunQuery {
|
|
|
1141
1180
|
statuses?: RunStatus[] | undefined;
|
|
1142
1181
|
/** Only runs carrying this tag (exact match against {@link WorkflowRun.tags}). */
|
|
1143
1182
|
tag?: string | undefined;
|
|
1183
|
+
/**
|
|
1184
|
+
* Only runs carrying ANY of these tags. A run's tags are already a set, so the useful multi-value
|
|
1185
|
+
* question is "in this set", not "has all of them" — an operator picking `etl` and `nightly` from a
|
|
1186
|
+
* facet list means the union, and asking for their intersection through this field would return
|
|
1187
|
+
* nothing for tags that never co-occur. ANDed with a concurrent single `tag`; empty = matches nothing.
|
|
1188
|
+
*/
|
|
1189
|
+
tags?: string[] | undefined;
|
|
1144
1190
|
/**
|
|
1145
1191
|
* Typed/range predicates over {@link WorkflowRun.searchAttributes}, ANDed together (e.g. `amount`
|
|
1146
1192
|
* >= 200 and `tier` = 'pro'). Applied in-process after the coarse filters, so pair with
|
|
@@ -1149,6 +1195,9 @@ interface RunQuery {
|
|
|
1149
1195
|
attributes?: AttributeFilter[] | undefined;
|
|
1150
1196
|
/** Restrict to runs in this namespace (exact match), ANDed with the other predicates. */
|
|
1151
1197
|
namespace?: string | undefined;
|
|
1198
|
+
/** Restrict to runs in ANY of these namespaces (`namespace IN (...)`), so a console can compare a
|
|
1199
|
+
* few tenants side by side. ANDed with a concurrent single `namespace`; empty = matches nothing. */
|
|
1200
|
+
namespaces?: string[] | undefined;
|
|
1152
1201
|
/**
|
|
1153
1202
|
* Restrict to runs whose workflow was declared by this package (exact match against
|
|
1154
1203
|
* {@link WorkflowRun.origin}), ANDed with the other predicates.
|
|
@@ -1160,6 +1209,13 @@ interface RunQuery {
|
|
|
1160
1209
|
* facet without having to hold every run in the browser to find them.
|
|
1161
1210
|
*/
|
|
1162
1211
|
origin?: string | null | undefined;
|
|
1212
|
+
/**
|
|
1213
|
+
* Restrict to runs from ANY of these origins. `null` is a member like any other — it selects the
|
|
1214
|
+
* unattributed bucket — so `['@acme/billing', null]` is "this package's runs plus the ones nothing
|
|
1215
|
+
* could attribute", which the single {@link origin} cannot express at all. ANDed with a concurrent
|
|
1216
|
+
* single `origin`; empty = matches nothing.
|
|
1217
|
+
*/
|
|
1218
|
+
origins?: Array<string | null> | undefined;
|
|
1163
1219
|
limit?: number | undefined;
|
|
1164
1220
|
offset?: number | undefined;
|
|
1165
1221
|
}
|
|
@@ -1181,6 +1237,46 @@ interface RunFacetRow {
|
|
|
1181
1237
|
origin: string | null;
|
|
1182
1238
|
count: number;
|
|
1183
1239
|
}
|
|
1240
|
+
/**
|
|
1241
|
+
* Which axis {@link StateStore.runValueFacets} enumerates the distinct VALUES of. Every member is an
|
|
1242
|
+
* axis {@link RunQuery} can then filter by, which is the point: the answer to "what can I pick here"
|
|
1243
|
+
* has to be spendable as a predicate, or a console is offering choices that return nothing.
|
|
1244
|
+
*
|
|
1245
|
+
* `attributeKey` lists the search-attribute keys in use (the left-hand side of a predicate);
|
|
1246
|
+
* `attributeValue` lists the values recorded under ONE key (its right-hand side).
|
|
1247
|
+
*/
|
|
1248
|
+
type RunValueAxis = {
|
|
1249
|
+
field: 'workflow' | 'status' | 'origin' | 'namespace' | 'tag' | 'attributeKey';
|
|
1250
|
+
} | {
|
|
1251
|
+
field: 'attributeValue';
|
|
1252
|
+
key: string;
|
|
1253
|
+
};
|
|
1254
|
+
/**
|
|
1255
|
+
* One distinct value of a {@link RunValueAxis} and how many of the matching runs carry it — the rows
|
|
1256
|
+
* behind a console's value picker. `value` is `null` only where the axis itself has an absent bucket
|
|
1257
|
+
* (a run with no `origin`); a count is never zero, since a value with no runs produces no row.
|
|
1258
|
+
*/
|
|
1259
|
+
interface RunValueFacetRow {
|
|
1260
|
+
value: string | null;
|
|
1261
|
+
count: number;
|
|
1262
|
+
}
|
|
1263
|
+
/**
|
|
1264
|
+
* How much of the store {@link StateStore.runValueFacets} may read to answer.
|
|
1265
|
+
*
|
|
1266
|
+
* `limit` bounds the ROWS RETURNED (highest count first): tag and attribute-value cardinality is
|
|
1267
|
+
* unbounded in principle — a run tagged `singleton:<key>` mints a new tag per key — so a picker asks
|
|
1268
|
+
* for the top slice rather than the whole domain, and keeps free text for everything else.
|
|
1269
|
+
*
|
|
1270
|
+
* `scan` bounds the RUNS READ, and applies to the axes whose values are not a column of the run row
|
|
1271
|
+
* being counted — `tag` (inside a JSON array column) and the two attribute axes (a side table). Those
|
|
1272
|
+
* report counts over the newest `scan` matching runs rather than over all of them: a bounded,
|
|
1273
|
+
* deliberately approximate answer, where the alternative is a full scan on every keystroke. The
|
|
1274
|
+
* column axes (`workflow`, `status`, `origin`, `namespace`) are exact and ignore `scan`.
|
|
1275
|
+
*/
|
|
1276
|
+
interface RunValueFacetOptions {
|
|
1277
|
+
limit?: number | undefined;
|
|
1278
|
+
scan?: number | undefined;
|
|
1279
|
+
}
|
|
1184
1280
|
/** The transaction handle `StateStore.transaction` hands to its work callback. */
|
|
1185
1281
|
interface StoreTransaction {
|
|
1186
1282
|
/** The store-native transaction handle (TypeORM `EntityManager`, Prisma tx client, MikroORM `EntityManager`,
|
|
@@ -1247,6 +1343,11 @@ type RunRequestKind = {
|
|
|
1247
1343
|
} | {
|
|
1248
1344
|
kind: 'runFacets';
|
|
1249
1345
|
query: RunFacetQuery;
|
|
1346
|
+
} | {
|
|
1347
|
+
kind: 'runValueFacets';
|
|
1348
|
+
axis: RunValueAxis;
|
|
1349
|
+
query: RunFacetQuery;
|
|
1350
|
+
opts?: RunValueFacetOptions | undefined;
|
|
1250
1351
|
} | {
|
|
1251
1352
|
kind: 'workerHealth';
|
|
1252
1353
|
} | {
|
|
@@ -4396,6 +4497,46 @@ declare function mergeRunFacetRows(rows: readonly {
|
|
|
4396
4497
|
count: number;
|
|
4397
4498
|
}[]): RunFacetRow[];
|
|
4398
4499
|
|
|
4500
|
+
/** Rows a value picker gets when the caller names no bound — enough to fill a dropdown several times
|
|
4501
|
+
* over, small enough that an axis with unbounded cardinality (tags) can't return a listing. */
|
|
4502
|
+
declare const RUN_VALUE_FACET_LIMIT = 100;
|
|
4503
|
+
/** Runs read when an axis has to be counted in-process (see {@link RunValueFacetOptions.scan}). */
|
|
4504
|
+
declare const RUN_VALUE_FACET_SCAN = 5000;
|
|
4505
|
+
/**
|
|
4506
|
+
* Is this axis a plain column on the runs table, and so countable with a `GROUP BY` over the whole
|
|
4507
|
+
* matching set?
|
|
4508
|
+
*
|
|
4509
|
+
* The other three are not, in the same way for the same reason — the value isn't in a column of the
|
|
4510
|
+
* row being counted. A run's tags live inside ONE json array column that no `GROUP BY` portable
|
|
4511
|
+
* across sqlite/MySQL/Postgres reaches into, and its search attributes live in a side table whose
|
|
4512
|
+
* join back to the filtered run set differs per adapter. Those axes are counted in-process over a
|
|
4513
|
+
* bounded scan instead ({@link runValueFacetsFromRuns}), so their counts describe that window rather
|
|
4514
|
+
* than the whole store — which is why {@link RunValueFacetOptions.scan} exists.
|
|
4515
|
+
*/
|
|
4516
|
+
declare function axisIsRunColumn(axis: RunValueAxis): axis is {
|
|
4517
|
+
field: 'workflow' | 'status' | 'origin' | 'namespace';
|
|
4518
|
+
};
|
|
4519
|
+
/**
|
|
4520
|
+
* Fold, order and bound raw `(value, count)` rows into the answer callers see: highest count first,
|
|
4521
|
+
* ties broken alphabetically so a picker's order is stable between polls, the unattributed bucket
|
|
4522
|
+
* (`null`) last, and no more than `limit` rows.
|
|
4523
|
+
*
|
|
4524
|
+
* Every store pipes its `GROUP BY` through this — the same role {@link mergeRunFacetRows} plays for
|
|
4525
|
+
* status/origin counts — so a picker lists the same values in the same order whichever adapter is
|
|
4526
|
+
* underneath, rather than each SQL dialect's default ordering leaking into the UI.
|
|
4527
|
+
*/
|
|
4528
|
+
declare function mergeRunValueFacetRows(rows: readonly {
|
|
4529
|
+
value: string | null | undefined;
|
|
4530
|
+
count: number;
|
|
4531
|
+
}[], opts?: RunValueFacetOptions): RunValueFacetRow[];
|
|
4532
|
+
/**
|
|
4533
|
+
* Count an axis's distinct values across runs already narrowed by the caller's predicates — the
|
|
4534
|
+
* in-process path, used by the in-memory store for every axis and by the SQL stores for `tag` (see
|
|
4535
|
+
* {@link axisIsGroupable}). `runs` must be ordered newest-first and already bounded to
|
|
4536
|
+
* {@link RunValueFacetOptions.scan}, since that window is what the counts then describe.
|
|
4537
|
+
*/
|
|
4538
|
+
declare function runValueFacetsFromRuns(runs: readonly WorkflowRun[], axis: RunValueAxis, opts?: RunValueFacetOptions): RunValueFacetRow[];
|
|
4539
|
+
|
|
4399
4540
|
/** A run as returned by the gateway's list — the durable run plus an optional {@link RunWaiting}
|
|
4400
4541
|
* descriptor the control plane resolves (what a suspended run is parked on), so the dashboard can
|
|
4401
4542
|
* name the wait in a list row without fetching each run's timeline. Additive: `waiting` is absent
|
|
@@ -4459,6 +4600,16 @@ declare abstract class RunGateway {
|
|
|
4459
4600
|
* page bounds what is rendered, these counts stay whole-set exact. Zero-count cells are absent.
|
|
4460
4601
|
*/
|
|
4461
4602
|
abstract runFacets(query: RunFacetQuery): Promise<RunFacetRow[]>;
|
|
4603
|
+
/**
|
|
4604
|
+
* The distinct values of one filter axis over the runs matching `query`, with counts — what fills a
|
|
4605
|
+
* console's tenant/tag/attribute pickers. On the port (not control-plane-only) because the pickers
|
|
4606
|
+
* belong to the same panel as {@link listRuns}: a tenant that can list its runs has to be able to
|
|
4607
|
+
* see what it may filter them by, or its console offers a blank dropdown.
|
|
4608
|
+
*
|
|
4609
|
+
* Returns `[]` when the underlying store does not implement the enumeration — an empty picker with
|
|
4610
|
+
* free-text entry still standing, not an error.
|
|
4611
|
+
*/
|
|
4612
|
+
abstract runValueFacets(axis: RunValueAxis, query: RunFacetQuery, opts?: RunValueFacetOptions): Promise<RunValueFacetRow[]>;
|
|
4462
4613
|
/**
|
|
4463
4614
|
* Bulk-resolve {@link RunWaiting} for an arbitrary set of run ids — for a consumer with its OWN
|
|
4464
4615
|
* filtered/paginated run listing (so it isn't just `listRuns` under another name) that needs to know
|
|
@@ -4544,6 +4695,12 @@ declare class CodecStateStore implements StateStore {
|
|
|
4544
4695
|
* of resolving to a silently wrong empty result.
|
|
4545
4696
|
*/
|
|
4546
4697
|
readonly runFacets?: (query: RunFacetQuery) => Promise<RunFacetRow[]>;
|
|
4698
|
+
/**
|
|
4699
|
+
* Forwarded verbatim, and safe to: the axes a value facet enumerates are searchable metadata
|
|
4700
|
+
* (workflow, status, origin, namespace, tags, search attributes), none of which the codec encodes.
|
|
4701
|
+
* Bound the same conditional way as {@link runFacets} so absence is reported, not faked.
|
|
4702
|
+
*/
|
|
4703
|
+
readonly runValueFacets?: (axis: RunValueAxis, query: RunFacetQuery, opts?: RunValueFacetOptions) => Promise<RunValueFacetRow[]>;
|
|
4547
4704
|
constructor(inner: StateStore, codec: PayloadCodec);
|
|
4548
4705
|
private enc;
|
|
4549
4706
|
private dec;
|
|
@@ -4772,16 +4929,39 @@ interface RunAttributeRow {
|
|
|
4772
4929
|
* in-process `compare` treats `eq`/`ne` on booleans). Returns `[]` for a run with no attributes.
|
|
4773
4930
|
*/
|
|
4774
4931
|
declare function normalizeAttributeRows(runId: string, attributes: SearchAttributes | undefined): RunAttributeRow[];
|
|
4775
|
-
/**
|
|
4776
|
-
|
|
4932
|
+
/**
|
|
4933
|
+
* SQL comparison operator for a single-operand {@link AttributeOp} (used to build pushdown
|
|
4934
|
+
* predicates). `in` is absent by construction: it compares against a SET, which a store emits as an
|
|
4935
|
+
* OR of equalities over {@link attributePredicateOperands} rather than as one comparator.
|
|
4936
|
+
*/
|
|
4937
|
+
declare function sqlComparator(op: Exclude<AttributeOp, 'in'>): string;
|
|
4777
4938
|
/**
|
|
4778
4939
|
* Which side-table column an attribute filter compares against: numeric operands (and range ops on
|
|
4779
4940
|
* numbers) hit `numValue`; everything else hits `strValue` (booleans are stored as `"true"`/`"false"`).
|
|
4780
4941
|
* Keeping this in core means every SQL adapter pushes predicates down identically.
|
|
4781
4942
|
*/
|
|
4782
|
-
declare function attributeColumnFor(filter:
|
|
4943
|
+
declare function attributeColumnFor(filter: ScalarAttributeFilter): 'numValue' | 'strValue';
|
|
4783
4944
|
/** The literal a side-table predicate compares against (booleans → `"true"`/`"false"` strings). */
|
|
4784
|
-
declare function attributeOperand(filter:
|
|
4945
|
+
declare function attributeOperand(filter: ScalarAttributeFilter): string | number;
|
|
4946
|
+
/** One comparison a side-table predicate makes: which typed column, with which operator, against
|
|
4947
|
+
* which literal. */
|
|
4948
|
+
interface AttributePredicateOperand {
|
|
4949
|
+
column: 'numValue' | 'strValue';
|
|
4950
|
+
comparator: string;
|
|
4951
|
+
operand: string | number;
|
|
4952
|
+
}
|
|
4953
|
+
/**
|
|
4954
|
+
* The comparisons one {@link AttributeFilter} makes, for a store to OR together inside its
|
|
4955
|
+
* `EXISTS`/join on the normalized attribute side-table. A scalar op yields exactly ONE comparison
|
|
4956
|
+
* (the same column/operator/literal {@link attributeColumnFor} and {@link attributeOperand} give);
|
|
4957
|
+
* `in` yields one per member, each an equality, since its operands may be of mixed types and so land
|
|
4958
|
+
* in different typed columns.
|
|
4959
|
+
*
|
|
4960
|
+
* An EMPTY list is a real answer, not a missing one: `in` over no values can match no run. A caller
|
|
4961
|
+
* that ORs an empty list must emit a false predicate rather than dropping the filter, or the query
|
|
4962
|
+
* silently widens to every run.
|
|
4963
|
+
*/
|
|
4964
|
+
declare function attributePredicateOperands(filter: AttributeFilter): AttributePredicateOperand[];
|
|
4785
4965
|
|
|
4786
4966
|
/**
|
|
4787
4967
|
* Read a run's `searchAttributes` through a {@link SearchAttributesSchema}, typed to the schema's
|
|
@@ -5002,6 +5182,10 @@ declare class InMemoryStateStore implements StateStore {
|
|
|
5002
5182
|
private matching;
|
|
5003
5183
|
listRuns(query: RunQuery): Promise<WorkflowRun[]>;
|
|
5004
5184
|
runFacets(query: RunFacetQuery): Promise<RunFacetRow[]>;
|
|
5185
|
+
/** Counted over the newest `scan` matching runs for EVERY axis, not just `tag`: this store holds
|
|
5186
|
+
* its runs in a Map with no index to group by, so the bound that the SQL stores need only for tags
|
|
5187
|
+
* is the honest one to apply here throughout. */
|
|
5188
|
+
runValueFacets(axis: RunValueAxis, query: RunFacetQuery, opts?: RunValueFacetOptions): Promise<RunValueFacetRow[]>;
|
|
5005
5189
|
listCheckpoints(runId: string): Promise<StepCheckpoint[]>;
|
|
5006
5190
|
getLatestCheckpointByName(runId: string, name: string): Promise<StepCheckpoint | undefined>;
|
|
5007
5191
|
listCheckpointsByNamePrefix(runId: string, prefixes: string[]): Promise<StepCheckpoint[]>;
|
|
@@ -5033,4 +5217,4 @@ declare class InMemoryTransport implements Transport, ControlPlane {
|
|
|
5033
5217
|
onControl(handler: (msg: ControlMessage) => void): void;
|
|
5034
5218
|
}
|
|
5035
5219
|
|
|
5036
|
-
export { type AccumulatorHost, type Admission, type AdmissionBackend, type AdmissionItem, type AnnouncedWorkflow, type AnnouncementEvidence, type AttributeFilter, type AttributeOp, type BackoffStrategy, type BlockedDispatch, type BlockedResolution, CONTROL_FLOW_SIGNAL, CURRENT_PROTOCOL_VERSION, type CapabilityRequirement, type ChildCallOptions, CodecStateStore, ContinueAsNew, type ControlMessage, type ControlPlane, DEFAULT_PARTITION, DURABLE_OPTIONS, DURABLE_OPTIONS_CANONICAL, DURABLE_STEP_CONFIG, DURABLE_STEP_NAME, type Disagreement, type DispatchDiagnostics, type DispatchPlan, type DurableExecution, type DurableExecutionWrapper, type DurableTopology, type DurableWebhook, DurableWorkflow, EVENT_BUFFER_SCAN_LIMIT, EVENT_TOKEN_PREFIX, type EngineEvent, type EngineEventType, type EngineListener, Entities, type EntityConfig, type EntityHandler, type EntityHost, EventAccumulators, type EventBatchConfig, FatalError, GatherError, type GroupHealth, type Heartbeat, type HeartbeatSighting, type HeartbeatStatus, type HistoryEvent, InMemoryAdmissionBackend, InMemoryStateStore, InMemoryTransport, type InferSearchAttributes, LEGACY_V1_CAPABILITIES, LEGACY_V1_PROTOCOL, type MetricsCollector, type MetricsSnapshot, type NamedTransport, type NegotiateOptions, type NegotiationOutcome, type NegotiationReason, type NegotiationResult, NonDeterminismError, type PartitionSighting, type PayloadCodec, type QueueConfig, QueueController, type RawWorkerDescriptor, RemoteStepError, RemoteStepTimeout, type RemoteTask, RemoteWorkflowExecutor, RemoteWorkflowTimeout, type RetentionPolicy, type RoutableDispatch, type RoutableResolution, type RoutingResolution, type RunAttributeRow, type RunDetail, type RunDispatcher, type RunFacetQuery, type RunFacetRow, RunGateway, type RunListItem, type RunQuery, type RunReply, type RunReplyResult, type RunRequest, type RunRequestKind, type RunResult, type RunSchedulesOptions, type RunStatus, type RunWaiting, STATE_STORE, STATE_STORE_CANONICAL, type ScheduledWorkflow, type SearchAttributes, type SearchAttributesSchema, SignalTimeoutError, type SignalWaiter, type SingletonConfig, SingletonQueueFullError, StandardSchemaV1, type StartOptions, type StartRunMessage, type StateStore, type StepCheckpoint, type StepConfig, type StepDef, type StepDispatchOpts, type StepError, type StepEvent, type StepHandler, type StepInterceptor, type StepInvocation, type StepKind, type StepLogger, type StepOptions, type StepRef, type StepResult, type StepUndo, type StoreTransaction, type SubProcessHandle, TERMINAL_RUN_STATUSES, TRANSPORT, TRANSPORT_CANONICAL, type TenantEvent, type Transport, type UndoOf, type UpdateResult, type UpdateValidator, VERSION_UNDECLARED_TAG, WORKFLOW_NAME_KEY, type WireDates, type WorkerAdjust, type WorkerConcurrencyStatus, type WorkerDescriptor, type WorkerHeartbeat, type WorkerLifecycle, type WorkerStatus, type WorkflowAnnouncement, WorkflowBlocked, type WorkflowClass, type WorkflowCommand, type WorkflowCtx, type WorkflowDecision, type WorkflowDirectory, WorkflowEngine, type WorkflowEngineDeps, type WorkflowExecutor, type WorkflowHandler, type WorkflowInputOf, type WorkflowOutputOf, type WorkflowRef, type WorkflowRegistration, type WorkflowRun, type WorkflowStartClient, type WorkflowStepEvent, WorkflowSuspended, type WorkflowTask, aggregateAnnouncements, announcementsOf, applyAttributeQuery, attributeColumnFor, attributeOperand, bindWorkflowClass, breakpointToken, buildWorkflowDirectory, canRoute, capableWorkers, classifyWaiterToken, clearDurableExecutionWrappers, collectMetrics, controlPlaneDescriptor, coveredTokens, createStepLogger, currentStep, currentWorkflowCtx, debug, describeWorker, descriptorHash, error, eventMatchOf, eventMatches, eventNameOf, eventPrefix, eventToken, facetOrigin, hasDurableExecutionWrappers, heartbeatStatus, indexWaitersByRun, info, isEventToken, isLegacyDescriptor, isWorkflowControlFlowSignal, log, matchesAttributes, mergeRunFacetRows, missingCapabilities, negotiate, normalizeAttributeRows, normalizeDescriptor, observedAnnouncements, parseDuration, partitionOfToken, planDispatch, prevCronFireMs, readSearchAttributes, requiredCapabilities, resolveRouting, resolveRunWaiting, runDurableExecution, runInStepLogger, runInWorkflowCtx, runSchedules, runStepHandler, sanitizeQueueToken, scheduledRunId, sqlComparator, stepConfigOf, stepId, stepNameOf, sub, subEvent, subProcess, tenantGroup, useDurableExecution, warn, workflowName };
|
|
5220
|
+
export { type AccumulatorHost, type Admission, type AdmissionBackend, type AdmissionItem, type AnnouncedWorkflow, type AnnouncementEvidence, type AttributeFilter, type AttributeOp, type AttributePredicateOperand, type AttributeValue, type BackoffStrategy, type BlockedDispatch, type BlockedResolution, CONTROL_FLOW_SIGNAL, CURRENT_PROTOCOL_VERSION, type CapabilityRequirement, type ChildCallOptions, CodecStateStore, ContinueAsNew, type ControlMessage, type ControlPlane, DEFAULT_PARTITION, DURABLE_OPTIONS, DURABLE_OPTIONS_CANONICAL, DURABLE_STEP_CONFIG, DURABLE_STEP_NAME, type Disagreement, type DispatchDiagnostics, type DispatchPlan, type DurableExecution, type DurableExecutionWrapper, type DurableTopology, type DurableWebhook, DurableWorkflow, EVENT_BUFFER_SCAN_LIMIT, EVENT_TOKEN_PREFIX, type EngineEvent, type EngineEventType, type EngineListener, Entities, type EntityConfig, type EntityHandler, type EntityHost, EventAccumulators, type EventBatchConfig, FatalError, GatherError, type GroupHealth, type Heartbeat, type HeartbeatSighting, type HeartbeatStatus, type HistoryEvent, InMemoryAdmissionBackend, InMemoryStateStore, InMemoryTransport, type InferSearchAttributes, LEGACY_V1_CAPABILITIES, LEGACY_V1_PROTOCOL, type MetricsCollector, type MetricsSnapshot, type NamedTransport, type NegotiateOptions, type NegotiationOutcome, type NegotiationReason, type NegotiationResult, NonDeterminismError, type PartitionSighting, type PayloadCodec, type QueueConfig, QueueController, RUN_VALUE_FACET_LIMIT, RUN_VALUE_FACET_SCAN, type RawWorkerDescriptor, RemoteStepError, RemoteStepTimeout, type RemoteTask, RemoteWorkflowExecutor, RemoteWorkflowTimeout, type RetentionPolicy, type RoutableDispatch, type RoutableResolution, type RoutingResolution, type RunAttributeRow, type RunDetail, type RunDispatcher, type RunFacetQuery, type RunFacetRow, RunGateway, type RunListItem, type RunQuery, type RunReply, type RunReplyResult, type RunRequest, type RunRequestKind, type RunResult, type RunSchedulesOptions, type RunStatus, type RunValueAxis, type RunValueFacetOptions, type RunValueFacetRow, type RunWaiting, STATE_STORE, STATE_STORE_CANONICAL, type ScalarAttributeFilter, type ScheduledWorkflow, type SearchAttributes, type SearchAttributesSchema, SignalTimeoutError, type SignalWaiter, type SingletonConfig, SingletonQueueFullError, StandardSchemaV1, type StartOptions, type StartRunMessage, type StateStore, type StepCheckpoint, type StepConfig, type StepDef, type StepDispatchOpts, type StepError, type StepEvent, type StepHandler, type StepInterceptor, type StepInvocation, type StepKind, type StepLogger, type StepOptions, type StepRef, type StepResult, type StepUndo, type StoreTransaction, type SubProcessHandle, TERMINAL_RUN_STATUSES, TRANSPORT, TRANSPORT_CANONICAL, type TenantEvent, type Transport, type UndoOf, type UpdateResult, type UpdateValidator, VERSION_UNDECLARED_TAG, WORKFLOW_NAME_KEY, type WireDates, type WorkerAdjust, type WorkerConcurrencyStatus, type WorkerDescriptor, type WorkerHeartbeat, type WorkerLifecycle, type WorkerStatus, type WorkflowAnnouncement, WorkflowBlocked, type WorkflowClass, type WorkflowCommand, type WorkflowCtx, type WorkflowDecision, type WorkflowDirectory, WorkflowEngine, type WorkflowEngineDeps, type WorkflowExecutor, type WorkflowHandler, type WorkflowInputOf, type WorkflowOutputOf, type WorkflowRef, type WorkflowRegistration, type WorkflowRun, type WorkflowStartClient, type WorkflowStepEvent, WorkflowSuspended, type WorkflowTask, aggregateAnnouncements, announcementsOf, applyAttributeQuery, attributeColumnFor, attributeOperand, attributePredicateOperands, axisIsRunColumn, bindWorkflowClass, breakpointToken, buildWorkflowDirectory, canRoute, capableWorkers, classifyWaiterToken, clearDurableExecutionWrappers, collectMetrics, controlPlaneDescriptor, coveredTokens, createStepLogger, currentStep, currentWorkflowCtx, debug, describeWorker, descriptorHash, error, eventMatchOf, eventMatches, eventNameOf, eventPrefix, eventToken, facetOrigin, hasDurableExecutionWrappers, heartbeatStatus, indexWaitersByRun, info, isEventToken, isLegacyDescriptor, isWorkflowControlFlowSignal, log, matchesAttributes, mergeRunFacetRows, mergeRunValueFacetRows, missingCapabilities, negotiate, normalizeAttributeRows, normalizeDescriptor, observedAnnouncements, parseDuration, partitionOfToken, planDispatch, prevCronFireMs, readSearchAttributes, requiredCapabilities, resolveRouting, resolveRunWaiting, runDurableExecution, runInStepLogger, runInWorkflowCtx, runSchedules, runStepHandler, runValueFacetsFromRuns, sanitizeQueueToken, scheduledRunId, sqlComparator, stepConfigOf, stepId, stepNameOf, sub, subEvent, subProcess, tenantGroup, useDurableExecution, warn, workflowName };
|
package/dist/index.d.ts
CHANGED
|
@@ -1042,6 +1042,20 @@ interface StateStore {
|
|
|
1042
1042
|
* fall back to counting a {@link listRuns} result, which is correct but unbounded.
|
|
1043
1043
|
*/
|
|
1044
1044
|
runFacets?(query: RunFacetQuery): Promise<RunFacetRow[]>;
|
|
1045
|
+
/**
|
|
1046
|
+
* The distinct values of ONE filter axis over the runs matching `query`, with counts — what a
|
|
1047
|
+
* console's tenant/tag/attribute pickers list instead of asking an operator to type a value blind.
|
|
1048
|
+
*
|
|
1049
|
+
* Scoped by the SAME predicates the list is under (`query`), so the options narrow as the operator
|
|
1050
|
+
* narrows: picking a tenant leaves the tag picker offering only tags that tenant's runs actually
|
|
1051
|
+
* carry, and a picker never offers a value that would return an empty list.
|
|
1052
|
+
*
|
|
1053
|
+
* Bounded by {@link RunValueFacetOptions} — read its `scan` note before trusting a `tag` count.
|
|
1054
|
+
*
|
|
1055
|
+
* Optional: a store that omits it still works — the console falls back to free-text entry for these
|
|
1056
|
+
* filters, which is what it had before pickers existed.
|
|
1057
|
+
*/
|
|
1058
|
+
runValueFacets?(axis: RunValueAxis, query: RunFacetQuery, opts?: RunValueFacetOptions): Promise<RunValueFacetRow[]>;
|
|
1045
1059
|
listCheckpoints(runId: string): Promise<StepCheckpoint[]>;
|
|
1046
1060
|
/**
|
|
1047
1061
|
* The LATEST checkpoint for `runId` whose `name` equals `name` exactly (highest `seq` wins), or
|
|
@@ -1121,15 +1135,40 @@ type SearchAttributesSchema<A extends SearchAttributes = SearchAttributes> = Sta
|
|
|
1121
1135
|
* workflow declares via `@Workflow({ searchAttributes })`. Feed it straight into `WorkflowCtx<A>`:
|
|
1122
1136
|
* `WorkflowCtx<InferSearchAttributes<typeof mySchema>>`. */
|
|
1123
1137
|
type InferSearchAttributes<S extends StandardSchemaV1<unknown, SearchAttributes>> = StandardSchemaV1.InferOutput<S>;
|
|
1124
|
-
type AttributeOp = 'eq' | 'ne' | 'gt' | 'gte' | 'lt' | 'lte';
|
|
1125
|
-
/** One
|
|
1126
|
-
|
|
1138
|
+
type AttributeOp = 'eq' | 'ne' | 'gt' | 'gte' | 'lt' | 'lte' | 'in';
|
|
1139
|
+
/** One value a search attribute can hold, and so one operand a predicate compares against. */
|
|
1140
|
+
type AttributeValue = string | number | boolean;
|
|
1141
|
+
/**
|
|
1142
|
+
* One predicate over a run's {@link SearchAttributes}; a {@link RunQuery} ANDs them all.
|
|
1143
|
+
*
|
|
1144
|
+
* The scalar ops carry a single `value`. `in` carries a SET of values matched as OR, and it needs to
|
|
1145
|
+
* exist as its own op because ORing inside ONE predicate is the only way to express "tier is pro or
|
|
1146
|
+
* enterprise": two `eq` predicates on the same key are ANDed like every other pair, which no run can
|
|
1147
|
+
* satisfy. An empty `values` matches nothing, mirroring {@link RunQuery.statuses}.
|
|
1148
|
+
*/
|
|
1149
|
+
type AttributeFilter = {
|
|
1127
1150
|
key: string;
|
|
1128
|
-
op: AttributeOp
|
|
1129
|
-
value:
|
|
1130
|
-
|
|
1151
|
+
op: Exclude<AttributeOp, 'in'>;
|
|
1152
|
+
value: AttributeValue;
|
|
1153
|
+
values?: never;
|
|
1154
|
+
} | {
|
|
1155
|
+
key: string;
|
|
1156
|
+
op: 'in';
|
|
1157
|
+
values: AttributeValue[];
|
|
1158
|
+
value?: never;
|
|
1159
|
+
};
|
|
1160
|
+
/** The single-operand members of {@link AttributeFilter} — every op except the `in` set. */
|
|
1161
|
+
type ScalarAttributeFilter = Exclude<AttributeFilter, {
|
|
1162
|
+
op: 'in';
|
|
1163
|
+
}>;
|
|
1131
1164
|
interface RunQuery {
|
|
1132
1165
|
workflow?: string | undefined;
|
|
1166
|
+
/**
|
|
1167
|
+
* Match any of these workflows (`workflow IN (...)`). Same shape as {@link statuses}: ORed with
|
|
1168
|
+
* each other, ANDed with everything else, and further narrowed by a concurrent single `workflow`.
|
|
1169
|
+
* Empty array = matches nothing.
|
|
1170
|
+
*/
|
|
1171
|
+
workflows?: string[] | undefined;
|
|
1133
1172
|
status?: RunStatus | undefined;
|
|
1134
1173
|
/**
|
|
1135
1174
|
* Match any of these statuses (a `status IN (...)` filter). ORed together, and ANDed with the other
|
|
@@ -1141,6 +1180,13 @@ interface RunQuery {
|
|
|
1141
1180
|
statuses?: RunStatus[] | undefined;
|
|
1142
1181
|
/** Only runs carrying this tag (exact match against {@link WorkflowRun.tags}). */
|
|
1143
1182
|
tag?: string | undefined;
|
|
1183
|
+
/**
|
|
1184
|
+
* Only runs carrying ANY of these tags. A run's tags are already a set, so the useful multi-value
|
|
1185
|
+
* question is "in this set", not "has all of them" — an operator picking `etl` and `nightly` from a
|
|
1186
|
+
* facet list means the union, and asking for their intersection through this field would return
|
|
1187
|
+
* nothing for tags that never co-occur. ANDed with a concurrent single `tag`; empty = matches nothing.
|
|
1188
|
+
*/
|
|
1189
|
+
tags?: string[] | undefined;
|
|
1144
1190
|
/**
|
|
1145
1191
|
* Typed/range predicates over {@link WorkflowRun.searchAttributes}, ANDed together (e.g. `amount`
|
|
1146
1192
|
* >= 200 and `tier` = 'pro'). Applied in-process after the coarse filters, so pair with
|
|
@@ -1149,6 +1195,9 @@ interface RunQuery {
|
|
|
1149
1195
|
attributes?: AttributeFilter[] | undefined;
|
|
1150
1196
|
/** Restrict to runs in this namespace (exact match), ANDed with the other predicates. */
|
|
1151
1197
|
namespace?: string | undefined;
|
|
1198
|
+
/** Restrict to runs in ANY of these namespaces (`namespace IN (...)`), so a console can compare a
|
|
1199
|
+
* few tenants side by side. ANDed with a concurrent single `namespace`; empty = matches nothing. */
|
|
1200
|
+
namespaces?: string[] | undefined;
|
|
1152
1201
|
/**
|
|
1153
1202
|
* Restrict to runs whose workflow was declared by this package (exact match against
|
|
1154
1203
|
* {@link WorkflowRun.origin}), ANDed with the other predicates.
|
|
@@ -1160,6 +1209,13 @@ interface RunQuery {
|
|
|
1160
1209
|
* facet without having to hold every run in the browser to find them.
|
|
1161
1210
|
*/
|
|
1162
1211
|
origin?: string | null | undefined;
|
|
1212
|
+
/**
|
|
1213
|
+
* Restrict to runs from ANY of these origins. `null` is a member like any other — it selects the
|
|
1214
|
+
* unattributed bucket — so `['@acme/billing', null]` is "this package's runs plus the ones nothing
|
|
1215
|
+
* could attribute", which the single {@link origin} cannot express at all. ANDed with a concurrent
|
|
1216
|
+
* single `origin`; empty = matches nothing.
|
|
1217
|
+
*/
|
|
1218
|
+
origins?: Array<string | null> | undefined;
|
|
1163
1219
|
limit?: number | undefined;
|
|
1164
1220
|
offset?: number | undefined;
|
|
1165
1221
|
}
|
|
@@ -1181,6 +1237,46 @@ interface RunFacetRow {
|
|
|
1181
1237
|
origin: string | null;
|
|
1182
1238
|
count: number;
|
|
1183
1239
|
}
|
|
1240
|
+
/**
|
|
1241
|
+
* Which axis {@link StateStore.runValueFacets} enumerates the distinct VALUES of. Every member is an
|
|
1242
|
+
* axis {@link RunQuery} can then filter by, which is the point: the answer to "what can I pick here"
|
|
1243
|
+
* has to be spendable as a predicate, or a console is offering choices that return nothing.
|
|
1244
|
+
*
|
|
1245
|
+
* `attributeKey` lists the search-attribute keys in use (the left-hand side of a predicate);
|
|
1246
|
+
* `attributeValue` lists the values recorded under ONE key (its right-hand side).
|
|
1247
|
+
*/
|
|
1248
|
+
type RunValueAxis = {
|
|
1249
|
+
field: 'workflow' | 'status' | 'origin' | 'namespace' | 'tag' | 'attributeKey';
|
|
1250
|
+
} | {
|
|
1251
|
+
field: 'attributeValue';
|
|
1252
|
+
key: string;
|
|
1253
|
+
};
|
|
1254
|
+
/**
|
|
1255
|
+
* One distinct value of a {@link RunValueAxis} and how many of the matching runs carry it — the rows
|
|
1256
|
+
* behind a console's value picker. `value` is `null` only where the axis itself has an absent bucket
|
|
1257
|
+
* (a run with no `origin`); a count is never zero, since a value with no runs produces no row.
|
|
1258
|
+
*/
|
|
1259
|
+
interface RunValueFacetRow {
|
|
1260
|
+
value: string | null;
|
|
1261
|
+
count: number;
|
|
1262
|
+
}
|
|
1263
|
+
/**
|
|
1264
|
+
* How much of the store {@link StateStore.runValueFacets} may read to answer.
|
|
1265
|
+
*
|
|
1266
|
+
* `limit` bounds the ROWS RETURNED (highest count first): tag and attribute-value cardinality is
|
|
1267
|
+
* unbounded in principle — a run tagged `singleton:<key>` mints a new tag per key — so a picker asks
|
|
1268
|
+
* for the top slice rather than the whole domain, and keeps free text for everything else.
|
|
1269
|
+
*
|
|
1270
|
+
* `scan` bounds the RUNS READ, and applies to the axes whose values are not a column of the run row
|
|
1271
|
+
* being counted — `tag` (inside a JSON array column) and the two attribute axes (a side table). Those
|
|
1272
|
+
* report counts over the newest `scan` matching runs rather than over all of them: a bounded,
|
|
1273
|
+
* deliberately approximate answer, where the alternative is a full scan on every keystroke. The
|
|
1274
|
+
* column axes (`workflow`, `status`, `origin`, `namespace`) are exact and ignore `scan`.
|
|
1275
|
+
*/
|
|
1276
|
+
interface RunValueFacetOptions {
|
|
1277
|
+
limit?: number | undefined;
|
|
1278
|
+
scan?: number | undefined;
|
|
1279
|
+
}
|
|
1184
1280
|
/** The transaction handle `StateStore.transaction` hands to its work callback. */
|
|
1185
1281
|
interface StoreTransaction {
|
|
1186
1282
|
/** The store-native transaction handle (TypeORM `EntityManager`, Prisma tx client, MikroORM `EntityManager`,
|
|
@@ -1247,6 +1343,11 @@ type RunRequestKind = {
|
|
|
1247
1343
|
} | {
|
|
1248
1344
|
kind: 'runFacets';
|
|
1249
1345
|
query: RunFacetQuery;
|
|
1346
|
+
} | {
|
|
1347
|
+
kind: 'runValueFacets';
|
|
1348
|
+
axis: RunValueAxis;
|
|
1349
|
+
query: RunFacetQuery;
|
|
1350
|
+
opts?: RunValueFacetOptions | undefined;
|
|
1250
1351
|
} | {
|
|
1251
1352
|
kind: 'workerHealth';
|
|
1252
1353
|
} | {
|
|
@@ -4396,6 +4497,46 @@ declare function mergeRunFacetRows(rows: readonly {
|
|
|
4396
4497
|
count: number;
|
|
4397
4498
|
}[]): RunFacetRow[];
|
|
4398
4499
|
|
|
4500
|
+
/** Rows a value picker gets when the caller names no bound — enough to fill a dropdown several times
|
|
4501
|
+
* over, small enough that an axis with unbounded cardinality (tags) can't return a listing. */
|
|
4502
|
+
declare const RUN_VALUE_FACET_LIMIT = 100;
|
|
4503
|
+
/** Runs read when an axis has to be counted in-process (see {@link RunValueFacetOptions.scan}). */
|
|
4504
|
+
declare const RUN_VALUE_FACET_SCAN = 5000;
|
|
4505
|
+
/**
|
|
4506
|
+
* Is this axis a plain column on the runs table, and so countable with a `GROUP BY` over the whole
|
|
4507
|
+
* matching set?
|
|
4508
|
+
*
|
|
4509
|
+
* The other three are not, in the same way for the same reason — the value isn't in a column of the
|
|
4510
|
+
* row being counted. A run's tags live inside ONE json array column that no `GROUP BY` portable
|
|
4511
|
+
* across sqlite/MySQL/Postgres reaches into, and its search attributes live in a side table whose
|
|
4512
|
+
* join back to the filtered run set differs per adapter. Those axes are counted in-process over a
|
|
4513
|
+
* bounded scan instead ({@link runValueFacetsFromRuns}), so their counts describe that window rather
|
|
4514
|
+
* than the whole store — which is why {@link RunValueFacetOptions.scan} exists.
|
|
4515
|
+
*/
|
|
4516
|
+
declare function axisIsRunColumn(axis: RunValueAxis): axis is {
|
|
4517
|
+
field: 'workflow' | 'status' | 'origin' | 'namespace';
|
|
4518
|
+
};
|
|
4519
|
+
/**
|
|
4520
|
+
* Fold, order and bound raw `(value, count)` rows into the answer callers see: highest count first,
|
|
4521
|
+
* ties broken alphabetically so a picker's order is stable between polls, the unattributed bucket
|
|
4522
|
+
* (`null`) last, and no more than `limit` rows.
|
|
4523
|
+
*
|
|
4524
|
+
* Every store pipes its `GROUP BY` through this — the same role {@link mergeRunFacetRows} plays for
|
|
4525
|
+
* status/origin counts — so a picker lists the same values in the same order whichever adapter is
|
|
4526
|
+
* underneath, rather than each SQL dialect's default ordering leaking into the UI.
|
|
4527
|
+
*/
|
|
4528
|
+
declare function mergeRunValueFacetRows(rows: readonly {
|
|
4529
|
+
value: string | null | undefined;
|
|
4530
|
+
count: number;
|
|
4531
|
+
}[], opts?: RunValueFacetOptions): RunValueFacetRow[];
|
|
4532
|
+
/**
|
|
4533
|
+
* Count an axis's distinct values across runs already narrowed by the caller's predicates — the
|
|
4534
|
+
* in-process path, used by the in-memory store for every axis and by the SQL stores for `tag` (see
|
|
4535
|
+
* {@link axisIsGroupable}). `runs` must be ordered newest-first and already bounded to
|
|
4536
|
+
* {@link RunValueFacetOptions.scan}, since that window is what the counts then describe.
|
|
4537
|
+
*/
|
|
4538
|
+
declare function runValueFacetsFromRuns(runs: readonly WorkflowRun[], axis: RunValueAxis, opts?: RunValueFacetOptions): RunValueFacetRow[];
|
|
4539
|
+
|
|
4399
4540
|
/** A run as returned by the gateway's list — the durable run plus an optional {@link RunWaiting}
|
|
4400
4541
|
* descriptor the control plane resolves (what a suspended run is parked on), so the dashboard can
|
|
4401
4542
|
* name the wait in a list row without fetching each run's timeline. Additive: `waiting` is absent
|
|
@@ -4459,6 +4600,16 @@ declare abstract class RunGateway {
|
|
|
4459
4600
|
* page bounds what is rendered, these counts stay whole-set exact. Zero-count cells are absent.
|
|
4460
4601
|
*/
|
|
4461
4602
|
abstract runFacets(query: RunFacetQuery): Promise<RunFacetRow[]>;
|
|
4603
|
+
/**
|
|
4604
|
+
* The distinct values of one filter axis over the runs matching `query`, with counts — what fills a
|
|
4605
|
+
* console's tenant/tag/attribute pickers. On the port (not control-plane-only) because the pickers
|
|
4606
|
+
* belong to the same panel as {@link listRuns}: a tenant that can list its runs has to be able to
|
|
4607
|
+
* see what it may filter them by, or its console offers a blank dropdown.
|
|
4608
|
+
*
|
|
4609
|
+
* Returns `[]` when the underlying store does not implement the enumeration — an empty picker with
|
|
4610
|
+
* free-text entry still standing, not an error.
|
|
4611
|
+
*/
|
|
4612
|
+
abstract runValueFacets(axis: RunValueAxis, query: RunFacetQuery, opts?: RunValueFacetOptions): Promise<RunValueFacetRow[]>;
|
|
4462
4613
|
/**
|
|
4463
4614
|
* Bulk-resolve {@link RunWaiting} for an arbitrary set of run ids — for a consumer with its OWN
|
|
4464
4615
|
* filtered/paginated run listing (so it isn't just `listRuns` under another name) that needs to know
|
|
@@ -4544,6 +4695,12 @@ declare class CodecStateStore implements StateStore {
|
|
|
4544
4695
|
* of resolving to a silently wrong empty result.
|
|
4545
4696
|
*/
|
|
4546
4697
|
readonly runFacets?: (query: RunFacetQuery) => Promise<RunFacetRow[]>;
|
|
4698
|
+
/**
|
|
4699
|
+
* Forwarded verbatim, and safe to: the axes a value facet enumerates are searchable metadata
|
|
4700
|
+
* (workflow, status, origin, namespace, tags, search attributes), none of which the codec encodes.
|
|
4701
|
+
* Bound the same conditional way as {@link runFacets} so absence is reported, not faked.
|
|
4702
|
+
*/
|
|
4703
|
+
readonly runValueFacets?: (axis: RunValueAxis, query: RunFacetQuery, opts?: RunValueFacetOptions) => Promise<RunValueFacetRow[]>;
|
|
4547
4704
|
constructor(inner: StateStore, codec: PayloadCodec);
|
|
4548
4705
|
private enc;
|
|
4549
4706
|
private dec;
|
|
@@ -4772,16 +4929,39 @@ interface RunAttributeRow {
|
|
|
4772
4929
|
* in-process `compare` treats `eq`/`ne` on booleans). Returns `[]` for a run with no attributes.
|
|
4773
4930
|
*/
|
|
4774
4931
|
declare function normalizeAttributeRows(runId: string, attributes: SearchAttributes | undefined): RunAttributeRow[];
|
|
4775
|
-
/**
|
|
4776
|
-
|
|
4932
|
+
/**
|
|
4933
|
+
* SQL comparison operator for a single-operand {@link AttributeOp} (used to build pushdown
|
|
4934
|
+
* predicates). `in` is absent by construction: it compares against a SET, which a store emits as an
|
|
4935
|
+
* OR of equalities over {@link attributePredicateOperands} rather than as one comparator.
|
|
4936
|
+
*/
|
|
4937
|
+
declare function sqlComparator(op: Exclude<AttributeOp, 'in'>): string;
|
|
4777
4938
|
/**
|
|
4778
4939
|
* Which side-table column an attribute filter compares against: numeric operands (and range ops on
|
|
4779
4940
|
* numbers) hit `numValue`; everything else hits `strValue` (booleans are stored as `"true"`/`"false"`).
|
|
4780
4941
|
* Keeping this in core means every SQL adapter pushes predicates down identically.
|
|
4781
4942
|
*/
|
|
4782
|
-
declare function attributeColumnFor(filter:
|
|
4943
|
+
declare function attributeColumnFor(filter: ScalarAttributeFilter): 'numValue' | 'strValue';
|
|
4783
4944
|
/** The literal a side-table predicate compares against (booleans → `"true"`/`"false"` strings). */
|
|
4784
|
-
declare function attributeOperand(filter:
|
|
4945
|
+
declare function attributeOperand(filter: ScalarAttributeFilter): string | number;
|
|
4946
|
+
/** One comparison a side-table predicate makes: which typed column, with which operator, against
|
|
4947
|
+
* which literal. */
|
|
4948
|
+
interface AttributePredicateOperand {
|
|
4949
|
+
column: 'numValue' | 'strValue';
|
|
4950
|
+
comparator: string;
|
|
4951
|
+
operand: string | number;
|
|
4952
|
+
}
|
|
4953
|
+
/**
|
|
4954
|
+
* The comparisons one {@link AttributeFilter} makes, for a store to OR together inside its
|
|
4955
|
+
* `EXISTS`/join on the normalized attribute side-table. A scalar op yields exactly ONE comparison
|
|
4956
|
+
* (the same column/operator/literal {@link attributeColumnFor} and {@link attributeOperand} give);
|
|
4957
|
+
* `in` yields one per member, each an equality, since its operands may be of mixed types and so land
|
|
4958
|
+
* in different typed columns.
|
|
4959
|
+
*
|
|
4960
|
+
* An EMPTY list is a real answer, not a missing one: `in` over no values can match no run. A caller
|
|
4961
|
+
* that ORs an empty list must emit a false predicate rather than dropping the filter, or the query
|
|
4962
|
+
* silently widens to every run.
|
|
4963
|
+
*/
|
|
4964
|
+
declare function attributePredicateOperands(filter: AttributeFilter): AttributePredicateOperand[];
|
|
4785
4965
|
|
|
4786
4966
|
/**
|
|
4787
4967
|
* Read a run's `searchAttributes` through a {@link SearchAttributesSchema}, typed to the schema's
|
|
@@ -5002,6 +5182,10 @@ declare class InMemoryStateStore implements StateStore {
|
|
|
5002
5182
|
private matching;
|
|
5003
5183
|
listRuns(query: RunQuery): Promise<WorkflowRun[]>;
|
|
5004
5184
|
runFacets(query: RunFacetQuery): Promise<RunFacetRow[]>;
|
|
5185
|
+
/** Counted over the newest `scan` matching runs for EVERY axis, not just `tag`: this store holds
|
|
5186
|
+
* its runs in a Map with no index to group by, so the bound that the SQL stores need only for tags
|
|
5187
|
+
* is the honest one to apply here throughout. */
|
|
5188
|
+
runValueFacets(axis: RunValueAxis, query: RunFacetQuery, opts?: RunValueFacetOptions): Promise<RunValueFacetRow[]>;
|
|
5005
5189
|
listCheckpoints(runId: string): Promise<StepCheckpoint[]>;
|
|
5006
5190
|
getLatestCheckpointByName(runId: string, name: string): Promise<StepCheckpoint | undefined>;
|
|
5007
5191
|
listCheckpointsByNamePrefix(runId: string, prefixes: string[]): Promise<StepCheckpoint[]>;
|
|
@@ -5033,4 +5217,4 @@ declare class InMemoryTransport implements Transport, ControlPlane {
|
|
|
5033
5217
|
onControl(handler: (msg: ControlMessage) => void): void;
|
|
5034
5218
|
}
|
|
5035
5219
|
|
|
5036
|
-
export { type AccumulatorHost, type Admission, type AdmissionBackend, type AdmissionItem, type AnnouncedWorkflow, type AnnouncementEvidence, type AttributeFilter, type AttributeOp, type BackoffStrategy, type BlockedDispatch, type BlockedResolution, CONTROL_FLOW_SIGNAL, CURRENT_PROTOCOL_VERSION, type CapabilityRequirement, type ChildCallOptions, CodecStateStore, ContinueAsNew, type ControlMessage, type ControlPlane, DEFAULT_PARTITION, DURABLE_OPTIONS, DURABLE_OPTIONS_CANONICAL, DURABLE_STEP_CONFIG, DURABLE_STEP_NAME, type Disagreement, type DispatchDiagnostics, type DispatchPlan, type DurableExecution, type DurableExecutionWrapper, type DurableTopology, type DurableWebhook, DurableWorkflow, EVENT_BUFFER_SCAN_LIMIT, EVENT_TOKEN_PREFIX, type EngineEvent, type EngineEventType, type EngineListener, Entities, type EntityConfig, type EntityHandler, type EntityHost, EventAccumulators, type EventBatchConfig, FatalError, GatherError, type GroupHealth, type Heartbeat, type HeartbeatSighting, type HeartbeatStatus, type HistoryEvent, InMemoryAdmissionBackend, InMemoryStateStore, InMemoryTransport, type InferSearchAttributes, LEGACY_V1_CAPABILITIES, LEGACY_V1_PROTOCOL, type MetricsCollector, type MetricsSnapshot, type NamedTransport, type NegotiateOptions, type NegotiationOutcome, type NegotiationReason, type NegotiationResult, NonDeterminismError, type PartitionSighting, type PayloadCodec, type QueueConfig, QueueController, type RawWorkerDescriptor, RemoteStepError, RemoteStepTimeout, type RemoteTask, RemoteWorkflowExecutor, RemoteWorkflowTimeout, type RetentionPolicy, type RoutableDispatch, type RoutableResolution, type RoutingResolution, type RunAttributeRow, type RunDetail, type RunDispatcher, type RunFacetQuery, type RunFacetRow, RunGateway, type RunListItem, type RunQuery, type RunReply, type RunReplyResult, type RunRequest, type RunRequestKind, type RunResult, type RunSchedulesOptions, type RunStatus, type RunWaiting, STATE_STORE, STATE_STORE_CANONICAL, type ScheduledWorkflow, type SearchAttributes, type SearchAttributesSchema, SignalTimeoutError, type SignalWaiter, type SingletonConfig, SingletonQueueFullError, StandardSchemaV1, type StartOptions, type StartRunMessage, type StateStore, type StepCheckpoint, type StepConfig, type StepDef, type StepDispatchOpts, type StepError, type StepEvent, type StepHandler, type StepInterceptor, type StepInvocation, type StepKind, type StepLogger, type StepOptions, type StepRef, type StepResult, type StepUndo, type StoreTransaction, type SubProcessHandle, TERMINAL_RUN_STATUSES, TRANSPORT, TRANSPORT_CANONICAL, type TenantEvent, type Transport, type UndoOf, type UpdateResult, type UpdateValidator, VERSION_UNDECLARED_TAG, WORKFLOW_NAME_KEY, type WireDates, type WorkerAdjust, type WorkerConcurrencyStatus, type WorkerDescriptor, type WorkerHeartbeat, type WorkerLifecycle, type WorkerStatus, type WorkflowAnnouncement, WorkflowBlocked, type WorkflowClass, type WorkflowCommand, type WorkflowCtx, type WorkflowDecision, type WorkflowDirectory, WorkflowEngine, type WorkflowEngineDeps, type WorkflowExecutor, type WorkflowHandler, type WorkflowInputOf, type WorkflowOutputOf, type WorkflowRef, type WorkflowRegistration, type WorkflowRun, type WorkflowStartClient, type WorkflowStepEvent, WorkflowSuspended, type WorkflowTask, aggregateAnnouncements, announcementsOf, applyAttributeQuery, attributeColumnFor, attributeOperand, bindWorkflowClass, breakpointToken, buildWorkflowDirectory, canRoute, capableWorkers, classifyWaiterToken, clearDurableExecutionWrappers, collectMetrics, controlPlaneDescriptor, coveredTokens, createStepLogger, currentStep, currentWorkflowCtx, debug, describeWorker, descriptorHash, error, eventMatchOf, eventMatches, eventNameOf, eventPrefix, eventToken, facetOrigin, hasDurableExecutionWrappers, heartbeatStatus, indexWaitersByRun, info, isEventToken, isLegacyDescriptor, isWorkflowControlFlowSignal, log, matchesAttributes, mergeRunFacetRows, missingCapabilities, negotiate, normalizeAttributeRows, normalizeDescriptor, observedAnnouncements, parseDuration, partitionOfToken, planDispatch, prevCronFireMs, readSearchAttributes, requiredCapabilities, resolveRouting, resolveRunWaiting, runDurableExecution, runInStepLogger, runInWorkflowCtx, runSchedules, runStepHandler, sanitizeQueueToken, scheduledRunId, sqlComparator, stepConfigOf, stepId, stepNameOf, sub, subEvent, subProcess, tenantGroup, useDurableExecution, warn, workflowName };
|
|
5220
|
+
export { type AccumulatorHost, type Admission, type AdmissionBackend, type AdmissionItem, type AnnouncedWorkflow, type AnnouncementEvidence, type AttributeFilter, type AttributeOp, type AttributePredicateOperand, type AttributeValue, type BackoffStrategy, type BlockedDispatch, type BlockedResolution, CONTROL_FLOW_SIGNAL, CURRENT_PROTOCOL_VERSION, type CapabilityRequirement, type ChildCallOptions, CodecStateStore, ContinueAsNew, type ControlMessage, type ControlPlane, DEFAULT_PARTITION, DURABLE_OPTIONS, DURABLE_OPTIONS_CANONICAL, DURABLE_STEP_CONFIG, DURABLE_STEP_NAME, type Disagreement, type DispatchDiagnostics, type DispatchPlan, type DurableExecution, type DurableExecutionWrapper, type DurableTopology, type DurableWebhook, DurableWorkflow, EVENT_BUFFER_SCAN_LIMIT, EVENT_TOKEN_PREFIX, type EngineEvent, type EngineEventType, type EngineListener, Entities, type EntityConfig, type EntityHandler, type EntityHost, EventAccumulators, type EventBatchConfig, FatalError, GatherError, type GroupHealth, type Heartbeat, type HeartbeatSighting, type HeartbeatStatus, type HistoryEvent, InMemoryAdmissionBackend, InMemoryStateStore, InMemoryTransport, type InferSearchAttributes, LEGACY_V1_CAPABILITIES, LEGACY_V1_PROTOCOL, type MetricsCollector, type MetricsSnapshot, type NamedTransport, type NegotiateOptions, type NegotiationOutcome, type NegotiationReason, type NegotiationResult, NonDeterminismError, type PartitionSighting, type PayloadCodec, type QueueConfig, QueueController, RUN_VALUE_FACET_LIMIT, RUN_VALUE_FACET_SCAN, type RawWorkerDescriptor, RemoteStepError, RemoteStepTimeout, type RemoteTask, RemoteWorkflowExecutor, RemoteWorkflowTimeout, type RetentionPolicy, type RoutableDispatch, type RoutableResolution, type RoutingResolution, type RunAttributeRow, type RunDetail, type RunDispatcher, type RunFacetQuery, type RunFacetRow, RunGateway, type RunListItem, type RunQuery, type RunReply, type RunReplyResult, type RunRequest, type RunRequestKind, type RunResult, type RunSchedulesOptions, type RunStatus, type RunValueAxis, type RunValueFacetOptions, type RunValueFacetRow, type RunWaiting, STATE_STORE, STATE_STORE_CANONICAL, type ScalarAttributeFilter, type ScheduledWorkflow, type SearchAttributes, type SearchAttributesSchema, SignalTimeoutError, type SignalWaiter, type SingletonConfig, SingletonQueueFullError, StandardSchemaV1, type StartOptions, type StartRunMessage, type StateStore, type StepCheckpoint, type StepConfig, type StepDef, type StepDispatchOpts, type StepError, type StepEvent, type StepHandler, type StepInterceptor, type StepInvocation, type StepKind, type StepLogger, type StepOptions, type StepRef, type StepResult, type StepUndo, type StoreTransaction, type SubProcessHandle, TERMINAL_RUN_STATUSES, TRANSPORT, TRANSPORT_CANONICAL, type TenantEvent, type Transport, type UndoOf, type UpdateResult, type UpdateValidator, VERSION_UNDECLARED_TAG, WORKFLOW_NAME_KEY, type WireDates, type WorkerAdjust, type WorkerConcurrencyStatus, type WorkerDescriptor, type WorkerHeartbeat, type WorkerLifecycle, type WorkerStatus, type WorkflowAnnouncement, WorkflowBlocked, type WorkflowClass, type WorkflowCommand, type WorkflowCtx, type WorkflowDecision, type WorkflowDirectory, WorkflowEngine, type WorkflowEngineDeps, type WorkflowExecutor, type WorkflowHandler, type WorkflowInputOf, type WorkflowOutputOf, type WorkflowRef, type WorkflowRegistration, type WorkflowRun, type WorkflowStartClient, type WorkflowStepEvent, WorkflowSuspended, type WorkflowTask, aggregateAnnouncements, announcementsOf, applyAttributeQuery, attributeColumnFor, attributeOperand, attributePredicateOperands, axisIsRunColumn, bindWorkflowClass, breakpointToken, buildWorkflowDirectory, canRoute, capableWorkers, classifyWaiterToken, clearDurableExecutionWrappers, collectMetrics, controlPlaneDescriptor, coveredTokens, createStepLogger, currentStep, currentWorkflowCtx, debug, describeWorker, descriptorHash, error, eventMatchOf, eventMatches, eventNameOf, eventPrefix, eventToken, facetOrigin, hasDurableExecutionWrappers, heartbeatStatus, indexWaitersByRun, info, isEventToken, isLegacyDescriptor, isWorkflowControlFlowSignal, log, matchesAttributes, mergeRunFacetRows, mergeRunValueFacetRows, missingCapabilities, negotiate, normalizeAttributeRows, normalizeDescriptor, observedAnnouncements, parseDuration, partitionOfToken, planDispatch, prevCronFireMs, readSearchAttributes, requiredCapabilities, resolveRouting, resolveRunWaiting, runDurableExecution, runInStepLogger, runInWorkflowCtx, runSchedules, runStepHandler, runValueFacetsFromRuns, sanitizeQueueToken, scheduledRunId, sqlComparator, stepConfigOf, stepId, stepNameOf, sub, subEvent, subProcess, tenantGroup, useDurableExecution, warn, workflowName };
|