@sanity/workflow-engine 0.23.0 → 0.25.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/CHANGELOG.md +80 -0
- package/DATAMODEL.md +36 -0
- package/dist/_chunks-cjs/invariants.cjs +110 -22
- package/dist/_chunks-es/invariants.js +107 -23
- package/dist/define.d.cts +6 -0
- package/dist/define.d.ts +6 -0
- package/dist/index.cjs +120 -21
- package/dist/index.d.cts +85 -21
- package/dist/index.d.ts +85 -21
- package/dist/index.js +105 -24
- package/package.json +2 -2
package/dist/define.d.ts
CHANGED
|
@@ -1148,7 +1148,9 @@ declare const FIELD_VALUE_KINDS: readonly [
|
|
|
1148
1148
|
"progress",
|
|
1149
1149
|
"boolean",
|
|
1150
1150
|
"date",
|
|
1151
|
+
"dueDate",
|
|
1151
1152
|
"datetime",
|
|
1153
|
+
"dueDatetime",
|
|
1152
1154
|
"url",
|
|
1153
1155
|
"actor",
|
|
1154
1156
|
"assignee",
|
|
@@ -1879,6 +1881,10 @@ declare type TerminalActivityStatus =
|
|
|
1879
1881
|
* `todoList` — ad-hoc, status-tracked work items. Sugar over `array of object
|
|
1880
1882
|
* { label, status, assignee?, dueDate? }`; a plain checklist is this used with
|
|
1881
1883
|
* `{label, status}` only (open ↔ done). Never a stored kind.
|
|
1884
|
+
*
|
|
1885
|
+
* The `dueDate` column is a `date` NAMED `dueDate`, not the {@link
|
|
1886
|
+
* FieldValueMap.dueDate} kind — that kind reserves one deadline slot per level,
|
|
1887
|
+
* and a repeating row has nothing to reserve.
|
|
1882
1888
|
*/
|
|
1883
1889
|
declare type TodoListField = FieldBase<AuthoringEditable, GroupMembership> & {
|
|
1884
1890
|
type: "todoList";
|
package/dist/index.cjs
CHANGED
|
@@ -3316,6 +3316,14 @@ function latestDefinitionsGroq() {
|
|
|
3316
3316
|
return `*[${scoped} && version == math::max(*[${scoped} && name == ^.name].version)] | order(name asc)`;
|
|
3317
3317
|
}
|
|
3318
3318
|
|
|
3319
|
+
function deployedTagsGroq() {
|
|
3320
|
+
return `array::unique(*[_type == "${invariants.WORKFLOW_DEFINITION_TYPE}"].tag) | order(@ asc)`;
|
|
3321
|
+
}
|
|
3322
|
+
|
|
3323
|
+
function definitionTagsGroq() {
|
|
3324
|
+
return `array::unique(*[_type == "${invariants.WORKFLOW_DEFINITION_TYPE}" && name == $definition].tag) | order(@ asc)`;
|
|
3325
|
+
}
|
|
3326
|
+
|
|
3319
3327
|
function latestDeployedDefinitions(rows) {
|
|
3320
3328
|
const byName = /* @__PURE__ */ new Map;
|
|
3321
3329
|
for (const row of rows) {
|
|
@@ -4128,7 +4136,7 @@ const OptionalRefTypes = v__namespace.exactOptional(v__namespace.array(v__namesp
|
|
|
4128
4136
|
})), v__namespace.looseObject(invariants.tolerantEntries()({
|
|
4129
4137
|
...fieldArm("subject", invariants.fieldValueSchemas.subject),
|
|
4130
4138
|
types: OptionalRefTypes
|
|
4131
|
-
})), v__namespace.looseObject(invariants.tolerantEntries()(fieldArm("release.ref", invariants.fieldValueSchemas["release.ref"]))), v__namespace.looseObject(invariants.tolerantEntries()(fieldArm("string", invariants.fieldValueSchemas.string))), v__namespace.looseObject(invariants.tolerantEntries()(fieldArm("text", invariants.fieldValueSchemas.text))), v__namespace.looseObject(invariants.tolerantEntries()(fieldArm("number", invariants.fieldValueSchemas.number))), v__namespace.looseObject(invariants.tolerantEntries()(fieldArm("progress", invariants.fieldValueSchemas.progress))), v__namespace.looseObject(invariants.tolerantEntries()(fieldArm("boolean", invariants.fieldValueSchemas.boolean))), v__namespace.looseObject(invariants.tolerantEntries()(fieldArm("date", invariants.fieldValueSchemas.date))), v__namespace.looseObject(invariants.tolerantEntries()(fieldArm("datetime", invariants.fieldValueSchemas.datetime))), v__namespace.looseObject(invariants.tolerantEntries()(fieldArm("url", invariants.fieldValueSchemas.url))), v__namespace.looseObject(invariants.tolerantEntries()(fieldArm("actor", invariants.fieldValueSchemas.actor))), v__namespace.looseObject(invariants.tolerantEntries()(fieldArm("assignee", invariants.fieldValueSchemas.assignee))), v__namespace.looseObject(invariants.tolerantEntries()(fieldArm("assignees", invariants.fieldValueSchemas.assignees))), v__namespace.looseObject(invariants.tolerantEntries()({
|
|
4139
|
+
})), v__namespace.looseObject(invariants.tolerantEntries()(fieldArm("release.ref", invariants.fieldValueSchemas["release.ref"]))), v__namespace.looseObject(invariants.tolerantEntries()(fieldArm("string", invariants.fieldValueSchemas.string))), v__namespace.looseObject(invariants.tolerantEntries()(fieldArm("text", invariants.fieldValueSchemas.text))), v__namespace.looseObject(invariants.tolerantEntries()(fieldArm("number", invariants.fieldValueSchemas.number))), v__namespace.looseObject(invariants.tolerantEntries()(fieldArm("progress", invariants.fieldValueSchemas.progress))), v__namespace.looseObject(invariants.tolerantEntries()(fieldArm("boolean", invariants.fieldValueSchemas.boolean))), v__namespace.looseObject(invariants.tolerantEntries()(fieldArm("date", invariants.fieldValueSchemas.date))), v__namespace.looseObject(invariants.tolerantEntries()(fieldArm("dueDate", invariants.fieldValueSchemas.dueDate))), v__namespace.looseObject(invariants.tolerantEntries()(fieldArm("datetime", invariants.fieldValueSchemas.datetime))), v__namespace.looseObject(invariants.tolerantEntries()(fieldArm("dueDatetime", invariants.fieldValueSchemas.dueDatetime))), v__namespace.looseObject(invariants.tolerantEntries()(fieldArm("url", invariants.fieldValueSchemas.url))), v__namespace.looseObject(invariants.tolerantEntries()(fieldArm("actor", invariants.fieldValueSchemas.actor))), v__namespace.looseObject(invariants.tolerantEntries()(fieldArm("assignee", invariants.fieldValueSchemas.assignee))), v__namespace.looseObject(invariants.tolerantEntries()(fieldArm("assignees", invariants.fieldValueSchemas.assignees))), v__namespace.looseObject(invariants.tolerantEntries()({
|
|
4132
4140
|
...fieldArm("object", v__namespace.union([ v__namespace.null(), UnknownRecord ])),
|
|
4133
4141
|
fields: v__namespace.array(PersistedFieldShapeSchema)
|
|
4134
4142
|
})), v__namespace.looseObject(invariants.tolerantEntries()({
|
|
@@ -4805,8 +4813,11 @@ function cacheFor(client) {
|
|
|
4805
4813
|
|
|
4806
4814
|
function ingestDirectoryRows(args) {
|
|
4807
4815
|
const records = Array.isArray(args.response) ? args.response : [ args.response ];
|
|
4808
|
-
for (const row of records)
|
|
4809
|
-
|
|
4816
|
+
for (const row of records) {
|
|
4817
|
+
if (typeof row?.id != "string" || !args.requested.has(row.id)) continue;
|
|
4818
|
+
const globalId = invariants.directoryBridgeId(row.sanityUserId);
|
|
4819
|
+
globalId !== void 0 && (args.cache.set(row.id, globalId), args.out.set(row.id, globalId));
|
|
4820
|
+
}
|
|
4810
4821
|
}
|
|
4811
4822
|
|
|
4812
4823
|
async function getInstanceDocument(client, instanceId) {
|
|
@@ -5452,10 +5463,14 @@ async function resolveGlobalProjectUser(args) {
|
|
|
5452
5463
|
async function ingestMemberJoin(args) {
|
|
5453
5464
|
const {request: request, projectId: projectId, cache: cache} = args, memberIds = await projectMemberIds(request, projectId);
|
|
5454
5465
|
if (memberIds.length === 0) return;
|
|
5455
|
-
const response = await request({
|
|
5466
|
+
const requested = new Set(memberIds), response = await request({
|
|
5456
5467
|
uri: `/projects/${encodeURIComponent(projectId)}/users/${memberIds.map(encodeURIComponent).join(",")}`
|
|
5457
5468
|
});
|
|
5458
|
-
for (const row of Array.isArray(response) ? response : [ response ])
|
|
5469
|
+
for (const row of Array.isArray(response) ? response : [ response ]) {
|
|
5470
|
+
if (!isClientProjectUser(row) || !requested.has(row.id)) continue;
|
|
5471
|
+
const globalId = invariants.directoryBridgeId(row.sanityUserId);
|
|
5472
|
+
globalId !== void 0 && cache.set(`${projectId}:${globalId}`, row);
|
|
5473
|
+
}
|
|
5459
5474
|
}
|
|
5460
5475
|
|
|
5461
5476
|
function clientProjectUserDirectory(client, projectId) {
|
|
@@ -5477,7 +5492,10 @@ function clientProjectUserDirectory(client, projectId) {
|
|
|
5477
5492
|
}), candidate = Array.isArray(response) ? response[0] : response;
|
|
5478
5493
|
return candidate == null ? {
|
|
5479
5494
|
status: "missing"
|
|
5480
|
-
} : isClientProjectUser(candidate) ? {
|
|
5495
|
+
} : isClientProjectUser(candidate) ? candidate.id !== id ? {
|
|
5496
|
+
status: "inaccessible",
|
|
5497
|
+
cause: new Error(`Project-user response answered id "${candidate.id}", not the requested "${id}"`)
|
|
5498
|
+
} : {
|
|
5481
5499
|
status: "resolved",
|
|
5482
5500
|
user: candidate
|
|
5483
5501
|
} : {
|
|
@@ -8439,14 +8457,20 @@ function cachedGrants({client: client, requestFn: requestFn, resourcePath: resou
|
|
|
8439
8457
|
}
|
|
8440
8458
|
|
|
8441
8459
|
async function fetchActor(client, requestFn) {
|
|
8442
|
-
const [resourceUser, globalUser] = await Promise.all([ fetchCurrentUser(requestFn, "the workflow resource host"), fetchGlobalUser(client) ]), resourceId = usableId(resourceUser),
|
|
8443
|
-
if (
|
|
8444
|
-
|
|
8445
|
-
|
|
8446
|
-
|
|
8447
|
-
|
|
8448
|
-
});
|
|
8449
|
-
|
|
8460
|
+
const [resourceUser, globalUser] = await Promise.all([ fetchCurrentUser(requestFn, "the workflow resource host"), fetchGlobalUser(client) ]), resourceId = usableId(resourceUser), globalHostId = usableId(globalUser.user), carriedId = invariants.firstCarriedGlobalId([ globalHostId, resourceId ]), sessionId = carriedId ?? globalHostId ?? resourceId;
|
|
8461
|
+
if (sessionId === void 0) return;
|
|
8462
|
+
const bridge = carriedId === void 0 ? await bridgeProjectPrincipal({
|
|
8463
|
+
client: client,
|
|
8464
|
+
sessionId: sessionId,
|
|
8465
|
+
resourceId: resourceId
|
|
8466
|
+
}) : NO_BRIDGE, id = bridge.status === "resolved" ? bridge.globalId : sessionId;
|
|
8467
|
+
refuseProjectScopedActor({
|
|
8468
|
+
id: id,
|
|
8469
|
+
globalUser: globalUser,
|
|
8470
|
+
globalHostId: globalHostId,
|
|
8471
|
+
bridgeFailure: bridge.status === "unavailable" ? bridge : void 0
|
|
8472
|
+
});
|
|
8473
|
+
const roleNames = roleNamesFor(resourceUser, globalUser);
|
|
8450
8474
|
return {
|
|
8451
8475
|
actor: {
|
|
8452
8476
|
kind: "person",
|
|
@@ -8461,13 +8485,62 @@ async function fetchActor(client, requestFn) {
|
|
|
8461
8485
|
};
|
|
8462
8486
|
}
|
|
8463
8487
|
|
|
8464
|
-
function
|
|
8465
|
-
|
|
8466
|
-
|
|
8467
|
-
|
|
8468
|
-
|
|
8469
|
-
|
|
8470
|
-
|
|
8488
|
+
function roleNamesFor(resourceUser, globalUser) {
|
|
8489
|
+
return (resourceUser?.roles?.length ? resourceUser : globalUser.user)?.roles?.map(r => r.name).filter(n => !!n) ?? [];
|
|
8490
|
+
}
|
|
8491
|
+
|
|
8492
|
+
const NO_BRIDGE = {
|
|
8493
|
+
status: "not-applicable"
|
|
8494
|
+
};
|
|
8495
|
+
|
|
8496
|
+
function globalRouteReason(globalUser, globalHostId) {
|
|
8497
|
+
return "reason" in globalUser ? globalUser.reason : globalHostId === void 0 ? "no record" : `the global host answered with project-scoped principal "${globalHostId}"`;
|
|
8498
|
+
}
|
|
8499
|
+
|
|
8500
|
+
async function bridgeProjectPrincipal(args) {
|
|
8501
|
+
const {client: client, sessionId: sessionId, resourceId: resourceId} = args;
|
|
8502
|
+
return invariants.classifyPrincipalId(sessionId).namespace !== "project" ? NO_BRIDGE : resourceId === void 0 || invariants.classifyPrincipalId(resourceId).namespace !== "project" ? {
|
|
8503
|
+
status: "unavailable",
|
|
8504
|
+
reason: "no project-scoped principal from the resource host to address the directory with"
|
|
8505
|
+
} : directoryGlobalId({
|
|
8506
|
+
client: client,
|
|
8507
|
+
principalId: resourceId
|
|
8508
|
+
});
|
|
8509
|
+
}
|
|
8510
|
+
|
|
8511
|
+
async function directoryGlobalId(args) {
|
|
8512
|
+
const {client: client, principalId: principalId} = args, projectId = typeof client.config == "function" ? client.config().projectId : void 0;
|
|
8513
|
+
if (projectId === void 0) return {
|
|
8514
|
+
status: "unavailable",
|
|
8515
|
+
reason: "the client reports no projectId, so its user directory has no address"
|
|
8516
|
+
};
|
|
8517
|
+
const lookup = await clientProjectUserDirectory(withRequestTag(client, REQUEST_TAG.accessResolveActor), projectId).findById(principalId);
|
|
8518
|
+
if (lookup.status !== "resolved") return {
|
|
8519
|
+
status: "unavailable",
|
|
8520
|
+
reason: `project "${projectId}"'s user directory reported the principal ${lookup.status}`,
|
|
8521
|
+
...lookup.status === "inaccessible" && lookup.cause !== void 0 ? {
|
|
8522
|
+
cause: lookup.cause
|
|
8523
|
+
} : {}
|
|
8524
|
+
};
|
|
8525
|
+
const globalId = invariants.directoryBridgeId(lookup.user.sanityUserId);
|
|
8526
|
+
return globalId === void 0 ? {
|
|
8527
|
+
status: "unavailable",
|
|
8528
|
+
reason: `project "${projectId}"'s user directory row for the principal carries no account-global sanityUserId`
|
|
8529
|
+
} : {
|
|
8530
|
+
status: "resolved",
|
|
8531
|
+
globalId: globalId
|
|
8532
|
+
};
|
|
8533
|
+
}
|
|
8534
|
+
|
|
8535
|
+
function refuseProjectScopedActor(args) {
|
|
8536
|
+
const {id: id, globalUser: globalUser, globalHostId: globalHostId, bridgeFailure: bridgeFailure} = args;
|
|
8537
|
+
if (invariants.classifyPrincipalId(id).namespace !== "project") return;
|
|
8538
|
+
const routes = [ `The account-global record: ${globalRouteReason(globalUser, globalHostId)}.` ];
|
|
8539
|
+
bridgeFailure !== void 0 && routes.push(`The project user directory: ${bridgeFailure.reason}.`);
|
|
8540
|
+
const cause = bridgeFailure?.cause ?? ("cause" in globalUser ? globalUser.cause : void 0);
|
|
8541
|
+
throw new Error(`workflow: the caller's identity resolves to the project-scoped principal "${id}" and its account-global id could not be resolved. ${routes.join(" ")} The engine speaks account-global user ids only and never acts as a project-scoped principal.`, cause === void 0 ? void 0 : {
|
|
8542
|
+
cause: cause
|
|
8543
|
+
});
|
|
8471
8544
|
}
|
|
8472
8545
|
|
|
8473
8546
|
function usableId(user) {
|
|
@@ -12775,10 +12848,18 @@ const HISTORY_DISPLAY = {
|
|
|
12775
12848
|
title: "Date value",
|
|
12776
12849
|
description: "Date-only (YYYY-MM-DD) entry, no time component."
|
|
12777
12850
|
},
|
|
12851
|
+
dueDate: {
|
|
12852
|
+
title: "Due date",
|
|
12853
|
+
description: "THE due date for a level — same value as a date, elevated so surfaces identify the deadline by kind."
|
|
12854
|
+
},
|
|
12778
12855
|
datetime: {
|
|
12779
12856
|
title: "Date / time value",
|
|
12780
12857
|
description: "ISO-8601 timestamp entry."
|
|
12781
12858
|
},
|
|
12859
|
+
dueDatetime: {
|
|
12860
|
+
title: "Due date / time",
|
|
12861
|
+
description: "THE due datetime for a level — same value as a date/time, the timestamp counterpart of a due date."
|
|
12862
|
+
},
|
|
12782
12863
|
url: {
|
|
12783
12864
|
title: "URL value",
|
|
12784
12865
|
description: "Validated URL entry."
|
|
@@ -13118,6 +13199,20 @@ Object.defineProperty(exports, "MAX_COUNTERFACTUAL_INDEX", {
|
|
|
13118
13199
|
}
|
|
13119
13200
|
});
|
|
13120
13201
|
|
|
13202
|
+
Object.defineProperty(exports, "NEUTRAL_MARK", {
|
|
13203
|
+
enumerable: !0,
|
|
13204
|
+
get: function() {
|
|
13205
|
+
return groqConditionDescribe.NEUTRAL_MARK;
|
|
13206
|
+
}
|
|
13207
|
+
});
|
|
13208
|
+
|
|
13209
|
+
Object.defineProperty(exports, "OUTCOME_MARKS", {
|
|
13210
|
+
enumerable: !0,
|
|
13211
|
+
get: function() {
|
|
13212
|
+
return groqConditionDescribe.OUTCOME_MARKS;
|
|
13213
|
+
}
|
|
13214
|
+
});
|
|
13215
|
+
|
|
13121
13216
|
Object.defineProperty(exports, "analyzeCondition", {
|
|
13122
13217
|
enumerable: !0,
|
|
13123
13218
|
get: function() {
|
|
@@ -13359,6 +13454,8 @@ exports.definitionDeployedData = definitionDeployedData;
|
|
|
13359
13454
|
|
|
13360
13455
|
exports.definitionLookupGroq = definitionLookupGroq;
|
|
13361
13456
|
|
|
13457
|
+
exports.definitionTagsGroq = definitionTagsGroq;
|
|
13458
|
+
|
|
13362
13459
|
exports.definitionsListGroq = definitionsListGroq;
|
|
13363
13460
|
|
|
13364
13461
|
exports.deniedGuardLabels = deniedGuardLabels;
|
|
@@ -13369,6 +13466,8 @@ exports.denyingGuards = denyingGuards;
|
|
|
13369
13466
|
|
|
13370
13467
|
exports.deployStageGuards = deployStageGuards;
|
|
13371
13468
|
|
|
13469
|
+
exports.deployedTagsGroq = deployedTagsGroq;
|
|
13470
|
+
|
|
13372
13471
|
exports.deriveWorkflowAutonomy = deriveWorkflowAutonomy;
|
|
13373
13472
|
|
|
13374
13473
|
exports.describeAtom = describeAtom;
|
package/dist/index.d.cts
CHANGED
|
@@ -20,6 +20,8 @@ import { humanize } from "@sanity/groq-condition-describe";
|
|
|
20
20
|
import { InsightPhrase } from "@sanity/groq-condition-describe";
|
|
21
21
|
import { isComparisonOp } from "@sanity/groq-condition-describe";
|
|
22
22
|
import { MAX_COUNTERFACTUAL_INDEX } from "@sanity/groq-condition-describe";
|
|
23
|
+
import { NEUTRAL_MARK } from "@sanity/groq-condition-describe";
|
|
24
|
+
import { OUTCOME_MARKS } from "@sanity/groq-condition-describe";
|
|
23
25
|
import { quoted } from "@sanity/groq-condition-describe";
|
|
24
26
|
import type { SanityDocument } from "@sanity/types";
|
|
25
27
|
import { ScopeAssignment } from "@sanity/groq-condition-describe";
|
|
@@ -551,14 +553,17 @@ export declare type ActivityStatus = (typeof ACTIVITY_STATUSES)[number];
|
|
|
551
553
|
* read time, and only the lake's own token identity is authenticated — hard
|
|
552
554
|
* enforcement lives there.
|
|
553
555
|
*
|
|
554
|
-
* `id` is the account-global user id
|
|
555
|
-
*
|
|
556
|
-
*
|
|
557
|
-
*
|
|
558
|
-
*
|
|
559
|
-
* `
|
|
560
|
-
*
|
|
561
|
-
*
|
|
556
|
+
* `id` is the account-global user id — the one identity namespace that is
|
|
557
|
+
* stable across projects and org-level resources. The engine takes it from the
|
|
558
|
+
* first route that can answer for the token: an id either host's `/users/me`
|
|
559
|
+
* already carries in account-global form (the id itself, or the one embedded in
|
|
560
|
+
* an `e-` principal), and otherwise the project's own user directory
|
|
561
|
+
* (`sanityUserId`) — the route a session scoped to a single project depends on,
|
|
562
|
+
* since no global record exists for it. Robot tokens carry a single universal
|
|
563
|
+
* id, so for them `id` equals what every host returns. Instances written before
|
|
564
|
+
* ids were namespace-classified carry the workflow resource's local principal id
|
|
565
|
+
* in `id` instead; readers interpret those through the prefix classifier in
|
|
566
|
+
* `core/identity.ts` with the document's home resource as the implied scope.
|
|
562
567
|
*/
|
|
563
568
|
export declare interface Actor {
|
|
564
569
|
kind: ActorKind;
|
|
@@ -1680,7 +1685,8 @@ export declare interface ClientProjectUser {
|
|
|
1680
1685
|
readonly [key: string]: unknown;
|
|
1681
1686
|
}
|
|
1682
1687
|
|
|
1683
|
-
/** Project-user directory
|
|
1688
|
+
/** Project-user directory served straight from the engine's own client — the
|
|
1689
|
+
* project API's user endpoints, no host adapter. */
|
|
1684
1690
|
export declare function clientProjectUserDirectory(
|
|
1685
1691
|
client: WorkflowClient,
|
|
1686
1692
|
projectId: string,
|
|
@@ -2357,6 +2363,15 @@ export declare const DATA_MODEL_CHANGES: readonly [
|
|
|
2357
2363
|
applicability: "detectable";
|
|
2358
2364
|
summary: "Start and activity readiness use named polymorphic requirement arrays.";
|
|
2359
2365
|
}>,
|
|
2366
|
+
Readonly<{
|
|
2367
|
+
id: "due-date-field-kinds";
|
|
2368
|
+
introducedInModel: 5;
|
|
2369
|
+
minReaderModel: 0;
|
|
2370
|
+
documentTypes: readonly ["definition", "instance"];
|
|
2371
|
+
compatibility: "additive";
|
|
2372
|
+
applicability: "detectable";
|
|
2373
|
+
summary: string;
|
|
2374
|
+
}>,
|
|
2360
2375
|
];
|
|
2361
2376
|
|
|
2362
2377
|
/**
|
|
@@ -2381,7 +2396,7 @@ export declare const DATA_MODEL_MIN_READER = 4;
|
|
|
2381
2396
|
* job. Declare every bump in `DATAMODEL.md`; the model-surface snapshot test
|
|
2382
2397
|
* keeps undeclared drift red.
|
|
2383
2398
|
*/
|
|
2384
|
-
export declare const DATA_MODEL_VERSION =
|
|
2399
|
+
export declare const DATA_MODEL_VERSION = 5;
|
|
2385
2400
|
|
|
2386
2401
|
export declare interface DataModelChange {
|
|
2387
2402
|
readonly id: string;
|
|
@@ -2537,10 +2552,13 @@ export declare class DefinitionInUseError extends WorkflowError<"definition-in-u
|
|
|
2537
2552
|
}
|
|
2538
2553
|
|
|
2539
2554
|
/**
|
|
2540
|
-
* Pure GROQ
|
|
2541
|
-
*
|
|
2542
|
-
*
|
|
2555
|
+
* Pure GROQ builders for deployed workflow definitions. Composes the doc-type
|
|
2556
|
+
* constant and the tag-scope predicate so the engine's internal lookups and the
|
|
2557
|
+
* CLI share one definition of "tag-scoped, latest-or-pinned
|
|
2543
2558
|
* `workflow.definition`" instead of hand-writing the query at each call site.
|
|
2559
|
+
*
|
|
2560
|
+
* The tag enumerations are the deliberate exception: they span partitions, for a
|
|
2561
|
+
* caller holding a resource but no tag yet.
|
|
2544
2562
|
*/
|
|
2545
2563
|
/**
|
|
2546
2564
|
* GROQ resolving a single deployed {@link WORKFLOW_DEFINITION_TYPE} visible to
|
|
@@ -2599,6 +2617,19 @@ export declare function definitionsListGroq(
|
|
|
2599
2617
|
versionOrder: "asc" | "desc",
|
|
2600
2618
|
): string;
|
|
2601
2619
|
|
|
2620
|
+
/**
|
|
2621
|
+
* GROQ listing every tag partition that holds any version of one definition
|
|
2622
|
+
* name — {@link deployedTagsGroq} narrowed from "what exists here" to "where
|
|
2623
|
+
* is this".
|
|
2624
|
+
*
|
|
2625
|
+
* Several hits is ambiguity to refuse, not resolve: version numbers are
|
|
2626
|
+
* per-partition, so the highest one may sit in an environment the caller did
|
|
2627
|
+
* not mean, and the answer would carry no sign of it.
|
|
2628
|
+
*
|
|
2629
|
+
* Params: `$definition`.
|
|
2630
|
+
*/
|
|
2631
|
+
export declare function definitionTagsGroq(): string;
|
|
2632
|
+
|
|
2602
2633
|
export declare interface DeleteDefinitionArgs {
|
|
2603
2634
|
/** The definition's `name` — delete addresses the workflow, not a doc id. */
|
|
2604
2635
|
definition: string;
|
|
@@ -2748,6 +2779,13 @@ export declare type DeployedDefinition = WorkflowDefinition & {
|
|
|
2748
2779
|
minReaderModel?: number;
|
|
2749
2780
|
};
|
|
2750
2781
|
|
|
2782
|
+
/**
|
|
2783
|
+
* GROQ listing every tag partition holding a deployed
|
|
2784
|
+
* {@link WORKFLOW_DEFINITION_TYPE} in the resource. The un-scoped
|
|
2785
|
+
* inverse of {@link tagScopeFilter}, this deliberately spans partitions.
|
|
2786
|
+
*/
|
|
2787
|
+
export declare function deployedTagsGroq(): string;
|
|
2788
|
+
|
|
2751
2789
|
/**
|
|
2752
2790
|
* Deploy every guard for a stage being entered (idempotent upsert), but only
|
|
2753
2791
|
* while the instance is still committed to that stage. A deploy that lost the
|
|
@@ -3999,7 +4037,7 @@ export declare interface EvaluateArgs {
|
|
|
3999
4037
|
instanceId: string;
|
|
4000
4038
|
/**
|
|
4001
4039
|
* URL path on the supplied client where the engine should fetch
|
|
4002
|
-
* grants. The actor always token-resolves
|
|
4040
|
+
* grants. The actor always token-resolves from the supplied client; without
|
|
4003
4041
|
* a grants path the rendered `$can` is undefined, so conditions
|
|
4004
4042
|
* referencing it fail closed — and the real Sanity write boundary
|
|
4005
4043
|
* still enforces.
|
|
@@ -4337,10 +4375,18 @@ export declare const FIELD_KIND_DISPLAY: {
|
|
|
4337
4375
|
title: string;
|
|
4338
4376
|
description: string;
|
|
4339
4377
|
};
|
|
4378
|
+
dueDate: {
|
|
4379
|
+
title: string;
|
|
4380
|
+
description: string;
|
|
4381
|
+
};
|
|
4340
4382
|
datetime: {
|
|
4341
4383
|
title: string;
|
|
4342
4384
|
description: string;
|
|
4343
4385
|
};
|
|
4386
|
+
dueDatetime: {
|
|
4387
|
+
title: string;
|
|
4388
|
+
description: string;
|
|
4389
|
+
};
|
|
4344
4390
|
url: {
|
|
4345
4391
|
title: string;
|
|
4346
4392
|
description: string;
|
|
@@ -4389,7 +4435,9 @@ declare const FIELD_VALUE_KINDS: readonly [
|
|
|
4389
4435
|
"progress",
|
|
4390
4436
|
"boolean",
|
|
4391
4437
|
"date",
|
|
4438
|
+
"dueDate",
|
|
4392
4439
|
"datetime",
|
|
4440
|
+
"dueDatetime",
|
|
4393
4441
|
"url",
|
|
4394
4442
|
"actor",
|
|
4395
4443
|
"assignee",
|
|
@@ -4534,8 +4582,12 @@ export declare interface FieldValueMap {
|
|
|
4534
4582
|
boolean: boolean | null;
|
|
4535
4583
|
/** Date-only (`YYYY-MM-DD`), no time component. */
|
|
4536
4584
|
date: string | null;
|
|
4585
|
+
/** THE due date of a level — same value as {@link FieldValueMap.date}. */
|
|
4586
|
+
dueDate: string | null;
|
|
4537
4587
|
/** ISO-8601 timestamp. */
|
|
4538
4588
|
datetime: string | null;
|
|
4589
|
+
/** THE due datetime of a level — same value as {@link FieldValueMap.datetime}. */
|
|
4590
|
+
dueDatetime: string | null;
|
|
4539
4591
|
url: string | null;
|
|
4540
4592
|
actor: Actor | null;
|
|
4541
4593
|
/** A single {@link Assignee} — the singular of {@link FieldValueMap.assignees}. */
|
|
@@ -6368,6 +6420,8 @@ export declare function narrateAutonomyWaits(
|
|
|
6368
6420
|
ctx: DescribeContext,
|
|
6369
6421
|
): string[];
|
|
6370
6422
|
|
|
6423
|
+
export { NEUTRAL_MARK };
|
|
6424
|
+
|
|
6371
6425
|
/** The default logger: emit nothing. The engine's twin of `@sanity/telemetry`'s `noopLogger`. */
|
|
6372
6426
|
export declare const noopTelemetry: WorkflowTelemetryLogger;
|
|
6373
6427
|
|
|
@@ -6470,6 +6524,8 @@ export declare interface OperationResult {
|
|
|
6470
6524
|
ranOps?: OpAppliedSummary[];
|
|
6471
6525
|
}
|
|
6472
6526
|
|
|
6527
|
+
export { OUTCOME_MARKS };
|
|
6528
|
+
|
|
6473
6529
|
/**
|
|
6474
6530
|
* The instance's direct parent — the last entry of the root-first
|
|
6475
6531
|
* {@link WorkflowInstance.ancestors} chain; `undefined` for a root instance.
|
|
@@ -6796,7 +6852,7 @@ export declare class ReaderModelAcknowledgementError extends WorkflowError<"read
|
|
|
6796
6852
|
readonly code = "WORKFLOW_READER_MODEL_ACKNOWLEDGEMENT_MISMATCH";
|
|
6797
6853
|
readonly expectedMinReaderModel: unknown;
|
|
6798
6854
|
readonly engineMinReaderModel = 4;
|
|
6799
|
-
readonly engineModelVersion =
|
|
6855
|
+
readonly engineModelVersion = 5;
|
|
6800
6856
|
readonly documentationUrl =
|
|
6801
6857
|
"https://www.sanity.io/docs/editorial-workflows/prerelease";
|
|
6802
6858
|
constructor(expectedMinReaderModel: unknown, context?: string);
|
|
@@ -7690,8 +7746,8 @@ export declare interface StartInstanceArgs {
|
|
|
7690
7746
|
instanceId?: string;
|
|
7691
7747
|
/**
|
|
7692
7748
|
* URL path on the supplied client where the engine fetches the
|
|
7693
|
-
* caller's ACL grants. Identity is always token-resolved — `actor`
|
|
7694
|
-
*
|
|
7749
|
+
* caller's ACL grants. Identity is always token-resolved — `actor` is
|
|
7750
|
+
* resolved from the supplied client's token, never passed in — and grants
|
|
7695
7751
|
* feed the advisory `$can.*` params action conditions can read;
|
|
7696
7752
|
* omitting this leaves the rendered `$can` undefined (conditions
|
|
7697
7753
|
* referencing it fail closed, nothing else is gated engine-side —
|
|
@@ -8639,6 +8695,10 @@ export declare function toBareId(id: string): string;
|
|
|
8639
8695
|
* `todoList` — ad-hoc, status-tracked work items. Sugar over `array of object
|
|
8640
8696
|
* { label, status, assignee?, dueDate? }`; a plain checklist is this used with
|
|
8641
8697
|
* `{label, status}` only (open ↔ done). Never a stored kind.
|
|
8698
|
+
*
|
|
8699
|
+
* The `dueDate` column is a `date` NAMED `dueDate`, not the {@link
|
|
8700
|
+
* FieldValueMap.dueDate} kind — that kind reserves one deadline slot per level,
|
|
8701
|
+
* and a repeating row has nothing to reserve.
|
|
8642
8702
|
*/
|
|
8643
8703
|
declare type TodoListField = FieldBase<AuthoringEditable, GroupMembership> & {
|
|
8644
8704
|
type: "todoList";
|
|
@@ -9332,10 +9392,14 @@ export declare interface WorkflowAutonomy extends AutonomyAnswer {
|
|
|
9332
9392
|
|
|
9333
9393
|
export declare interface WorkflowClient {
|
|
9334
9394
|
/**
|
|
9335
|
-
* Read the effective client configuration. The engine
|
|
9336
|
-
* before deriving the global `/users/me` sibling
|
|
9337
|
-
* shallow-merges `withConfig` overrides and
|
|
9338
|
-
* project host even when
|
|
9395
|
+
* Read the effective client configuration. The engine reads two fields from
|
|
9396
|
+
* it. `apiHost` is probed before deriving the global `/users/me` sibling,
|
|
9397
|
+
* because `@sanity/client` shallow-merges `withConfig` overrides and
|
|
9398
|
+
* otherwise preserves an explicit project host even when
|
|
9399
|
+
* `useProjectHostname` is set to `false`. `projectId` addresses the project's
|
|
9400
|
+
* user directory when a project-scoped principal has to be bridged to its
|
|
9401
|
+
* account-global id — a client reporting none has no directory to ask, and
|
|
9402
|
+
* such a session is refused rather than stamped locally.
|
|
9339
9403
|
*/
|
|
9340
9404
|
config?: () => WorkflowClientConfig;
|
|
9341
9405
|
fetch: <T = unknown>(
|