@adecore/plan 0.0.1 → 0.17.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +110 -0
- package/README.md +50 -0
- package/dist/apply.d.ts +252 -0
- package/dist/apply.js +379 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +5 -0
- package/dist/markdown.d.ts +8 -0
- package/dist/markdown.js +271 -0
- package/dist/permissions.d.ts +7 -0
- package/dist/permissions.js +152 -0
- package/dist/protocol.d.ts +478 -0
- package/dist/protocol.js +148 -0
- package/dist/text.d.ts +9 -0
- package/dist/text.js +143 -0
- package/dist/tree.d.ts +41 -0
- package/dist/tree.js +142 -0
- package/package.json +40 -2
- package/src/apply.ts +452 -0
- package/src/index.ts +46 -0
- package/src/markdown.ts +275 -0
- package/src/permissions.ts +162 -0
- package/src/protocol.ts +194 -0
- package/src/text.ts +159 -0
- package/src/tree.ts +206 -0
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { allSteps, effectiveChecks, holdsPersonState, isParentStep, locateItem, refuse } from './tree.js';
|
|
2
|
+
const ALLOWED = { ok: true };
|
|
3
|
+
const PERSON_OPS = new Set(['set', 'note', 'unlock']);
|
|
4
|
+
const AGENT_OPS = new Set(['set', 'note', 'add', 'edit', 'move', 'remove', 'meta']);
|
|
5
|
+
function stepFor(plan, id, leaf) {
|
|
6
|
+
const location = locateItem(plan, id);
|
|
7
|
+
if (!location) {
|
|
8
|
+
return refuse('plan-missing-item', `The plan has no item "${id}"`);
|
|
9
|
+
}
|
|
10
|
+
if (location.item.type !== 'step') {
|
|
11
|
+
return refuse('plan-not-a-step', `"${id}" is a ${location.item.type}, not a step`);
|
|
12
|
+
}
|
|
13
|
+
if (leaf && isParentStep(location.item)) {
|
|
14
|
+
return refuse('plan-parent-state', `The step "${id}" has sub-steps, so its state follows from them`);
|
|
15
|
+
}
|
|
16
|
+
return location.item;
|
|
17
|
+
}
|
|
18
|
+
function mayState(plan, step, state, actor) {
|
|
19
|
+
const checks = effectiveChecks(plan, step);
|
|
20
|
+
if (actor === 'person') {
|
|
21
|
+
return checks === 'agent' ? refuse('step-locked', `Only the agent checks "${step.id}" until a person unlocks it`) : ALLOWED;
|
|
22
|
+
}
|
|
23
|
+
if (checks === 'person') {
|
|
24
|
+
return refuse('person-only', `Only a person checks "${step.id}"`);
|
|
25
|
+
}
|
|
26
|
+
if (step.by === 'person' && step.state !== undefined && step.state !== state) {
|
|
27
|
+
return refuse('set-by-person', `A person set "${step.id}" to ${step.state}; add a note or ask in the chat instead`);
|
|
28
|
+
}
|
|
29
|
+
return ALLOWED;
|
|
30
|
+
}
|
|
31
|
+
/* Adding under a leaf takes its state away, which may not happen to a state a person set. */
|
|
32
|
+
function mayHoldChildren(plan, under) {
|
|
33
|
+
if (under === undefined) {
|
|
34
|
+
return ALLOWED;
|
|
35
|
+
}
|
|
36
|
+
const location = locateItem(plan, under);
|
|
37
|
+
if (location?.item.type === 'step' && !isParentStep(location.item) && holdsPersonState(location.item)) {
|
|
38
|
+
return refuse('set-by-person', `A person set "${under}" to ${location.item.state}; a sub-step would take that state away`);
|
|
39
|
+
}
|
|
40
|
+
return ALLOWED;
|
|
41
|
+
}
|
|
42
|
+
/*
|
|
43
|
+
* Whether this actor may apply the operation to the plan as it is now: who sets which step, what a
|
|
44
|
+
* person set, what a person unlocked. The shape of the result (depth, size, positions) is checked
|
|
45
|
+
* when the operation is applied.
|
|
46
|
+
*/
|
|
47
|
+
export function canApply(op, actor, plan) {
|
|
48
|
+
if (!(actor === 'person' ? PERSON_OPS : AGENT_OPS).has(op.op)) {
|
|
49
|
+
return refuse('op-not-allowed', actor === 'person' ? `A person cannot ${op.op} in a plan` : `An agent cannot ${op.op} a plan`);
|
|
50
|
+
}
|
|
51
|
+
switch (op.op) {
|
|
52
|
+
case 'set': {
|
|
53
|
+
if (op.next !== undefined && actor === 'person') {
|
|
54
|
+
return refuse('op-not-allowed', 'Only the agent moves on to a next step');
|
|
55
|
+
}
|
|
56
|
+
const targets = op.ids.map((id) => [id, op.state]);
|
|
57
|
+
if (op.next !== undefined) {
|
|
58
|
+
targets.push([op.next, 'active']);
|
|
59
|
+
}
|
|
60
|
+
for (const [id, state] of targets) {
|
|
61
|
+
const step = stepFor(plan, id, true);
|
|
62
|
+
if ('ok' in step) {
|
|
63
|
+
return step;
|
|
64
|
+
}
|
|
65
|
+
const verdict = mayState(plan, step, state, actor);
|
|
66
|
+
if (!verdict.ok) {
|
|
67
|
+
return verdict;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
return ALLOWED;
|
|
71
|
+
}
|
|
72
|
+
case 'note': {
|
|
73
|
+
const step = stepFor(plan, op.id, false);
|
|
74
|
+
return 'ok' in step ? step : ALLOWED;
|
|
75
|
+
}
|
|
76
|
+
case 'unlock': {
|
|
77
|
+
if (op.ids === 'all') {
|
|
78
|
+
return ALLOWED;
|
|
79
|
+
}
|
|
80
|
+
for (const id of op.ids) {
|
|
81
|
+
const step = stepFor(plan, id, false);
|
|
82
|
+
if ('ok' in step) {
|
|
83
|
+
return step;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
return ALLOWED;
|
|
87
|
+
}
|
|
88
|
+
case 'add':
|
|
89
|
+
return mayHoldChildren(plan, op.under);
|
|
90
|
+
case 'edit': {
|
|
91
|
+
const location = locateItem(plan, op.id);
|
|
92
|
+
if (!location) {
|
|
93
|
+
return refuse('plan-missing-item', `The plan has no item "${op.id}"`);
|
|
94
|
+
}
|
|
95
|
+
const item = location.item;
|
|
96
|
+
if (item.type !== 'step') {
|
|
97
|
+
return ALLOWED;
|
|
98
|
+
}
|
|
99
|
+
// A new title would make a person's check or stamp stand for something they never saw.
|
|
100
|
+
if (op.title !== undefined && op.title !== item.title) {
|
|
101
|
+
if (holdsPersonState(item)) {
|
|
102
|
+
return refuse('set-by-person', `A person checked "${op.id}" or a step under it, so its title stays`);
|
|
103
|
+
}
|
|
104
|
+
if (effectiveChecks(plan, item) === 'person') {
|
|
105
|
+
return refuse('person-only', `Only a person checks "${op.id}", so its title stays`);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
if (op.checks === undefined) {
|
|
109
|
+
return ALLOWED;
|
|
110
|
+
}
|
|
111
|
+
if (item.unlocked && op.checks !== 'anyone') {
|
|
112
|
+
return refuse('unlocked-by-person', `A person unlocked "${op.id}", so anyone checks it`);
|
|
113
|
+
}
|
|
114
|
+
if (effectiveChecks(plan, item) === 'person' && op.checks !== 'person') {
|
|
115
|
+
return refuse('person-only', `Only a person checks "${op.id}", and that stays so`);
|
|
116
|
+
}
|
|
117
|
+
return ALLOWED;
|
|
118
|
+
}
|
|
119
|
+
case 'move': {
|
|
120
|
+
if (!locateItem(plan, op.id)) {
|
|
121
|
+
return refuse('plan-missing-item', `The plan has no item "${op.id}"`);
|
|
122
|
+
}
|
|
123
|
+
return mayHoldChildren(plan, op.under);
|
|
124
|
+
}
|
|
125
|
+
case 'remove': {
|
|
126
|
+
const location = locateItem(plan, op.id);
|
|
127
|
+
if (!location) {
|
|
128
|
+
return refuse('plan-missing-item', `The plan has no item "${op.id}"`);
|
|
129
|
+
}
|
|
130
|
+
if (holdsPersonState(location.item)) {
|
|
131
|
+
return refuse('set-by-person', `A person checked "${op.id}" or a step under it, so it stays`);
|
|
132
|
+
}
|
|
133
|
+
if (allSteps([location.item]).some((step) => effectiveChecks(plan, step) === 'person')) {
|
|
134
|
+
return refuse('person-only', `Only a person checks "${op.id}" or a step under it, so it stays`);
|
|
135
|
+
}
|
|
136
|
+
return ALLOWED;
|
|
137
|
+
}
|
|
138
|
+
case 'meta': {
|
|
139
|
+
const inherits = allSteps(plan.items).some((step) => step.checks === undefined && !step.unlocked);
|
|
140
|
+
if (op.checks !== undefined && op.checks !== 'person' && plan.meta.checks === 'person' && inherits) {
|
|
141
|
+
return refuse('person-only', 'Only a person checks the steps of this plan, and that stays so');
|
|
142
|
+
}
|
|
143
|
+
return ALLOWED;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
/* Deleting a plan takes every check a person made in it along, so an agent leaves one that holds any. */
|
|
148
|
+
export function canDeletePlan(plan, actor) {
|
|
149
|
+
return actor === 'agent' && plan.items.some(holdsPersonState)
|
|
150
|
+
? refuse('set-by-person', `A person checked steps of "${plan.meta.title}", so the plan stays`)
|
|
151
|
+
: ALLOWED;
|
|
152
|
+
}
|
|
@@ -0,0 +1,478 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const PLAN_LIMITS: {
|
|
3
|
+
readonly idLength: 64;
|
|
4
|
+
readonly title: 200;
|
|
5
|
+
readonly description: 1000;
|
|
6
|
+
readonly note: 500;
|
|
7
|
+
readonly status: 200;
|
|
8
|
+
readonly depth: 5;
|
|
9
|
+
readonly items: 300;
|
|
10
|
+
readonly plansPerChat: 20;
|
|
11
|
+
};
|
|
12
|
+
export declare const PlanItemIdSchema: z.ZodString;
|
|
13
|
+
export type PlanItemId = z.infer<typeof PlanItemIdSchema>;
|
|
14
|
+
export declare const PlanIdSchema: z.ZodString;
|
|
15
|
+
export type PlanId = z.infer<typeof PlanIdSchema>;
|
|
16
|
+
export declare const PlanStepStateSchema: z.ZodEnum<{
|
|
17
|
+
active: "active";
|
|
18
|
+
blocked: "blocked";
|
|
19
|
+
done: "done";
|
|
20
|
+
failed: "failed";
|
|
21
|
+
info: "info";
|
|
22
|
+
open: "open";
|
|
23
|
+
skipped: "skipped";
|
|
24
|
+
warning: "warning";
|
|
25
|
+
}>;
|
|
26
|
+
export type PlanStepState = z.infer<typeof PlanStepStateSchema>;
|
|
27
|
+
export declare const PlanChecksSchema: z.ZodEnum<{
|
|
28
|
+
agent: "agent";
|
|
29
|
+
anyone: "anyone";
|
|
30
|
+
person: "person";
|
|
31
|
+
}>;
|
|
32
|
+
export type PlanChecks = z.infer<typeof PlanChecksSchema>;
|
|
33
|
+
export declare const PlanActorSchema: z.ZodEnum<{
|
|
34
|
+
agent: "agent";
|
|
35
|
+
person: "person";
|
|
36
|
+
}>;
|
|
37
|
+
export type PlanActor = z.infer<typeof PlanActorSchema>;
|
|
38
|
+
export declare const PlanKindSchema: z.ZodEnum<{
|
|
39
|
+
steps: "steps";
|
|
40
|
+
test: "test";
|
|
41
|
+
}>;
|
|
42
|
+
export type PlanKind = z.infer<typeof PlanKindSchema>;
|
|
43
|
+
export declare const PlanMetaSchema: z.ZodObject<{
|
|
44
|
+
title: z.ZodString;
|
|
45
|
+
kind: z.ZodEnum<{
|
|
46
|
+
steps: "steps";
|
|
47
|
+
test: "test";
|
|
48
|
+
}>;
|
|
49
|
+
summary: z.ZodOptional<z.ZodString>;
|
|
50
|
+
status: z.ZodOptional<z.ZodString>;
|
|
51
|
+
checks: z.ZodEnum<{
|
|
52
|
+
agent: "agent";
|
|
53
|
+
anyone: "anyone";
|
|
54
|
+
person: "person";
|
|
55
|
+
}>;
|
|
56
|
+
}, z.core.$strip>;
|
|
57
|
+
export type PlanMeta = z.infer<typeof PlanMetaSchema>;
|
|
58
|
+
export declare const PlanStepSchema: z.ZodObject<{
|
|
59
|
+
type: z.ZodLiteral<"step">;
|
|
60
|
+
id: z.ZodString;
|
|
61
|
+
title: z.ZodString;
|
|
62
|
+
description: z.ZodOptional<z.ZodString>;
|
|
63
|
+
checks: z.ZodOptional<z.ZodEnum<{
|
|
64
|
+
agent: "agent";
|
|
65
|
+
anyone: "anyone";
|
|
66
|
+
person: "person";
|
|
67
|
+
}>>;
|
|
68
|
+
state: z.ZodOptional<z.ZodEnum<{
|
|
69
|
+
active: "active";
|
|
70
|
+
blocked: "blocked";
|
|
71
|
+
done: "done";
|
|
72
|
+
failed: "failed";
|
|
73
|
+
info: "info";
|
|
74
|
+
open: "open";
|
|
75
|
+
skipped: "skipped";
|
|
76
|
+
warning: "warning";
|
|
77
|
+
}>>;
|
|
78
|
+
by: z.ZodOptional<z.ZodEnum<{
|
|
79
|
+
agent: "agent";
|
|
80
|
+
person: "person";
|
|
81
|
+
}>>;
|
|
82
|
+
at: z.ZodOptional<z.ZodString>;
|
|
83
|
+
note: z.ZodOptional<z.ZodString>;
|
|
84
|
+
unlocked: z.ZodOptional<z.ZodBoolean>;
|
|
85
|
+
steps: z.ZodOptional<z.ZodArray<z.ZodObject</*elided*/ any, z.core.$strip>>>;
|
|
86
|
+
}, z.core.$strip>;
|
|
87
|
+
export type PlanStep = z.infer<typeof PlanStepSchema>;
|
|
88
|
+
export declare const PlanTextSchema: z.ZodObject<{
|
|
89
|
+
type: z.ZodLiteral<"text">;
|
|
90
|
+
id: z.ZodString;
|
|
91
|
+
title: z.ZodString;
|
|
92
|
+
description: z.ZodOptional<z.ZodString>;
|
|
93
|
+
}, z.core.$strip>;
|
|
94
|
+
export type PlanText = z.infer<typeof PlanTextSchema>;
|
|
95
|
+
export declare const PlanSectionSchema: z.ZodObject<{
|
|
96
|
+
type: z.ZodLiteral<"section">;
|
|
97
|
+
id: z.ZodString;
|
|
98
|
+
title: z.ZodString;
|
|
99
|
+
description: z.ZodOptional<z.ZodString>;
|
|
100
|
+
items: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
101
|
+
type: z.ZodLiteral<"text">;
|
|
102
|
+
id: z.ZodString;
|
|
103
|
+
title: z.ZodString;
|
|
104
|
+
description: z.ZodOptional<z.ZodString>;
|
|
105
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
106
|
+
type: z.ZodLiteral<"step">;
|
|
107
|
+
id: z.ZodString;
|
|
108
|
+
title: z.ZodString;
|
|
109
|
+
description: z.ZodOptional<z.ZodString>;
|
|
110
|
+
checks: z.ZodOptional<z.ZodEnum<{
|
|
111
|
+
agent: "agent";
|
|
112
|
+
anyone: "anyone";
|
|
113
|
+
person: "person";
|
|
114
|
+
}>>;
|
|
115
|
+
state: z.ZodOptional<z.ZodEnum<{
|
|
116
|
+
active: "active";
|
|
117
|
+
blocked: "blocked";
|
|
118
|
+
done: "done";
|
|
119
|
+
failed: "failed";
|
|
120
|
+
info: "info";
|
|
121
|
+
open: "open";
|
|
122
|
+
skipped: "skipped";
|
|
123
|
+
warning: "warning";
|
|
124
|
+
}>>;
|
|
125
|
+
by: z.ZodOptional<z.ZodEnum<{
|
|
126
|
+
agent: "agent";
|
|
127
|
+
person: "person";
|
|
128
|
+
}>>;
|
|
129
|
+
at: z.ZodOptional<z.ZodString>;
|
|
130
|
+
note: z.ZodOptional<z.ZodString>;
|
|
131
|
+
unlocked: z.ZodOptional<z.ZodBoolean>;
|
|
132
|
+
steps: z.ZodOptional<z.ZodArray<z.ZodObject</*elided*/ any, z.core.$strip>>>;
|
|
133
|
+
}, z.core.$strip>], "type">>;
|
|
134
|
+
}, z.core.$strip>;
|
|
135
|
+
export type PlanSection = z.infer<typeof PlanSectionSchema>;
|
|
136
|
+
export declare const PlanItemSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
137
|
+
type: z.ZodLiteral<"section">;
|
|
138
|
+
id: z.ZodString;
|
|
139
|
+
title: z.ZodString;
|
|
140
|
+
description: z.ZodOptional<z.ZodString>;
|
|
141
|
+
items: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
142
|
+
type: z.ZodLiteral<"text">;
|
|
143
|
+
id: z.ZodString;
|
|
144
|
+
title: z.ZodString;
|
|
145
|
+
description: z.ZodOptional<z.ZodString>;
|
|
146
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
147
|
+
type: z.ZodLiteral<"step">;
|
|
148
|
+
id: z.ZodString;
|
|
149
|
+
title: z.ZodString;
|
|
150
|
+
description: z.ZodOptional<z.ZodString>;
|
|
151
|
+
checks: z.ZodOptional<z.ZodEnum<{
|
|
152
|
+
agent: "agent";
|
|
153
|
+
anyone: "anyone";
|
|
154
|
+
person: "person";
|
|
155
|
+
}>>;
|
|
156
|
+
state: z.ZodOptional<z.ZodEnum<{
|
|
157
|
+
active: "active";
|
|
158
|
+
blocked: "blocked";
|
|
159
|
+
done: "done";
|
|
160
|
+
failed: "failed";
|
|
161
|
+
info: "info";
|
|
162
|
+
open: "open";
|
|
163
|
+
skipped: "skipped";
|
|
164
|
+
warning: "warning";
|
|
165
|
+
}>>;
|
|
166
|
+
by: z.ZodOptional<z.ZodEnum<{
|
|
167
|
+
agent: "agent";
|
|
168
|
+
person: "person";
|
|
169
|
+
}>>;
|
|
170
|
+
at: z.ZodOptional<z.ZodString>;
|
|
171
|
+
note: z.ZodOptional<z.ZodString>;
|
|
172
|
+
unlocked: z.ZodOptional<z.ZodBoolean>;
|
|
173
|
+
steps: z.ZodOptional<z.ZodArray<z.ZodObject</*elided*/ any, z.core.$strip>>>;
|
|
174
|
+
}, z.core.$strip>], "type">>;
|
|
175
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
176
|
+
type: z.ZodLiteral<"text">;
|
|
177
|
+
id: z.ZodString;
|
|
178
|
+
title: z.ZodString;
|
|
179
|
+
description: z.ZodOptional<z.ZodString>;
|
|
180
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
181
|
+
type: z.ZodLiteral<"step">;
|
|
182
|
+
id: z.ZodString;
|
|
183
|
+
title: z.ZodString;
|
|
184
|
+
description: z.ZodOptional<z.ZodString>;
|
|
185
|
+
checks: z.ZodOptional<z.ZodEnum<{
|
|
186
|
+
agent: "agent";
|
|
187
|
+
anyone: "anyone";
|
|
188
|
+
person: "person";
|
|
189
|
+
}>>;
|
|
190
|
+
state: z.ZodOptional<z.ZodEnum<{
|
|
191
|
+
active: "active";
|
|
192
|
+
blocked: "blocked";
|
|
193
|
+
done: "done";
|
|
194
|
+
failed: "failed";
|
|
195
|
+
info: "info";
|
|
196
|
+
open: "open";
|
|
197
|
+
skipped: "skipped";
|
|
198
|
+
warning: "warning";
|
|
199
|
+
}>>;
|
|
200
|
+
by: z.ZodOptional<z.ZodEnum<{
|
|
201
|
+
agent: "agent";
|
|
202
|
+
person: "person";
|
|
203
|
+
}>>;
|
|
204
|
+
at: z.ZodOptional<z.ZodString>;
|
|
205
|
+
note: z.ZodOptional<z.ZodString>;
|
|
206
|
+
unlocked: z.ZodOptional<z.ZodBoolean>;
|
|
207
|
+
steps: z.ZodOptional<z.ZodArray<z.ZodObject</*elided*/ any, z.core.$strip>>>;
|
|
208
|
+
}, z.core.$strip>], "type">;
|
|
209
|
+
export type PlanItem = z.infer<typeof PlanItemSchema>;
|
|
210
|
+
export declare const PlanSchema: z.ZodObject<{
|
|
211
|
+
id: z.ZodString;
|
|
212
|
+
rev: z.ZodNumber;
|
|
213
|
+
createdAt: z.ZodString;
|
|
214
|
+
meta: z.ZodObject<{
|
|
215
|
+
title: z.ZodString;
|
|
216
|
+
kind: z.ZodEnum<{
|
|
217
|
+
steps: "steps";
|
|
218
|
+
test: "test";
|
|
219
|
+
}>;
|
|
220
|
+
summary: z.ZodOptional<z.ZodString>;
|
|
221
|
+
status: z.ZodOptional<z.ZodString>;
|
|
222
|
+
checks: z.ZodEnum<{
|
|
223
|
+
agent: "agent";
|
|
224
|
+
anyone: "anyone";
|
|
225
|
+
person: "person";
|
|
226
|
+
}>;
|
|
227
|
+
}, z.core.$strip>;
|
|
228
|
+
items: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
229
|
+
type: z.ZodLiteral<"section">;
|
|
230
|
+
id: z.ZodString;
|
|
231
|
+
title: z.ZodString;
|
|
232
|
+
description: z.ZodOptional<z.ZodString>;
|
|
233
|
+
items: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
234
|
+
type: z.ZodLiteral<"text">;
|
|
235
|
+
id: z.ZodString;
|
|
236
|
+
title: z.ZodString;
|
|
237
|
+
description: z.ZodOptional<z.ZodString>;
|
|
238
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
239
|
+
type: z.ZodLiteral<"step">;
|
|
240
|
+
id: z.ZodString;
|
|
241
|
+
title: z.ZodString;
|
|
242
|
+
description: z.ZodOptional<z.ZodString>;
|
|
243
|
+
checks: z.ZodOptional<z.ZodEnum<{
|
|
244
|
+
agent: "agent";
|
|
245
|
+
anyone: "anyone";
|
|
246
|
+
person: "person";
|
|
247
|
+
}>>;
|
|
248
|
+
state: z.ZodOptional<z.ZodEnum<{
|
|
249
|
+
active: "active";
|
|
250
|
+
blocked: "blocked";
|
|
251
|
+
done: "done";
|
|
252
|
+
failed: "failed";
|
|
253
|
+
info: "info";
|
|
254
|
+
open: "open";
|
|
255
|
+
skipped: "skipped";
|
|
256
|
+
warning: "warning";
|
|
257
|
+
}>>;
|
|
258
|
+
by: z.ZodOptional<z.ZodEnum<{
|
|
259
|
+
agent: "agent";
|
|
260
|
+
person: "person";
|
|
261
|
+
}>>;
|
|
262
|
+
at: z.ZodOptional<z.ZodString>;
|
|
263
|
+
note: z.ZodOptional<z.ZodString>;
|
|
264
|
+
unlocked: z.ZodOptional<z.ZodBoolean>;
|
|
265
|
+
steps: z.ZodOptional<z.ZodArray<z.ZodObject</*elided*/ any, z.core.$strip>>>;
|
|
266
|
+
}, z.core.$strip>], "type">>;
|
|
267
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
268
|
+
type: z.ZodLiteral<"text">;
|
|
269
|
+
id: z.ZodString;
|
|
270
|
+
title: z.ZodString;
|
|
271
|
+
description: z.ZodOptional<z.ZodString>;
|
|
272
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
273
|
+
type: z.ZodLiteral<"step">;
|
|
274
|
+
id: z.ZodString;
|
|
275
|
+
title: z.ZodString;
|
|
276
|
+
description: z.ZodOptional<z.ZodString>;
|
|
277
|
+
checks: z.ZodOptional<z.ZodEnum<{
|
|
278
|
+
agent: "agent";
|
|
279
|
+
anyone: "anyone";
|
|
280
|
+
person: "person";
|
|
281
|
+
}>>;
|
|
282
|
+
state: z.ZodOptional<z.ZodEnum<{
|
|
283
|
+
active: "active";
|
|
284
|
+
blocked: "blocked";
|
|
285
|
+
done: "done";
|
|
286
|
+
failed: "failed";
|
|
287
|
+
info: "info";
|
|
288
|
+
open: "open";
|
|
289
|
+
skipped: "skipped";
|
|
290
|
+
warning: "warning";
|
|
291
|
+
}>>;
|
|
292
|
+
by: z.ZodOptional<z.ZodEnum<{
|
|
293
|
+
agent: "agent";
|
|
294
|
+
person: "person";
|
|
295
|
+
}>>;
|
|
296
|
+
at: z.ZodOptional<z.ZodString>;
|
|
297
|
+
note: z.ZodOptional<z.ZodString>;
|
|
298
|
+
unlocked: z.ZodOptional<z.ZodBoolean>;
|
|
299
|
+
steps: z.ZodOptional<z.ZodArray<z.ZodObject<any, z.core.$strip>>>;
|
|
300
|
+
}, z.core.$strip>], "type">>;
|
|
301
|
+
}, z.core.$strip>;
|
|
302
|
+
export type Plan = z.infer<typeof PlanSchema>;
|
|
303
|
+
export declare const PlanSetOpSchema: z.ZodObject<{
|
|
304
|
+
op: z.ZodLiteral<"set">;
|
|
305
|
+
ids: z.ZodArray<z.ZodString>;
|
|
306
|
+
state: z.ZodEnum<{
|
|
307
|
+
active: "active";
|
|
308
|
+
blocked: "blocked";
|
|
309
|
+
done: "done";
|
|
310
|
+
failed: "failed";
|
|
311
|
+
info: "info";
|
|
312
|
+
open: "open";
|
|
313
|
+
skipped: "skipped";
|
|
314
|
+
warning: "warning";
|
|
315
|
+
}>;
|
|
316
|
+
note: z.ZodOptional<z.ZodString>;
|
|
317
|
+
next: z.ZodOptional<z.ZodString>;
|
|
318
|
+
}, z.core.$strip>;
|
|
319
|
+
export type PlanSetOp = z.infer<typeof PlanSetOpSchema>;
|
|
320
|
+
export declare const PlanNoteOpSchema: z.ZodObject<{
|
|
321
|
+
op: z.ZodLiteral<"note">;
|
|
322
|
+
id: z.ZodString;
|
|
323
|
+
text: z.ZodString;
|
|
324
|
+
}, z.core.$strip>;
|
|
325
|
+
export type PlanNoteOp = z.infer<typeof PlanNoteOpSchema>;
|
|
326
|
+
export declare const PlanUnlockOpSchema: z.ZodObject<{
|
|
327
|
+
op: z.ZodLiteral<"unlock">;
|
|
328
|
+
ids: z.ZodUnion<readonly [z.ZodArray<z.ZodString>, z.ZodLiteral<"all">]>;
|
|
329
|
+
}, z.core.$strip>;
|
|
330
|
+
export type PlanUnlockOp = z.infer<typeof PlanUnlockOpSchema>;
|
|
331
|
+
export declare const PlanAddOpSchema: z.ZodObject<{
|
|
332
|
+
op: z.ZodLiteral<"add">;
|
|
333
|
+
type: z.ZodEnum<{
|
|
334
|
+
section: "section";
|
|
335
|
+
step: "step";
|
|
336
|
+
text: "text";
|
|
337
|
+
}>;
|
|
338
|
+
id: z.ZodOptional<z.ZodString>;
|
|
339
|
+
title: z.ZodString;
|
|
340
|
+
description: z.ZodOptional<z.ZodString>;
|
|
341
|
+
checks: z.ZodOptional<z.ZodEnum<{
|
|
342
|
+
agent: "agent";
|
|
343
|
+
anyone: "anyone";
|
|
344
|
+
person: "person";
|
|
345
|
+
}>>;
|
|
346
|
+
under: z.ZodOptional<z.ZodString>;
|
|
347
|
+
after: z.ZodOptional<z.ZodString>;
|
|
348
|
+
}, z.core.$strip>;
|
|
349
|
+
export type PlanAddOp = z.infer<typeof PlanAddOpSchema>;
|
|
350
|
+
export declare const PlanEditOpSchema: z.ZodObject<{
|
|
351
|
+
op: z.ZodLiteral<"edit">;
|
|
352
|
+
id: z.ZodString;
|
|
353
|
+
title: z.ZodOptional<z.ZodString>;
|
|
354
|
+
description: z.ZodOptional<z.ZodString>;
|
|
355
|
+
checks: z.ZodOptional<z.ZodEnum<{
|
|
356
|
+
agent: "agent";
|
|
357
|
+
anyone: "anyone";
|
|
358
|
+
person: "person";
|
|
359
|
+
}>>;
|
|
360
|
+
}, z.core.$strip>;
|
|
361
|
+
export type PlanEditOp = z.infer<typeof PlanEditOpSchema>;
|
|
362
|
+
export declare const PlanMoveOpSchema: z.ZodObject<{
|
|
363
|
+
op: z.ZodLiteral<"move">;
|
|
364
|
+
id: z.ZodString;
|
|
365
|
+
under: z.ZodOptional<z.ZodString>;
|
|
366
|
+
after: z.ZodOptional<z.ZodString>;
|
|
367
|
+
}, z.core.$strip>;
|
|
368
|
+
export type PlanMoveOp = z.infer<typeof PlanMoveOpSchema>;
|
|
369
|
+
export declare const PlanRemoveOpSchema: z.ZodObject<{
|
|
370
|
+
op: z.ZodLiteral<"remove">;
|
|
371
|
+
id: z.ZodString;
|
|
372
|
+
}, z.core.$strip>;
|
|
373
|
+
export type PlanRemoveOp = z.infer<typeof PlanRemoveOpSchema>;
|
|
374
|
+
export declare const PlanMetaOpSchema: z.ZodObject<{
|
|
375
|
+
op: z.ZodLiteral<"meta">;
|
|
376
|
+
title: z.ZodOptional<z.ZodString>;
|
|
377
|
+
summary: z.ZodOptional<z.ZodString>;
|
|
378
|
+
status: z.ZodOptional<z.ZodString>;
|
|
379
|
+
checks: z.ZodOptional<z.ZodEnum<{
|
|
380
|
+
agent: "agent";
|
|
381
|
+
anyone: "anyone";
|
|
382
|
+
person: "person";
|
|
383
|
+
}>>;
|
|
384
|
+
}, z.core.$strip>;
|
|
385
|
+
export type PlanMetaOp = z.infer<typeof PlanMetaOpSchema>;
|
|
386
|
+
export declare const PlanPersonOpSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
387
|
+
op: z.ZodLiteral<"set">;
|
|
388
|
+
ids: z.ZodArray<z.ZodString>;
|
|
389
|
+
state: z.ZodEnum<{
|
|
390
|
+
active: "active";
|
|
391
|
+
blocked: "blocked";
|
|
392
|
+
done: "done";
|
|
393
|
+
failed: "failed";
|
|
394
|
+
info: "info";
|
|
395
|
+
open: "open";
|
|
396
|
+
skipped: "skipped";
|
|
397
|
+
warning: "warning";
|
|
398
|
+
}>;
|
|
399
|
+
note: z.ZodOptional<z.ZodString>;
|
|
400
|
+
next: z.ZodOptional<z.ZodString>;
|
|
401
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
402
|
+
op: z.ZodLiteral<"note">;
|
|
403
|
+
id: z.ZodString;
|
|
404
|
+
text: z.ZodString;
|
|
405
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
406
|
+
op: z.ZodLiteral<"unlock">;
|
|
407
|
+
ids: z.ZodUnion<readonly [z.ZodArray<z.ZodString>, z.ZodLiteral<"all">]>;
|
|
408
|
+
}, z.core.$strip>], "op">;
|
|
409
|
+
export type PlanPersonOp = z.infer<typeof PlanPersonOpSchema>;
|
|
410
|
+
export declare const PlanOpSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
411
|
+
op: z.ZodLiteral<"set">;
|
|
412
|
+
ids: z.ZodArray<z.ZodString>;
|
|
413
|
+
state: z.ZodEnum<{
|
|
414
|
+
active: "active";
|
|
415
|
+
blocked: "blocked";
|
|
416
|
+
done: "done";
|
|
417
|
+
failed: "failed";
|
|
418
|
+
info: "info";
|
|
419
|
+
open: "open";
|
|
420
|
+
skipped: "skipped";
|
|
421
|
+
warning: "warning";
|
|
422
|
+
}>;
|
|
423
|
+
note: z.ZodOptional<z.ZodString>;
|
|
424
|
+
next: z.ZodOptional<z.ZodString>;
|
|
425
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
426
|
+
op: z.ZodLiteral<"note">;
|
|
427
|
+
id: z.ZodString;
|
|
428
|
+
text: z.ZodString;
|
|
429
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
430
|
+
op: z.ZodLiteral<"unlock">;
|
|
431
|
+
ids: z.ZodUnion<readonly [z.ZodArray<z.ZodString>, z.ZodLiteral<"all">]>;
|
|
432
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
433
|
+
op: z.ZodLiteral<"add">;
|
|
434
|
+
type: z.ZodEnum<{
|
|
435
|
+
section: "section";
|
|
436
|
+
step: "step";
|
|
437
|
+
text: "text";
|
|
438
|
+
}>;
|
|
439
|
+
id: z.ZodOptional<z.ZodString>;
|
|
440
|
+
title: z.ZodString;
|
|
441
|
+
description: z.ZodOptional<z.ZodString>;
|
|
442
|
+
checks: z.ZodOptional<z.ZodEnum<{
|
|
443
|
+
agent: "agent";
|
|
444
|
+
anyone: "anyone";
|
|
445
|
+
person: "person";
|
|
446
|
+
}>>;
|
|
447
|
+
under: z.ZodOptional<z.ZodString>;
|
|
448
|
+
after: z.ZodOptional<z.ZodString>;
|
|
449
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
450
|
+
op: z.ZodLiteral<"edit">;
|
|
451
|
+
id: z.ZodString;
|
|
452
|
+
title: z.ZodOptional<z.ZodString>;
|
|
453
|
+
description: z.ZodOptional<z.ZodString>;
|
|
454
|
+
checks: z.ZodOptional<z.ZodEnum<{
|
|
455
|
+
agent: "agent";
|
|
456
|
+
anyone: "anyone";
|
|
457
|
+
person: "person";
|
|
458
|
+
}>>;
|
|
459
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
460
|
+
op: z.ZodLiteral<"move">;
|
|
461
|
+
id: z.ZodString;
|
|
462
|
+
under: z.ZodOptional<z.ZodString>;
|
|
463
|
+
after: z.ZodOptional<z.ZodString>;
|
|
464
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
465
|
+
op: z.ZodLiteral<"remove">;
|
|
466
|
+
id: z.ZodString;
|
|
467
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
468
|
+
op: z.ZodLiteral<"meta">;
|
|
469
|
+
title: z.ZodOptional<z.ZodString>;
|
|
470
|
+
summary: z.ZodOptional<z.ZodString>;
|
|
471
|
+
status: z.ZodOptional<z.ZodString>;
|
|
472
|
+
checks: z.ZodOptional<z.ZodEnum<{
|
|
473
|
+
agent: "agent";
|
|
474
|
+
anyone: "anyone";
|
|
475
|
+
person: "person";
|
|
476
|
+
}>>;
|
|
477
|
+
}, z.core.$strip>], "op">;
|
|
478
|
+
export type PlanOp = z.infer<typeof PlanOpSchema>;
|