@sanity/workflow-engine-test 0.4.2 → 0.5.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.d.cts CHANGED
@@ -3,6 +3,7 @@ import type { CompleteEffectArgs } from "@sanity/workflow-engine";
3
3
  import { DeployDefinitionsArgs } from "@sanity/workflow-engine";
4
4
  import { DeployDefinitionsResult } from "@sanity/workflow-engine";
5
5
  import { DispatchResult } from "@sanity/workflow-engine";
6
+ import type { EditStateArgs } from "@sanity/workflow-engine";
6
7
  import type { EvaluateArgs } from "@sanity/workflow-engine";
7
8
  import type { FireActionArgs } from "@sanity/workflow-engine";
8
9
  import type { Grant } from "@sanity/workflow-engine";
@@ -35,11 +36,13 @@ declare interface ActionResult {
35
36
  export declare const ALL_ACCESS: WorkflowAccess;
36
37
 
37
38
  /**
38
- * The default actor used when tests don't specify one. Has the
39
- * conventional `"*"` wildcard role `Action.roles` checks treat
40
- * `"*"` as matching any required role, and `Task.assignees` of
41
- * `{kind: "role"}` are satisfied by it too. Production code should
42
- * never see this id.
39
+ * The default actor used when tests don't specify one. Its `"*"` role is an
40
+ * inert placeholder, NOT a wildcard: role matching is literal membership, so
41
+ * this actor satisfies no `Action.roles` gate or `{kind: "role"}` assignee on
42
+ * its own a test that exercises a role gate passes an actor carrying the
43
+ * real role (and the definition's `roleAliases` decide what fulfills it). The
44
+ * bench's all-access default is really {@link WILDCARD_GRANTS}, which feeds
45
+ * `$can`. Production code should never see this id.
43
46
  */
44
47
  export declare const ALL_ACCESS_USER: Actor;
45
48
 
@@ -58,6 +61,17 @@ declare type BenchCompleteEffectArgs = Omit<
58
61
  actor?: Actor;
59
62
  };
60
63
 
64
+ declare type BenchEditStateArgs = Omit<
65
+ EditStateArgs,
66
+ "client" | "tag" | "workflowResource" | "access"
67
+ > & {
68
+ access?: WorkflowAccess;
69
+ /** Shortcut for `access.actor`. */
70
+ actor?: Actor;
71
+ /** Shortcut for `access.grants`. */
72
+ grants?: Grant[];
73
+ };
74
+
61
75
  declare type BenchEvaluateArgs = Omit<
62
76
  EvaluateArgs,
63
77
  "client" | "tag" | "workflowResource" | "access"
@@ -271,6 +285,7 @@ declare type EngineWrappers = {
271
285
  ) => Promise<DeployDefinitionsResult>;
272
286
  startInstance: (args: BenchStartInstanceArgs) => Promise<WorkflowInstance>;
273
287
  fireAction: (args: BenchFireActionArgs) => Promise<DispatchResult>;
288
+ editState: (args: BenchEditStateArgs) => Promise<DispatchResult>;
274
289
  completeEffect: (args: BenchCompleteEffectArgs) => Promise<DispatchResult>;
275
290
  tick: (args: BenchTickArgs) => Promise<DispatchResult>;
276
291
  evaluate: (args: BenchEvaluateArgs) => Promise<WorkflowEvaluation>;
package/dist/index.d.ts CHANGED
@@ -3,6 +3,7 @@ import type { CompleteEffectArgs } from "@sanity/workflow-engine";
3
3
  import { DeployDefinitionsArgs } from "@sanity/workflow-engine";
4
4
  import { DeployDefinitionsResult } from "@sanity/workflow-engine";
5
5
  import { DispatchResult } from "@sanity/workflow-engine";
6
+ import type { EditStateArgs } from "@sanity/workflow-engine";
6
7
  import type { EvaluateArgs } from "@sanity/workflow-engine";
7
8
  import type { FireActionArgs } from "@sanity/workflow-engine";
8
9
  import type { Grant } from "@sanity/workflow-engine";
@@ -35,11 +36,13 @@ declare interface ActionResult {
35
36
  export declare const ALL_ACCESS: WorkflowAccess;
36
37
 
37
38
  /**
38
- * The default actor used when tests don't specify one. Has the
39
- * conventional `"*"` wildcard role `Action.roles` checks treat
40
- * `"*"` as matching any required role, and `Task.assignees` of
41
- * `{kind: "role"}` are satisfied by it too. Production code should
42
- * never see this id.
39
+ * The default actor used when tests don't specify one. Its `"*"` role is an
40
+ * inert placeholder, NOT a wildcard: role matching is literal membership, so
41
+ * this actor satisfies no `Action.roles` gate or `{kind: "role"}` assignee on
42
+ * its own a test that exercises a role gate passes an actor carrying the
43
+ * real role (and the definition's `roleAliases` decide what fulfills it). The
44
+ * bench's all-access default is really {@link WILDCARD_GRANTS}, which feeds
45
+ * `$can`. Production code should never see this id.
43
46
  */
44
47
  export declare const ALL_ACCESS_USER: Actor;
45
48
 
@@ -58,6 +61,17 @@ declare type BenchCompleteEffectArgs = Omit<
58
61
  actor?: Actor;
59
62
  };
60
63
 
64
+ declare type BenchEditStateArgs = Omit<
65
+ EditStateArgs,
66
+ "client" | "tag" | "workflowResource" | "access"
67
+ > & {
68
+ access?: WorkflowAccess;
69
+ /** Shortcut for `access.actor`. */
70
+ actor?: Actor;
71
+ /** Shortcut for `access.grants`. */
72
+ grants?: Grant[];
73
+ };
74
+
61
75
  declare type BenchEvaluateArgs = Omit<
62
76
  EvaluateArgs,
63
77
  "client" | "tag" | "workflowResource" | "access"
@@ -271,6 +285,7 @@ declare type EngineWrappers = {
271
285
  ) => Promise<DeployDefinitionsResult>;
272
286
  startInstance: (args: BenchStartInstanceArgs) => Promise<WorkflowInstance>;
273
287
  fireAction: (args: BenchFireActionArgs) => Promise<DispatchResult>;
288
+ editState: (args: BenchEditStateArgs) => Promise<DispatchResult>;
274
289
  completeEffect: (args: BenchCompleteEffectArgs) => Promise<DispatchResult>;
275
290
  tick: (args: BenchTickArgs) => Promise<DispatchResult>;
276
291
  evaluate: (args: BenchEvaluateArgs) => Promise<WorkflowEvaluation>;
package/dist/index.js CHANGED
@@ -5093,6 +5093,7 @@ function createEngineWrappers(scope, access, clock) {
5093
5093
  deployDefinitions: (args) => workflow.deployDefinitions({ ...scope, ...args }),
5094
5094
  startInstance: (args) => workflow.startInstance(withAccess(args)),
5095
5095
  fireAction: (args) => workflow.fireAction(withAccess(args)),
5096
+ editState: (args) => workflow.editState(withAccess(args)),
5096
5097
  completeEffect: (args) => workflow.completeEffect(withAccess(args)),
5097
5098
  tick: (args) => workflow.tick(withAccess(args)),
5098
5099
  evaluate: (args) => workflow.evaluate(withAccess(args)),