@alterset/alterspec-client 0.19.0 → 0.22.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/work.d.ts CHANGED
@@ -3,7 +3,8 @@ import { z } from 'zod';
3
3
  /**
4
4
  * `work.json` in an export: the work every signed-off change implies, for an application that hands it to developers
5
5
  * (the alterspec dispatcher). The one definition of the format. It imports nothing but zod, so the alterspec client
6
- * can carry it as it is. Format 4 (alterspec 0.34.0) adds each change's optional `weight`; format 3 (0.33.0) adds each task's optional `weights`; format 2 (0.24.0) added
6
+ * can carry it as it is. Format 5 (alterspec 0.38.0) adds the words a person reads: each task's optional `title`,
7
+ * `summary` and `labels`, and the objects' `names`. Format 4 (alterspec 0.34.0) adds each change's optional `weight`; format 3 (0.33.0) adds each task's optional `weights`; format 2 (0.24.0) added
7
8
  * each task's `items`; format 1 is the same without them. A reader of every format takes `AnyWorkSchema`.
8
9
  */
9
10
  /** `BE` (the backend, API channels included) or the code of a channel with an experience of its own. */
@@ -15,6 +16,21 @@ type TrackCode = z.infer<typeof TrackCode>;
15
16
  */
16
17
  declare const WorkWeight: z.ZodNumber;
17
18
  type WorkWeight = z.infer<typeof WorkWeight>;
19
+ /** The longest title, summary and label (characters). */
20
+ declare const WORD_CAPS: {
21
+ readonly title: 100;
22
+ readonly summary: 400;
23
+ readonly label: 100;
24
+ readonly name: 100;
25
+ };
26
+ /** What a track builds in a change, for a list (format 5). */
27
+ declare const WorkTitle: z.ZodString;
28
+ /** The same in two or three plain sentences. */
29
+ declare const WorkSummary: z.ZodString;
30
+ /** What one checklist item is, apart from its siblings. */
31
+ declare const WorkLabel: z.ZodString;
32
+ /** An object's own title in the spec. */
33
+ declare const WorkName: z.ZodString;
18
34
  declare const WorkTrackSchema: z.ZodObject<{
19
35
  code: z.ZodString;
20
36
  kind: z.ZodEnum<{
@@ -33,6 +49,9 @@ declare const WorkTaskSchema: z.ZodObject<{
33
49
  track: z.ZodString;
34
50
  }, z.core.$strict>>;
35
51
  weights: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
52
+ title: z.ZodOptional<z.ZodString>;
53
+ summary: z.ZodOptional<z.ZodString>;
54
+ labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
36
55
  }, z.core.$strict>;
37
56
  type WorkTask = z.infer<typeof WorkTaskSchema>;
38
57
  declare const WorkChangeSchema: z.ZodObject<{
@@ -51,13 +70,16 @@ declare const WorkChangeSchema: z.ZodObject<{
51
70
  track: z.ZodString;
52
71
  }, z.core.$strict>>;
53
72
  weights: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
73
+ title: z.ZodOptional<z.ZodString>;
74
+ summary: z.ZodOptional<z.ZodString>;
75
+ labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
54
76
  }, z.core.$strict>>;
55
77
  weight: z.ZodOptional<z.ZodNumber>;
56
78
  }, z.core.$strict>;
57
79
  type WorkChange = z.infer<typeof WorkChangeSchema>;
58
- declare const WORK_FORMAT = 4;
80
+ declare const WORK_FORMAT = 5;
59
81
  declare const WorkSchema: z.ZodObject<{
60
- format: z.ZodLiteral<4>;
82
+ format: z.ZodLiteral<5>;
61
83
  alterspec: z.ZodString;
62
84
  exported: z.ZodISODate;
63
85
  baseline: z.ZodNullable<z.ZodObject<{
@@ -88,11 +110,84 @@ declare const WorkSchema: z.ZodObject<{
88
110
  track: z.ZodString;
89
111
  }, z.core.$strict>>;
90
112
  weights: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
113
+ title: z.ZodOptional<z.ZodString>;
114
+ summary: z.ZodOptional<z.ZodString>;
115
+ labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
91
116
  }, z.core.$strict>>;
92
117
  weight: z.ZodOptional<z.ZodNumber>;
93
118
  }, z.core.$strict>>;
119
+ names: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
94
120
  }, z.core.$strict>;
95
121
  type Work = z.infer<typeof WorkSchema>;
122
+ /** Format 4 (alterspec 0.34 to 0.37): the same without the tasks' `title`, `summary` and `labels` and without `names`. */
123
+ declare const WorkTaskV4Schema: z.ZodObject<{
124
+ track: z.ZodString;
125
+ objects: z.ZodArray<z.ZodString>;
126
+ items: z.ZodArray<z.ZodString>;
127
+ after: z.ZodArray<z.ZodObject<{
128
+ change: z.ZodString;
129
+ track: z.ZodString;
130
+ }, z.core.$strict>>;
131
+ weights: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
132
+ }, z.core.$strict>;
133
+ type WorkTaskV4 = z.infer<typeof WorkTaskV4Schema>;
134
+ declare const WorkChangeV4Schema: z.ZodObject<{
135
+ id: z.ZodString;
136
+ title: z.ZodString;
137
+ signed_off: z.ZodISODate;
138
+ delta: z.ZodString;
139
+ depends_on: z.ZodArray<z.ZodString>;
140
+ level: z.ZodNumber;
141
+ weight: z.ZodOptional<z.ZodNumber>;
142
+ tasks: z.ZodArray<z.ZodObject<{
143
+ track: z.ZodString;
144
+ objects: z.ZodArray<z.ZodString>;
145
+ items: z.ZodArray<z.ZodString>;
146
+ after: z.ZodArray<z.ZodObject<{
147
+ change: z.ZodString;
148
+ track: z.ZodString;
149
+ }, z.core.$strict>>;
150
+ weights: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
151
+ }, z.core.$strict>>;
152
+ }, z.core.$strict>;
153
+ type WorkChangeV4 = z.infer<typeof WorkChangeV4Schema>;
154
+ declare const WorkV4Schema: z.ZodObject<{
155
+ exported: z.ZodISODate;
156
+ alterspec: z.ZodString;
157
+ baseline: z.ZodNullable<z.ZodObject<{
158
+ date: z.ZodISODate;
159
+ built: z.ZodBoolean;
160
+ }, z.core.$strict>>;
161
+ tracks: z.ZodArray<z.ZodObject<{
162
+ code: z.ZodString;
163
+ kind: z.ZodEnum<{
164
+ backend: "backend";
165
+ ui: "ui";
166
+ }>;
167
+ channels: z.ZodArray<z.ZodString>;
168
+ }, z.core.$strict>>;
169
+ format: z.ZodLiteral<4>;
170
+ changes: z.ZodArray<z.ZodObject<{
171
+ id: z.ZodString;
172
+ title: z.ZodString;
173
+ signed_off: z.ZodISODate;
174
+ delta: z.ZodString;
175
+ depends_on: z.ZodArray<z.ZodString>;
176
+ level: z.ZodNumber;
177
+ weight: z.ZodOptional<z.ZodNumber>;
178
+ tasks: z.ZodArray<z.ZodObject<{
179
+ track: z.ZodString;
180
+ objects: z.ZodArray<z.ZodString>;
181
+ items: z.ZodArray<z.ZodString>;
182
+ after: z.ZodArray<z.ZodObject<{
183
+ change: z.ZodString;
184
+ track: z.ZodString;
185
+ }, z.core.$strict>>;
186
+ weights: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
187
+ }, z.core.$strict>>;
188
+ }, z.core.$strict>>;
189
+ }, z.core.$strict>;
190
+ type WorkV4 = z.infer<typeof WorkV4Schema>;
96
191
  /** Format 3 (alterspec 0.33): the same without the change's `weight`. */
97
192
  declare const WorkChangeV3Schema: z.ZodObject<{
98
193
  id: z.ZodString;
@@ -114,8 +209,8 @@ declare const WorkChangeV3Schema: z.ZodObject<{
114
209
  }, z.core.$strict>;
115
210
  type WorkChangeV3 = z.infer<typeof WorkChangeV3Schema>;
116
211
  declare const WorkV3Schema: z.ZodObject<{
117
- alterspec: z.ZodString;
118
212
  exported: z.ZodISODate;
213
+ alterspec: z.ZodString;
119
214
  baseline: z.ZodNullable<z.ZodObject<{
120
215
  date: z.ZodISODate;
121
216
  built: z.ZodBoolean;
@@ -161,8 +256,8 @@ declare const WorkTaskV2Schema: z.ZodObject<{
161
256
  }, z.core.$strict>;
162
257
  type WorkTaskV2 = z.infer<typeof WorkTaskV2Schema>;
163
258
  declare const WorkV2Schema: z.ZodObject<{
164
- alterspec: z.ZodString;
165
259
  exported: z.ZodISODate;
260
+ alterspec: z.ZodString;
166
261
  baseline: z.ZodNullable<z.ZodObject<{
167
262
  date: z.ZodISODate;
168
263
  built: z.ZodBoolean;
@@ -206,8 +301,8 @@ declare const WorkTaskV1Schema: z.ZodObject<{
206
301
  }, z.core.$strict>;
207
302
  type WorkTaskV1 = z.infer<typeof WorkTaskV1Schema>;
208
303
  declare const WorkV1Schema: z.ZodObject<{
209
- alterspec: z.ZodString;
210
304
  exported: z.ZodISODate;
305
+ alterspec: z.ZodString;
211
306
  baseline: z.ZodNullable<z.ZodObject<{
212
307
  date: z.ZodISODate;
213
308
  built: z.ZodBoolean;
@@ -241,8 +336,8 @@ declare const WorkV1Schema: z.ZodObject<{
241
336
  type WorkV1 = z.infer<typeof WorkV1Schema>;
242
337
  /** Any format, told apart by `format`: what a reader of exports from several alterspec versions takes. */
243
338
  declare const AnyWorkSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
244
- alterspec: z.ZodString;
245
339
  exported: z.ZodISODate;
340
+ alterspec: z.ZodString;
246
341
  baseline: z.ZodNullable<z.ZodObject<{
247
342
  date: z.ZodISODate;
248
343
  built: z.ZodBoolean;
@@ -273,8 +368,8 @@ declare const AnyWorkSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
273
368
  }, z.core.$strict>>;
274
369
  }, z.core.$strict>>;
275
370
  }, z.core.$strict>, z.ZodObject<{
276
- alterspec: z.ZodString;
277
371
  exported: z.ZodISODate;
372
+ alterspec: z.ZodString;
278
373
  baseline: z.ZodNullable<z.ZodObject<{
279
374
  date: z.ZodISODate;
280
375
  built: z.ZodBoolean;
@@ -306,8 +401,8 @@ declare const AnyWorkSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
306
401
  }, z.core.$strict>>;
307
402
  }, z.core.$strict>>;
308
403
  }, z.core.$strict>, z.ZodObject<{
309
- alterspec: z.ZodString;
310
404
  exported: z.ZodISODate;
405
+ alterspec: z.ZodString;
311
406
  baseline: z.ZodNullable<z.ZodObject<{
312
407
  date: z.ZodISODate;
313
408
  built: z.ZodBoolean;
@@ -340,7 +435,42 @@ declare const AnyWorkSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
340
435
  }, z.core.$strict>>;
341
436
  }, z.core.$strict>>;
342
437
  }, z.core.$strict>, z.ZodObject<{
438
+ exported: z.ZodISODate;
439
+ alterspec: z.ZodString;
440
+ baseline: z.ZodNullable<z.ZodObject<{
441
+ date: z.ZodISODate;
442
+ built: z.ZodBoolean;
443
+ }, z.core.$strict>>;
444
+ tracks: z.ZodArray<z.ZodObject<{
445
+ code: z.ZodString;
446
+ kind: z.ZodEnum<{
447
+ backend: "backend";
448
+ ui: "ui";
449
+ }>;
450
+ channels: z.ZodArray<z.ZodString>;
451
+ }, z.core.$strict>>;
343
452
  format: z.ZodLiteral<4>;
453
+ changes: z.ZodArray<z.ZodObject<{
454
+ id: z.ZodString;
455
+ title: z.ZodString;
456
+ signed_off: z.ZodISODate;
457
+ delta: z.ZodString;
458
+ depends_on: z.ZodArray<z.ZodString>;
459
+ level: z.ZodNumber;
460
+ weight: z.ZodOptional<z.ZodNumber>;
461
+ tasks: z.ZodArray<z.ZodObject<{
462
+ track: z.ZodString;
463
+ objects: z.ZodArray<z.ZodString>;
464
+ items: z.ZodArray<z.ZodString>;
465
+ after: z.ZodArray<z.ZodObject<{
466
+ change: z.ZodString;
467
+ track: z.ZodString;
468
+ }, z.core.$strict>>;
469
+ weights: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
470
+ }, z.core.$strict>>;
471
+ }, z.core.$strict>>;
472
+ }, z.core.$strict>, z.ZodObject<{
473
+ format: z.ZodLiteral<5>;
344
474
  alterspec: z.ZodString;
345
475
  exported: z.ZodISODate;
346
476
  baseline: z.ZodNullable<z.ZodObject<{
@@ -371,9 +501,13 @@ declare const AnyWorkSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
371
501
  track: z.ZodString;
372
502
  }, z.core.$strict>>;
373
503
  weights: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
504
+ title: z.ZodOptional<z.ZodString>;
505
+ summary: z.ZodOptional<z.ZodString>;
506
+ labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
374
507
  }, z.core.$strict>>;
375
508
  weight: z.ZodOptional<z.ZodNumber>;
376
509
  }, z.core.$strict>>;
510
+ names: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
377
511
  }, z.core.$strict>], "format">;
378
512
  type AnyWork = z.infer<typeof AnyWorkSchema>;
379
513
 
@@ -383,11 +517,12 @@ declare class WorkError extends Error {
383
517
  constructor(message: string, issues?: z.core.$ZodIssue[]);
384
518
  }
385
519
  /**
386
- * Parses and validates the text of a `work.json` of format 1 to 4 (tell them apart by `format`; 2 to 4 have
387
- * `items`, 3 and 4 may carry `weights`, 4 a change's `weight`); throws a `WorkError` naming every field that is wrong.
520
+ * Parses and validates the text of a `work.json` of format 1 to 5 (tell them apart by `format`; from 2 on they have
521
+ * `items`, from 3 on they may carry `weights`, from 4 on a change's `weight`, and 5 the words a person reads: a
522
+ * task's `title`, `summary` and `labels`, and the objects' `names`); throws a `WorkError` naming every field that is wrong.
388
523
  */
389
524
  declare function parseWork(text: string): AnyWork;
390
525
  /** The JSON Schema of `work.json` (either format), as alterspec installs it in `.alterspec/schemas/work.json`. */
391
526
  declare function toWorkJsonSchema(): object;
392
527
 
393
- export { type AnyWork, AnyWorkSchema, TrackCode, WORK_FORMAT, type Work, type WorkChange, WorkChangeSchema, type WorkChangeV3, WorkChangeV3Schema, WorkError, WorkSchema, type WorkTask, WorkTaskSchema, type WorkTaskV1, WorkTaskV1Schema, type WorkTaskV2, WorkTaskV2Schema, type WorkTrack, WorkTrackSchema, type WorkV1, WorkV1Schema, type WorkV2, WorkV2Schema, type WorkV3, WorkV3Schema, WorkWeight, parseWork, toWorkJsonSchema };
528
+ export { type AnyWork, AnyWorkSchema, TrackCode, WORD_CAPS, WORK_FORMAT, type Work, type WorkChange, WorkChangeSchema, type WorkChangeV3, WorkChangeV3Schema, type WorkChangeV4, WorkChangeV4Schema, WorkError, WorkLabel, WorkName, WorkSchema, WorkSummary, type WorkTask, WorkTaskSchema, type WorkTaskV1, WorkTaskV1Schema, type WorkTaskV2, WorkTaskV2Schema, type WorkTaskV4, WorkTaskV4Schema, WorkTitle, type WorkTrack, WorkTrackSchema, type WorkV1, WorkV1Schema, type WorkV2, WorkV2Schema, type WorkV3, WorkV3Schema, type WorkV4, WorkV4Schema, WorkWeight, parseWork, toWorkJsonSchema };
package/dist/work.js CHANGED
@@ -5,6 +5,12 @@ import { z as z2 } from "zod";
5
5
  import { z } from "zod";
6
6
  var TrackCode = z.string().regex(/^[A-Z]{2,5}$/, { message: "must be BE or a channel code" });
7
7
  var WorkWeight = z.number().int().min(1).max(100);
8
+ var WORD_CAPS = { title: 100, summary: 400, label: 100, name: 100 };
9
+ var words = (max) => z.string().max(max, { message: `at most ${max} characters` }).regex(/^\S(?:[^\n\r]*\S)?$/, { message: "one line of text, without spaces around it" });
10
+ var WorkTitle = words(WORD_CAPS.title);
11
+ var WorkSummary = words(WORD_CAPS.summary);
12
+ var WorkLabel = words(WORD_CAPS.label);
13
+ var WorkName = words(WORD_CAPS.name);
8
14
  var ChangeRef = z.string().regex(/^CHG-\d{3,}$/);
9
15
  var Day = z.iso.date();
10
16
  var WorkTrackSchema = z.object({
@@ -36,7 +42,20 @@ var WorkTaskSchema = z.object({
36
42
  * An item the sign-off didn't weigh takes the median of the task's weighed items; a task of a change signed off
37
43
  * without weights has no `weights`, and a reader counts each of its items as 10. For weighing progress and ETA.
38
44
  */
39
- weights: z.record(z.string().min(1), WorkWeight).optional()
45
+ weights: z.record(z.string().min(1), WorkWeight).optional(),
46
+ /**
47
+ * What this track builds in this change, for a person reading a list (format 5): reasoned at the change's
48
+ * sign-off, in the product's words, naming no ID. Absent: the change was signed off without one.
49
+ */
50
+ title: WorkTitle.optional(),
51
+ /** The same in two or three plain sentences (format 5). */
52
+ summary: WorkSummary.optional(),
53
+ /**
54
+ * What each item is (format 5), by item, naming only the task's own items and not necessarily all: reasoned at
55
+ * sign-off where the spec has no word for the item (an acceptance criterion), composed at export from the spec
56
+ * where it has (a screen's action, a contract's state, a part of an object, a whole object). For reading only.
57
+ */
58
+ labels: z.record(z.string().min(1), WorkLabel).optional()
40
59
  }).strict();
41
60
  var WorkChangeSchema = z.object({
42
61
  id: ChangeRef,
@@ -57,7 +76,7 @@ var WorkChangeSchema = z.object({
57
76
  */
58
77
  weight: WorkWeight.optional()
59
78
  }).strict();
60
- var WORK_FORMAT = 4;
79
+ var WORK_FORMAT = 5;
61
80
  var WorkSchema = z.object({
62
81
  format: z.literal(WORK_FORMAT),
63
82
  /** The alterspec version that wrote the export. */
@@ -67,20 +86,28 @@ var WorkSchema = z.object({
67
86
  baseline: z.object({ date: Day, built: z.boolean() }).strict().nullable(),
68
87
  tracks: z.array(WorkTrackSchema),
69
88
  /** Every change signed off after the baseline, in the change map's order. */
70
- changes: z.array(WorkChangeSchema)
89
+ changes: z.array(WorkChangeSchema),
90
+ /**
91
+ * The title of every object a task's `objects` names, by key, as the spec holds it now (format 5); an object
92
+ * the spec no longer holds, and a file, has no entry. Absent when no object has one.
93
+ */
94
+ names: z.record(z.string().min(1), WorkName).optional()
71
95
  }).strict();
72
- var WorkChangeV3Schema = WorkChangeSchema.omit({ weight: true }).strict();
73
- var WorkV3Schema = WorkSchema.extend({
96
+ var WorkTaskV4Schema = WorkTaskSchema.omit({ title: true, summary: true, labels: true }).strict();
97
+ var WorkChangeV4Schema = WorkChangeSchema.extend({ tasks: z.array(WorkTaskV4Schema) }).strict();
98
+ var WorkV4Schema = WorkSchema.omit({ names: true }).extend({ format: z.literal(4), changes: z.array(WorkChangeV4Schema) }).strict();
99
+ var WorkChangeV3Schema = WorkChangeV4Schema.omit({ weight: true }).strict();
100
+ var WorkV3Schema = WorkV4Schema.extend({
74
101
  format: z.literal(3),
75
102
  changes: z.array(WorkChangeV3Schema)
76
103
  }).strict();
77
- var WorkTaskV2Schema = WorkTaskSchema.omit({ weights: true });
78
- var WorkV2Schema = WorkSchema.extend({
104
+ var WorkTaskV2Schema = WorkTaskV4Schema.omit({ weights: true });
105
+ var WorkV2Schema = WorkV4Schema.extend({
79
106
  format: z.literal(2),
80
107
  changes: z.array(WorkChangeV3Schema.extend({ tasks: z.array(WorkTaskV2Schema) }).strict())
81
108
  }).strict();
82
109
  var WorkTaskV1Schema = WorkTaskV2Schema.omit({ items: true });
83
- var WorkV1Schema = WorkSchema.extend({
110
+ var WorkV1Schema = WorkV4Schema.extend({
84
111
  format: z.literal(1),
85
112
  changes: z.array(WorkChangeV3Schema.extend({ tasks: z.array(WorkTaskV1Schema) }).strict())
86
113
  }).strict();
@@ -88,11 +115,12 @@ var AnyWorkSchema = z.discriminatedUnion("format", [
88
115
  WorkV1Schema,
89
116
  WorkV2Schema,
90
117
  WorkV3Schema,
118
+ WorkV4Schema,
91
119
  WorkSchema
92
120
  ]);
93
121
 
94
122
  // src/work.ts
95
- var FORMATS = [1, 2, 3, 4];
123
+ var FORMATS = [1, 2, 3, 4, 5];
96
124
  var WorkError = class extends Error {
97
125
  constructor(message, issues = []) {
98
126
  super(message);
@@ -131,18 +159,26 @@ function toWorkJsonSchema() {
131
159
  export {
132
160
  AnyWorkSchema,
133
161
  TrackCode,
162
+ WORD_CAPS,
134
163
  WORK_FORMAT,
135
164
  WorkChangeSchema,
136
165
  WorkChangeV3Schema,
166
+ WorkChangeV4Schema,
137
167
  WorkError,
168
+ WorkLabel,
169
+ WorkName,
138
170
  WorkSchema,
171
+ WorkSummary,
139
172
  WorkTaskSchema,
140
173
  WorkTaskV1Schema,
141
174
  WorkTaskV2Schema,
175
+ WorkTaskV4Schema,
176
+ WorkTitle,
142
177
  WorkTrackSchema,
143
178
  WorkV1Schema,
144
179
  WorkV2Schema,
145
180
  WorkV3Schema,
181
+ WorkV4Schema,
146
182
  WorkWeight,
147
183
  parseWork,
148
184
  toWorkJsonSchema
package/dist/work.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/work.ts","../../src/schemas/work.ts"],"sourcesContent":["import { z } from 'zod';\nimport { AnyWorkSchema, type AnyWork } from '../../src/schemas/work.js';\n\n/**\n * `@alterset/alterspec-client/work`: the format of `work.json` in an alterspec export, for the dispatcher and anyone\n * else who reads it. The schema is alterspec's own (`src/schemas/work.ts`), re-exported, never copied. Format 4 is\n * `WorkSchema`, format 3 `WorkV3Schema` (no change `weight`), format 2 `WorkV2Schema` (no `weights`), format 1\n * `WorkV1Schema` (no `items`); `parseWork` reads all.\n */\n\n/** The formats this client reads. */\nconst FORMATS = [1, 2, 3, 4];\nexport * from '../../src/schemas/work.js';\n\n/** A `work.json` that is not JSON or not the format; `issues` holds zod's issues when it is JSON. */\nexport class WorkError extends Error {\n constructor(\n message: string,\n readonly issues: z.core.$ZodIssue[] = [],\n ) {\n super(message);\n this.name = 'WorkError';\n }\n}\n\n/** `changes[3].delta`: the issue's path as one would write it in JavaScript. */\nfunction pathText(path: readonly PropertyKey[]): string {\n let out = '';\n for (const p of path) out += typeof p === 'number' ? `[${p}]` : `${out ? '.' : ''}${String(p)}`;\n return out || '(root)';\n}\n\n/**\n * Parses and validates the text of a `work.json` of format 1 to 4 (tell them apart by `format`; 2 to 4 have\n * `items`, 3 and 4 may carry `weights`, 4 a change's `weight`); throws a `WorkError` naming every field that is wrong.\n */\nexport function parseWork(text: string): AnyWork {\n let data: unknown;\n try {\n data = JSON.parse(text);\n } catch (e) {\n throw new WorkError(`work.json is not JSON: ${(e as Error).message}`);\n }\n const format = (data as { format?: unknown } | null)?.format;\n if (typeof format === 'number' && !FORMATS.includes(format)) {\n throw new WorkError(`work.json has format ${format}; this client knows formats ${FORMATS.join(', ')}`);\n }\n const r = AnyWorkSchema.safeParse(data);\n if (r.success) return r.data;\n const lines = r.error.issues.map((i) => ` ${pathText(i.path)}: ${i.message}`);\n throw new WorkError(`work.json is not valid:\\n${lines.join('\\n')}`, r.error.issues);\n}\n\n/** The JSON Schema of `work.json` (either format), as alterspec installs it in `.alterspec/schemas/work.json`. */\nexport function toWorkJsonSchema(): object {\n return {\n title: 'alterspec work',\n ...z.toJSONSchema(AnyWorkSchema, { io: 'input', unrepresentable: 'any' }),\n };\n}\n","import { z } from 'zod';\n\n/**\n * `work.json` in an export: the work every signed-off change implies, for an application that hands it to developers\n * (the alterspec dispatcher). The one definition of the format. It imports nothing but zod, so the alterspec client\n * can carry it as it is. Format 4 (alterspec 0.34.0) adds each change's optional `weight`; format 3 (0.33.0) adds each task's optional `weights`; format 2 (0.24.0) added\n * each task's `items`; format 1 is the same without them. A reader of every format takes `AnyWorkSchema`.\n */\n\n/** `BE` (the backend, API channels included) or the code of a channel with an experience of its own. */\nexport const TrackCode = z.string().regex(/^[A-Z]{2,5}$/, { message: 'must be BE or a channel code' });\nexport type TrackCode = z.infer<typeof TrackCode>;\n\n/**\n * The weight of a task item, 1–100: how much specified behaviour the item adds or changes, reasoned at sign-off\n * against alterspec's rubric (a typical acceptance criterion is about 10), never an estimate of anyone's code.\n */\nexport const WorkWeight = z.number().int().min(1).max(100);\nexport type WorkWeight = z.infer<typeof WorkWeight>;\n\nconst ChangeRef = z.string().regex(/^CHG-\\d{3,}$/);\nconst Day = z.iso.date();\n\nexport const WorkTrackSchema = z\n .object({\n code: TrackCode,\n kind: z.enum(['backend', 'ui']),\n /** The channel codes the track builds: the API channels for `BE`, the channels sharing the experience for a UI track. */\n channels: z.array(z.string()),\n })\n .strict();\nexport type WorkTrack = z.infer<typeof WorkTrackSchema>;\n\nexport const WorkTaskSchema = z\n .object({\n track: TrackCode,\n /** The keys of the objects in the change's delta that put it on the track. */\n objects: z.array(z.string()),\n /**\n * The task's checklist, derived from the delta: the acceptance criteria (`<CAP>-AC-NN`), screen actions\n * (`<SCR>.Ann`) and contract states (`<UX-SCR>#<state>`) the change adds or changes, and every other object as\n * its key; on `BE`, `<CHG>#data-change` when the proposal declares a one-time data change (alterspec 0.27.0).\n * Sorted, never empty.\n */\n items: z.array(z.string().min(1)).min(1),\n /**\n * The tasks this one waits for, resolved and reduced: the same change's `BE` task, and the track's tasks of the\n * changes it builds on that did the same work (an item of both, a line of a whole object this task edits again,\n * or an object this task names that entered the export with the earlier change).\n */\n after: z.array(z.object({ change: ChangeRef, track: TrackCode }).strict()),\n /**\n * The weight of each item (format 3): how much specified behaviour it adds or changes, 1–100, reasoned at the\n * change's sign-off against alterspec's rubric (a typical acceptance criterion about 10), never anyone's code.\n * An item the sign-off didn't weigh takes the median of the task's weighed items; a task of a change signed off\n * without weights has no `weights`, and a reader counts each of its items as 10. For weighing progress and ETA.\n */\n weights: z.record(z.string().min(1), WorkWeight).optional(),\n })\n .strict();\nexport type WorkTask = z.infer<typeof WorkTaskSchema>;\n\nexport const WorkChangeSchema = z\n .object({\n id: ChangeRef,\n title: z.string(),\n signed_off: Day,\n /** The hash of the change's `delta.json`; a signed-off change never changes. */\n delta: z.string().regex(/^[0-9a-f]{16}$/),\n depends_on: z.array(ChangeRef),\n /** The change map's level. */\n level: z.number().int().min(1),\n /** One per track the change is on; empty = no work. */\n tasks: z.array(WorkTaskSchema),\n /**\n * The size of the whole change, 1–100 (format 4): reasoned at sign-off against alterspec's change rubric (a\n * wording fix about 1–5, one capability's criteria 10–20, a new capability or flow 30–50, a new module or the\n * application's foundation 80–100), never a sum of the item weights and never anyone's code. Absent: the change\n * was signed off without one. For the lists; progress and ETA keep the item weights.\n */\n weight: WorkWeight.optional(),\n })\n .strict();\nexport type WorkChange = z.infer<typeof WorkChangeSchema>;\n\nexport const WORK_FORMAT = 4;\n\nexport const WorkSchema = z\n .object({\n format: z.literal(WORK_FORMAT),\n /** The alterspec version that wrote the export. */\n alterspec: z.string(),\n exported: Day,\n /** Everything signed off before the changes began; `built`: the product as it runs (a reverse-spec), no work. */\n baseline: z.object({ date: Day, built: z.boolean() }).strict().nullable(),\n tracks: z.array(WorkTrackSchema),\n /** Every change signed off after the baseline, in the change map's order. */\n changes: z.array(WorkChangeSchema),\n })\n .strict();\nexport type Work = z.infer<typeof WorkSchema>;\n\n/** Format 3 (alterspec 0.33): the same without the change's `weight`. */\nexport const WorkChangeV3Schema = WorkChangeSchema.omit({ weight: true }).strict();\nexport type WorkChangeV3 = z.infer<typeof WorkChangeV3Schema>;\n\nexport const WorkV3Schema = WorkSchema.extend({\n format: z.literal(3),\n changes: z.array(WorkChangeV3Schema),\n}).strict();\nexport type WorkV3 = z.infer<typeof WorkV3Schema>;\n\n/** Format 2 (alterspec 0.24 to 0.32): the same without `weights`. */\nexport const WorkTaskV2Schema = WorkTaskSchema.omit({ weights: true });\nexport type WorkTaskV2 = z.infer<typeof WorkTaskV2Schema>;\n\nexport const WorkV2Schema = WorkSchema.extend({\n format: z.literal(2),\n changes: z.array(WorkChangeV3Schema.extend({ tasks: z.array(WorkTaskV2Schema) }).strict()),\n}).strict();\nexport type WorkV2 = z.infer<typeof WorkV2Schema>;\n\n/** Format 1 (alterspec 0.23): the same without `items`, `weights` and the change's `weight`. */\nexport const WorkTaskV1Schema = WorkTaskV2Schema.omit({ items: true });\nexport type WorkTaskV1 = z.infer<typeof WorkTaskV1Schema>;\n\nexport const WorkV1Schema = WorkSchema.extend({\n format: z.literal(1),\n changes: z.array(WorkChangeV3Schema.extend({ tasks: z.array(WorkTaskV1Schema) }).strict()),\n}).strict();\nexport type WorkV1 = z.infer<typeof WorkV1Schema>;\n\n/** Any format, told apart by `format`: what a reader of exports from several alterspec versions takes. */\nexport const AnyWorkSchema = z.discriminatedUnion('format', [\n WorkV1Schema,\n WorkV2Schema,\n WorkV3Schema,\n WorkSchema,\n]);\nexport type AnyWork = z.infer<typeof AnyWorkSchema>;\n"],"mappings":";AAAA,SAAS,KAAAA,UAAS;;;ACAlB,SAAS,SAAS;AAUX,IAAM,YAAY,EAAE,OAAO,EAAE,MAAM,gBAAgB,EAAE,SAAS,+BAA+B,CAAC;AAO9F,IAAM,aAAa,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,EAAE,IAAI,GAAG;AAGzD,IAAM,YAAY,EAAE,OAAO,EAAE,MAAM,cAAc;AACjD,IAAM,MAAM,EAAE,IAAI,KAAK;AAEhB,IAAM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,MAAI,MAAM;AACV,aAAW,KAAK,KAAM,QAAO,OAAO,MAAM,WAAW,IAAI,CAAC,MAAM,GAAG,MAAM,MAAM,EAAE,GAAG,OAAO,CAAC,CAAC;AAC7F,SAAO,OAAO;AAChB;AAMO,SAAS,UAAU,MAAuB;AAC/C,MAAI;AACJ,MAAI;AACF,WAAO,KAAK,MAAM,IAAI;AAAA,EACxB,SAAS,GAAG;AACV,UAAM,IAAI,UAAU,0BAA2B,EAAY,OAAO,EAAE;AAAA,EACtE;AACA,QAAM,SAAU,MAAsC;AACtD,MAAI,OAAO,WAAW,YAAY,CAAC,QAAQ,SAAS,MAAM,GAAG;AAC3D,UAAM,IAAI,UAAU,wBAAwB,MAAM,+BAA+B,QAAQ,KAAK,IAAI,CAAC,EAAE;AAAA,EACvG;AACA,QAAM,IAAI,cAAc,UAAU,IAAI;AACtC,MAAI,EAAE,QAAS,QAAO,EAAE;AACxB,QAAM,QAAQ,EAAE,MAAM,OAAO,IAAI,CAAC,MAAM,KAAK,SAAS,EAAE,IAAI,CAAC,KAAK,EAAE,OAAO,EAAE;AAC7E,QAAM,IAAI,UAAU;AAAA,EAA4B,MAAM,KAAK,IAAI,CAAC,IAAI,EAAE,MAAM,MAAM;AACpF;AAGO,SAAS,mBAA2B;AACzC,SAAO;AAAA,IACL,OAAO;AAAA,IACP,GAAGC,GAAE,aAAa,eAAe,EAAE,IAAI,SAAS,iBAAiB,MAAM,CAAC;AAAA,EAC1E;AACF;","names":["z","z"]}
1
+ {"version":3,"sources":["../src/work.ts","../../src/schemas/work.ts"],"sourcesContent":["import { z } from 'zod';\nimport { AnyWorkSchema, type AnyWork } from '../../src/schemas/work.js';\n\n/**\n * `@alterset/alterspec-client/work`: the format of `work.json` in an alterspec export, for the dispatcher and anyone\n * else who reads it. The schema is alterspec's own (`src/schemas/work.ts`), re-exported, never copied. Format 5 is\n * `WorkSchema`, format 4 `WorkV4Schema` (no titles, summaries, labels or names), format 3 `WorkV3Schema` (no change `weight`), format 2 `WorkV2Schema` (no `weights`), format 1\n * `WorkV1Schema` (no `items`); `parseWork` reads all.\n */\n\n/** The formats this client reads. */\nconst FORMATS = [1, 2, 3, 4, 5];\nexport * from '../../src/schemas/work.js';\n\n/** A `work.json` that is not JSON or not the format; `issues` holds zod's issues when it is JSON. */\nexport class WorkError extends Error {\n constructor(\n message: string,\n readonly issues: z.core.$ZodIssue[] = [],\n ) {\n super(message);\n this.name = 'WorkError';\n }\n}\n\n/** `changes[3].delta`: the issue's path as one would write it in JavaScript. */\nfunction pathText(path: readonly PropertyKey[]): string {\n let out = '';\n for (const p of path) out += typeof p === 'number' ? `[${p}]` : `${out ? '.' : ''}${String(p)}`;\n return out || '(root)';\n}\n\n/**\n * Parses and validates the text of a `work.json` of format 1 to 5 (tell them apart by `format`; from 2 on they have\n * `items`, from 3 on they may carry `weights`, from 4 on a change's `weight`, and 5 the words a person reads: a\n * task's `title`, `summary` and `labels`, and the objects' `names`); throws a `WorkError` naming every field that is wrong.\n */\nexport function parseWork(text: string): AnyWork {\n let data: unknown;\n try {\n data = JSON.parse(text);\n } catch (e) {\n throw new WorkError(`work.json is not JSON: ${(e as Error).message}`);\n }\n const format = (data as { format?: unknown } | null)?.format;\n if (typeof format === 'number' && !FORMATS.includes(format)) {\n throw new WorkError(`work.json has format ${format}; this client knows formats ${FORMATS.join(', ')}`);\n }\n const r = AnyWorkSchema.safeParse(data);\n if (r.success) return r.data;\n const lines = r.error.issues.map((i) => ` ${pathText(i.path)}: ${i.message}`);\n throw new WorkError(`work.json is not valid:\\n${lines.join('\\n')}`, r.error.issues);\n}\n\n/** The JSON Schema of `work.json` (either format), as alterspec installs it in `.alterspec/schemas/work.json`. */\nexport function toWorkJsonSchema(): object {\n return {\n title: 'alterspec work',\n ...z.toJSONSchema(AnyWorkSchema, { io: 'input', unrepresentable: 'any' }),\n };\n}\n","import { z } from 'zod';\n\n/**\n * `work.json` in an export: the work every signed-off change implies, for an application that hands it to developers\n * (the alterspec dispatcher). The one definition of the format. It imports nothing but zod, so the alterspec client\n * can carry it as it is. Format 5 (alterspec 0.38.0) adds the words a person reads: each task's optional `title`,\n * `summary` and `labels`, and the objects' `names`. Format 4 (alterspec 0.34.0) adds each change's optional `weight`; format 3 (0.33.0) adds each task's optional `weights`; format 2 (0.24.0) added\n * each task's `items`; format 1 is the same without them. A reader of every format takes `AnyWorkSchema`.\n */\n\n/** `BE` (the backend, API channels included) or the code of a channel with an experience of its own. */\nexport const TrackCode = z.string().regex(/^[A-Z]{2,5}$/, { message: 'must be BE or a channel code' });\nexport type TrackCode = z.infer<typeof TrackCode>;\n\n/**\n * The weight of a task item, 1–100: how much specified behaviour the item adds or changes, reasoned at sign-off\n * against alterspec's rubric (a typical acceptance criterion is about 10), never an estimate of anyone's code.\n */\nexport const WorkWeight = z.number().int().min(1).max(100);\nexport type WorkWeight = z.infer<typeof WorkWeight>;\n\n/** The longest title, summary and label (characters). */\nexport const WORD_CAPS = { title: 100, summary: 400, label: 100, name: 100 } as const;\n\n/** A word a person reads: plain text of one line, trimmed, never empty, at most `max` characters. */\nconst words = (max: number) =>\n z\n .string()\n .max(max, { message: `at most ${max} characters` })\n .regex(/^\\S(?:[^\\n\\r]*\\S)?$/, { message: 'one line of text, without spaces around it' });\n\n/** What a track builds in a change, for a list (format 5). */\nexport const WorkTitle = words(WORD_CAPS.title);\n/** The same in two or three plain sentences. */\nexport const WorkSummary = words(WORD_CAPS.summary);\n/** What one checklist item is, apart from its siblings. */\nexport const WorkLabel = words(WORD_CAPS.label);\n/** An object's own title in the spec. */\nexport const WorkName = words(WORD_CAPS.name);\n\nconst ChangeRef = z.string().regex(/^CHG-\\d{3,}$/);\nconst Day = z.iso.date();\n\nexport const WorkTrackSchema = z\n .object({\n code: TrackCode,\n kind: z.enum(['backend', 'ui']),\n /** The channel codes the track builds: the API channels for `BE`, the channels sharing the experience for a UI track. */\n channels: z.array(z.string()),\n })\n .strict();\nexport type WorkTrack = z.infer<typeof WorkTrackSchema>;\n\nexport const WorkTaskSchema = z\n .object({\n track: TrackCode,\n /** The keys of the objects in the change's delta that put it on the track. */\n objects: z.array(z.string()),\n /**\n * The task's checklist, derived from the delta: the acceptance criteria (`<CAP>-AC-NN`), screen actions\n * (`<SCR>.Ann`) and contract states (`<UX-SCR>#<state>`) the change adds or changes, and every other object as\n * its key; on `BE`, `<CHG>#data-change` when the proposal declares a one-time data change (alterspec 0.27.0).\n * Sorted, never empty.\n */\n items: z.array(z.string().min(1)).min(1),\n /**\n * The tasks this one waits for, resolved and reduced: the same change's `BE` task, and the track's tasks of the\n * changes it builds on that did the same work (an item of both, a line of a whole object this task edits again,\n * or an object this task names that entered the export with the earlier change).\n */\n after: z.array(z.object({ change: ChangeRef, track: TrackCode }).strict()),\n /**\n * The weight of each item (format 3): how much specified behaviour it adds or changes, 1–100, reasoned at the\n * change's sign-off against alterspec's rubric (a typical acceptance criterion about 10), never anyone's code.\n * An item the sign-off didn't weigh takes the median of the task's weighed items; a task of a change signed off\n * without weights has no `weights`, and a reader counts each of its items as 10. For weighing progress and ETA.\n */\n weights: z.record(z.string().min(1), WorkWeight).optional(),\n /**\n * What this track builds in this change, for a person reading a list (format 5): reasoned at the change's\n * sign-off, in the product's words, naming no ID. Absent: the change was signed off without one.\n */\n title: WorkTitle.optional(),\n /** The same in two or three plain sentences (format 5). */\n summary: WorkSummary.optional(),\n /**\n * What each item is (format 5), by item, naming only the task's own items and not necessarily all: reasoned at\n * sign-off where the spec has no word for the item (an acceptance criterion), composed at export from the spec\n * where it has (a screen's action, a contract's state, a part of an object, a whole object). For reading only.\n */\n labels: z.record(z.string().min(1), WorkLabel).optional(),\n })\n .strict();\nexport type WorkTask = z.infer<typeof WorkTaskSchema>;\n\nexport const WorkChangeSchema = z\n .object({\n id: ChangeRef,\n title: z.string(),\n signed_off: Day,\n /** The hash of the change's `delta.json`; a signed-off change never changes. */\n delta: z.string().regex(/^[0-9a-f]{16}$/),\n depends_on: z.array(ChangeRef),\n /** The change map's level. */\n level: z.number().int().min(1),\n /** One per track the change is on; empty = no work. */\n tasks: z.array(WorkTaskSchema),\n /**\n * The size of the whole change, 1–100 (format 4): reasoned at sign-off against alterspec's change rubric (a\n * wording fix about 1–5, one capability's criteria 10–20, a new capability or flow 30–50, a new module or the\n * application's foundation 80–100), never a sum of the item weights and never anyone's code. Absent: the change\n * was signed off without one. For the lists; progress and ETA keep the item weights.\n */\n weight: WorkWeight.optional(),\n })\n .strict();\nexport type WorkChange = z.infer<typeof WorkChangeSchema>;\n\nexport const WORK_FORMAT = 5;\n\nexport const WorkSchema = z\n .object({\n format: z.literal(WORK_FORMAT),\n /** The alterspec version that wrote the export. */\n alterspec: z.string(),\n exported: Day,\n /** Everything signed off before the changes began; `built`: the product as it runs (a reverse-spec), no work. */\n baseline: z.object({ date: Day, built: z.boolean() }).strict().nullable(),\n tracks: z.array(WorkTrackSchema),\n /** Every change signed off after the baseline, in the change map's order. */\n changes: z.array(WorkChangeSchema),\n /**\n * The title of every object a task's `objects` names, by key, as the spec holds it now (format 5); an object\n * the spec no longer holds, and a file, has no entry. Absent when no object has one.\n */\n names: z.record(z.string().min(1), WorkName).optional(),\n })\n .strict();\nexport type Work = z.infer<typeof WorkSchema>;\n\n/** Format 4 (alterspec 0.34 to 0.37): the same without the tasks' `title`, `summary` and `labels` and without `names`. */\nexport const WorkTaskV4Schema = WorkTaskSchema.omit({ title: true, summary: true, labels: true }).strict();\nexport type WorkTaskV4 = z.infer<typeof WorkTaskV4Schema>;\n\nexport const WorkChangeV4Schema = WorkChangeSchema.extend({ tasks: z.array(WorkTaskV4Schema) }).strict();\nexport type WorkChangeV4 = z.infer<typeof WorkChangeV4Schema>;\n\nexport const WorkV4Schema = WorkSchema.omit({ names: true })\n .extend({ format: z.literal(4), changes: z.array(WorkChangeV4Schema) })\n .strict();\nexport type WorkV4 = z.infer<typeof WorkV4Schema>;\n\n/** Format 3 (alterspec 0.33): the same without the change's `weight`. */\nexport const WorkChangeV3Schema = WorkChangeV4Schema.omit({ weight: true }).strict();\nexport type WorkChangeV3 = z.infer<typeof WorkChangeV3Schema>;\n\nexport const WorkV3Schema = WorkV4Schema.extend({\n format: z.literal(3),\n changes: z.array(WorkChangeV3Schema),\n}).strict();\nexport type WorkV3 = z.infer<typeof WorkV3Schema>;\n\n/** Format 2 (alterspec 0.24 to 0.32): the same without `weights`. */\nexport const WorkTaskV2Schema = WorkTaskV4Schema.omit({ weights: true });\nexport type WorkTaskV2 = z.infer<typeof WorkTaskV2Schema>;\n\nexport const WorkV2Schema = WorkV4Schema.extend({\n format: z.literal(2),\n changes: z.array(WorkChangeV3Schema.extend({ tasks: z.array(WorkTaskV2Schema) }).strict()),\n}).strict();\nexport type WorkV2 = z.infer<typeof WorkV2Schema>;\n\n/** Format 1 (alterspec 0.23): the same without `items`, `weights` and the change's `weight`. */\nexport const WorkTaskV1Schema = WorkTaskV2Schema.omit({ items: true });\nexport type WorkTaskV1 = z.infer<typeof WorkTaskV1Schema>;\n\nexport const WorkV1Schema = WorkV4Schema.extend({\n format: z.literal(1),\n changes: z.array(WorkChangeV3Schema.extend({ tasks: z.array(WorkTaskV1Schema) }).strict()),\n}).strict();\nexport type WorkV1 = z.infer<typeof WorkV1Schema>;\n\n/** Any format, told apart by `format`: what a reader of exports from several alterspec versions takes. */\nexport const AnyWorkSchema = z.discriminatedUnion('format', [\n WorkV1Schema,\n WorkV2Schema,\n WorkV3Schema,\n WorkV4Schema,\n WorkSchema,\n]);\nexport type AnyWork = z.infer<typeof AnyWorkSchema>;\n"],"mappings":";AAAA,SAAS,KAAAA,UAAS;;;ACAlB,SAAS,SAAS;AAWX,IAAM,YAAY,EAAE,OAAO,EAAE,MAAM,gBAAgB,EAAE,SAAS,+BAA+B,CAAC;AAO9F,IAAM,aAAa,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,EAAE,IAAI,GAAG;AAIlD,IAAM,YAAY,EAAE,OAAO,KAAK,SAAS,KAAK,OAAO,KAAK,MAAM,IAAI;AAG3E,IAAM,QAAQ,CA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