@deskwork/core 0.13.0 → 0.14.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.
@@ -0,0 +1,171 @@
1
+ /**
2
+ * Zod schema mirror of `DraftAnnotation` from `../review/types.ts`.
3
+ *
4
+ * The TS interface union in `review/types.ts` is the source of truth for
5
+ * the *shape*. This file provides a runtime validator for the same shape
6
+ * so journal events carrying a `DraftAnnotation` payload can be parsed
7
+ * via `JournalEventSchema.safeParse` at the read boundary.
8
+ *
9
+ * The union variants here mirror `CommentAnnotation | EditAnnotation |
10
+ * ApproveAnnotation | RejectAnnotation | ResolveAnnotation |
11
+ * AddressAnnotation`. If a new variant is added there, mirror it here.
12
+ */
13
+ import { z } from 'zod';
14
+ export declare const DraftAnnotationSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
15
+ type: z.ZodLiteral<"comment">;
16
+ version: z.ZodNumber;
17
+ range: z.ZodObject<{
18
+ start: z.ZodNumber;
19
+ end: z.ZodNumber;
20
+ }, "strip", z.ZodTypeAny, {
21
+ start: number;
22
+ end: number;
23
+ }, {
24
+ start: number;
25
+ end: number;
26
+ }>;
27
+ text: z.ZodString;
28
+ category: z.ZodOptional<z.ZodEnum<["voice-drift", "missing-receipt", "tutorial-framing", "saas-vocabulary", "fake-authority", "structural", "other"]>>;
29
+ anchor: z.ZodOptional<z.ZodString>;
30
+ createdAt: z.ZodString;
31
+ workflowId: z.ZodString;
32
+ id: z.ZodString;
33
+ }, "strip", z.ZodTypeAny, {
34
+ type: "comment";
35
+ version: number;
36
+ range: {
37
+ start: number;
38
+ end: number;
39
+ };
40
+ text: string;
41
+ createdAt: string;
42
+ workflowId: string;
43
+ id: string;
44
+ category?: "voice-drift" | "missing-receipt" | "tutorial-framing" | "saas-vocabulary" | "fake-authority" | "structural" | "other" | undefined;
45
+ anchor?: string | undefined;
46
+ }, {
47
+ type: "comment";
48
+ version: number;
49
+ range: {
50
+ start: number;
51
+ end: number;
52
+ };
53
+ text: string;
54
+ createdAt: string;
55
+ workflowId: string;
56
+ id: string;
57
+ category?: "voice-drift" | "missing-receipt" | "tutorial-framing" | "saas-vocabulary" | "fake-authority" | "structural" | "other" | undefined;
58
+ anchor?: string | undefined;
59
+ }>, z.ZodObject<{
60
+ type: z.ZodLiteral<"edit">;
61
+ beforeVersion: z.ZodNumber;
62
+ afterMarkdown: z.ZodString;
63
+ diff: z.ZodString;
64
+ createdAt: z.ZodString;
65
+ workflowId: z.ZodString;
66
+ id: z.ZodString;
67
+ }, "strip", z.ZodTypeAny, {
68
+ type: "edit";
69
+ createdAt: string;
70
+ workflowId: string;
71
+ id: string;
72
+ beforeVersion: number;
73
+ afterMarkdown: string;
74
+ diff: string;
75
+ }, {
76
+ type: "edit";
77
+ createdAt: string;
78
+ workflowId: string;
79
+ id: string;
80
+ beforeVersion: number;
81
+ afterMarkdown: string;
82
+ diff: string;
83
+ }>, z.ZodObject<{
84
+ type: z.ZodLiteral<"approve">;
85
+ version: z.ZodNumber;
86
+ createdAt: z.ZodString;
87
+ workflowId: z.ZodString;
88
+ id: z.ZodString;
89
+ }, "strip", z.ZodTypeAny, {
90
+ type: "approve";
91
+ version: number;
92
+ createdAt: string;
93
+ workflowId: string;
94
+ id: string;
95
+ }, {
96
+ type: "approve";
97
+ version: number;
98
+ createdAt: string;
99
+ workflowId: string;
100
+ id: string;
101
+ }>, z.ZodObject<{
102
+ type: z.ZodLiteral<"reject">;
103
+ version: z.ZodNumber;
104
+ reason: z.ZodOptional<z.ZodString>;
105
+ createdAt: z.ZodString;
106
+ workflowId: z.ZodString;
107
+ id: z.ZodString;
108
+ }, "strip", z.ZodTypeAny, {
109
+ type: "reject";
110
+ version: number;
111
+ createdAt: string;
112
+ workflowId: string;
113
+ id: string;
114
+ reason?: string | undefined;
115
+ }, {
116
+ type: "reject";
117
+ version: number;
118
+ createdAt: string;
119
+ workflowId: string;
120
+ id: string;
121
+ reason?: string | undefined;
122
+ }>, z.ZodObject<{
123
+ type: z.ZodLiteral<"resolve">;
124
+ commentId: z.ZodString;
125
+ resolved: z.ZodBoolean;
126
+ createdAt: z.ZodString;
127
+ workflowId: z.ZodString;
128
+ id: z.ZodString;
129
+ }, "strip", z.ZodTypeAny, {
130
+ type: "resolve";
131
+ createdAt: string;
132
+ workflowId: string;
133
+ id: string;
134
+ commentId: string;
135
+ resolved: boolean;
136
+ }, {
137
+ type: "resolve";
138
+ createdAt: string;
139
+ workflowId: string;
140
+ id: string;
141
+ commentId: string;
142
+ resolved: boolean;
143
+ }>, z.ZodObject<{
144
+ type: z.ZodLiteral<"address">;
145
+ commentId: z.ZodString;
146
+ version: z.ZodNumber;
147
+ disposition: z.ZodEnum<["addressed", "deferred", "wontfix"]>;
148
+ reason: z.ZodOptional<z.ZodString>;
149
+ createdAt: z.ZodString;
150
+ workflowId: z.ZodString;
151
+ id: z.ZodString;
152
+ }, "strip", z.ZodTypeAny, {
153
+ type: "address";
154
+ version: number;
155
+ createdAt: string;
156
+ workflowId: string;
157
+ id: string;
158
+ commentId: string;
159
+ disposition: "addressed" | "deferred" | "wontfix";
160
+ reason?: string | undefined;
161
+ }, {
162
+ type: "address";
163
+ version: number;
164
+ createdAt: string;
165
+ workflowId: string;
166
+ id: string;
167
+ commentId: string;
168
+ disposition: "addressed" | "deferred" | "wontfix";
169
+ reason?: string | undefined;
170
+ }>]>;
171
+ //# sourceMappingURL=draft-annotation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"draft-annotation.d.ts","sourceRoot":"","sources":["../../src/schema/draft-annotation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AA4ExB,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAOhC,CAAC"}
@@ -0,0 +1,87 @@
1
+ /**
2
+ * Zod schema mirror of `DraftAnnotation` from `../review/types.ts`.
3
+ *
4
+ * The TS interface union in `review/types.ts` is the source of truth for
5
+ * the *shape*. This file provides a runtime validator for the same shape
6
+ * so journal events carrying a `DraftAnnotation` payload can be parsed
7
+ * via `JournalEventSchema.safeParse` at the read boundary.
8
+ *
9
+ * The union variants here mirror `CommentAnnotation | EditAnnotation |
10
+ * ApproveAnnotation | RejectAnnotation | ResolveAnnotation |
11
+ * AddressAnnotation`. If a new variant is added there, mirror it here.
12
+ */
13
+ import { z } from 'zod';
14
+ const AnnotationCategoryEnum = z.enum([
15
+ 'voice-drift',
16
+ 'missing-receipt',
17
+ 'tutorial-framing',
18
+ 'saas-vocabulary',
19
+ 'fake-authority',
20
+ 'structural',
21
+ 'other',
22
+ ]);
23
+ const RangeSchema = z.object({
24
+ start: z.number().int().nonnegative(),
25
+ end: z.number().int().nonnegative(),
26
+ });
27
+ const BaseFields = {
28
+ /** ISO-8601 timestamp when the annotation was recorded. */
29
+ createdAt: z.string().datetime(),
30
+ /** Workflow the annotation belongs to (legacy field; entry-keyed
31
+ * annotations still carry it for type compatibility with the
32
+ * workflow-keyed `DraftAnnotation` union, but the entry-store does
33
+ * not key off it). */
34
+ workflowId: z.string(),
35
+ /** Server-assigned id. */
36
+ id: z.string(),
37
+ };
38
+ const CommentAnnotation = z.object({
39
+ ...BaseFields,
40
+ type: z.literal('comment'),
41
+ version: z.number().int(),
42
+ range: RangeSchema,
43
+ text: z.string(),
44
+ category: AnnotationCategoryEnum.optional(),
45
+ anchor: z.string().optional(),
46
+ });
47
+ const EditAnnotation = z.object({
48
+ ...BaseFields,
49
+ type: z.literal('edit'),
50
+ beforeVersion: z.number().int(),
51
+ afterMarkdown: z.string(),
52
+ diff: z.string(),
53
+ });
54
+ const ApproveAnnotation = z.object({
55
+ ...BaseFields,
56
+ type: z.literal('approve'),
57
+ version: z.number().int(),
58
+ });
59
+ const RejectAnnotation = z.object({
60
+ ...BaseFields,
61
+ type: z.literal('reject'),
62
+ version: z.number().int(),
63
+ reason: z.string().optional(),
64
+ });
65
+ const ResolveAnnotation = z.object({
66
+ ...BaseFields,
67
+ type: z.literal('resolve'),
68
+ commentId: z.string(),
69
+ resolved: z.boolean(),
70
+ });
71
+ const AddressAnnotation = z.object({
72
+ ...BaseFields,
73
+ type: z.literal('address'),
74
+ commentId: z.string(),
75
+ version: z.number().int(),
76
+ disposition: z.enum(['addressed', 'deferred', 'wontfix']),
77
+ reason: z.string().optional(),
78
+ });
79
+ export const DraftAnnotationSchema = z.discriminatedUnion('type', [
80
+ CommentAnnotation,
81
+ EditAnnotation,
82
+ ApproveAnnotation,
83
+ RejectAnnotation,
84
+ ResolveAnnotation,
85
+ AddressAnnotation,
86
+ ]);
87
+ //# sourceMappingURL=draft-annotation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"draft-annotation.js","sourceRoot":"","sources":["../../src/schema/draft-annotation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,sBAAsB,GAAG,CAAC,CAAC,IAAI,CAAC;IACpC,aAAa;IACb,iBAAiB;IACjB,kBAAkB;IAClB,iBAAiB;IACjB,gBAAgB;IAChB,YAAY;IACZ,OAAO;CACR,CAAC,CAAC;AAEH,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3B,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE;IACrC,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE;CACpC,CAAC,CAAC;AAEH,MAAM,UAAU,GAAG;IACjB,2DAA2D;IAC3D,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAChC;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