@alterset/alterspec-client 0.24.0 → 0.26.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 7 (alterspec 0.42.0) gives each task its own optional `weight` and drops the
6
+ * can carry it as it is. Format 8 (alterspec 0.43.0) names each change's optional `initiative` and carries the
7
+ * `initiatives` they name (the envelope around a group of changes: why they exist; no status). Format 7 (alterspec 0.42.0) gives each task its own optional `weight` and drops the
7
8
  * change's. Format 6 (alterspec 0.41.0) weighs each item per track and allows 0 (nothing to build
8
9
  * on that track). Format 5 (alterspec 0.38.0) adds the words a person reads: each task's optional `title`,
9
10
  * `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
@@ -86,11 +87,18 @@ declare const WorkChangeSchema: z.ZodObject<{
86
87
  summary: z.ZodOptional<z.ZodString>;
87
88
  labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
88
89
  }, z.core.$strict>>;
90
+ initiative: z.ZodOptional<z.ZodString>;
89
91
  }, z.core.$strict>;
90
92
  type WorkChange = z.infer<typeof WorkChangeSchema>;
91
- declare const WORK_FORMAT = 7;
93
+ /** An initiative a change names (format 8): its prose is `initiatives/<id>.md` in the export. */
94
+ declare const WorkInitiativeSchema: z.ZodObject<{
95
+ id: z.ZodString;
96
+ title: z.ZodString;
97
+ }, z.core.$strict>;
98
+ type WorkInitiative = z.infer<typeof WorkInitiativeSchema>;
99
+ declare const WORK_FORMAT = 8;
92
100
  declare const WorkSchema: z.ZodObject<{
93
- format: z.ZodLiteral<7>;
101
+ format: z.ZodLiteral<8>;
94
102
  alterspec: z.ZodString;
95
103
  exported: z.ZodISODate;
96
104
  baseline: z.ZodNullable<z.ZodObject<{
@@ -126,10 +134,80 @@ declare const WorkSchema: z.ZodObject<{
126
134
  summary: z.ZodOptional<z.ZodString>;
127
135
  labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
128
136
  }, z.core.$strict>>;
137
+ initiative: z.ZodOptional<z.ZodString>;
129
138
  }, z.core.$strict>>;
130
139
  names: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
140
+ initiatives: z.ZodOptional<z.ZodArray<z.ZodObject<{
141
+ id: z.ZodString;
142
+ title: z.ZodString;
143
+ }, z.core.$strict>>>;
131
144
  }, z.core.$strict>;
132
145
  type Work = z.infer<typeof WorkSchema>;
146
+ /** Format 7 (alterspec 0.42): the same without the change's `initiative` and without `initiatives`. */
147
+ declare const WorkChangeV7Schema: z.ZodObject<{
148
+ id: z.ZodString;
149
+ signed_off: z.ZodISODate;
150
+ title: z.ZodString;
151
+ delta: z.ZodString;
152
+ depends_on: z.ZodArray<z.ZodString>;
153
+ level: z.ZodNumber;
154
+ tasks: z.ZodArray<z.ZodObject<{
155
+ track: z.ZodString;
156
+ objects: z.ZodArray<z.ZodString>;
157
+ items: z.ZodArray<z.ZodString>;
158
+ after: z.ZodArray<z.ZodObject<{
159
+ change: z.ZodString;
160
+ track: z.ZodString;
161
+ }, z.core.$strict>>;
162
+ weights: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
163
+ weight: z.ZodOptional<z.ZodNumber>;
164
+ title: z.ZodOptional<z.ZodString>;
165
+ summary: z.ZodOptional<z.ZodString>;
166
+ labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
167
+ }, z.core.$strict>>;
168
+ }, z.core.$strict>;
169
+ type WorkChangeV7 = z.infer<typeof WorkChangeV7Schema>;
170
+ declare const WorkV7Schema: z.ZodObject<{
171
+ exported: z.ZodISODate;
172
+ alterspec: z.ZodString;
173
+ baseline: z.ZodNullable<z.ZodObject<{
174
+ date: z.ZodISODate;
175
+ built: z.ZodBoolean;
176
+ }, z.core.$strict>>;
177
+ tracks: z.ZodArray<z.ZodObject<{
178
+ code: z.ZodString;
179
+ kind: z.ZodEnum<{
180
+ backend: "backend";
181
+ ui: "ui";
182
+ }>;
183
+ channels: z.ZodArray<z.ZodString>;
184
+ }, z.core.$strict>>;
185
+ names: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
186
+ format: z.ZodLiteral<7>;
187
+ changes: z.ZodArray<z.ZodObject<{
188
+ id: z.ZodString;
189
+ signed_off: z.ZodISODate;
190
+ title: z.ZodString;
191
+ delta: z.ZodString;
192
+ depends_on: z.ZodArray<z.ZodString>;
193
+ level: z.ZodNumber;
194
+ tasks: z.ZodArray<z.ZodObject<{
195
+ track: z.ZodString;
196
+ objects: z.ZodArray<z.ZodString>;
197
+ items: z.ZodArray<z.ZodString>;
198
+ after: z.ZodArray<z.ZodObject<{
199
+ change: z.ZodString;
200
+ track: z.ZodString;
201
+ }, z.core.$strict>>;
202
+ weights: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
203
+ weight: z.ZodOptional<z.ZodNumber>;
204
+ title: z.ZodOptional<z.ZodString>;
205
+ summary: z.ZodOptional<z.ZodString>;
206
+ labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
207
+ }, z.core.$strict>>;
208
+ }, z.core.$strict>>;
209
+ }, z.core.$strict>;
210
+ type WorkV7 = z.infer<typeof WorkV7Schema>;
133
211
  /**
134
212
  * Format 6 (alterspec 0.41): the same without the task's `weight`, with the size of the whole change, 1–100, as
135
213
  * the change's optional `weight`.
@@ -150,8 +228,8 @@ declare const WorkTaskV6Schema: z.ZodObject<{
150
228
  type WorkTaskV6 = z.infer<typeof WorkTaskV6Schema>;
151
229
  declare const WorkChangeV6Schema: z.ZodObject<{
152
230
  id: z.ZodString;
153
- title: z.ZodString;
154
231
  signed_off: z.ZodISODate;
232
+ title: z.ZodString;
155
233
  delta: z.ZodString;
156
234
  depends_on: z.ZodArray<z.ZodString>;
157
235
  level: z.ZodNumber;
@@ -172,8 +250,8 @@ declare const WorkChangeV6Schema: z.ZodObject<{
172
250
  }, z.core.$strict>;
173
251
  type WorkChangeV6 = z.infer<typeof WorkChangeV6Schema>;
174
252
  declare const WorkV6Schema: z.ZodObject<{
175
- alterspec: z.ZodString;
176
253
  exported: z.ZodISODate;
254
+ alterspec: z.ZodString;
177
255
  baseline: z.ZodNullable<z.ZodObject<{
178
256
  date: z.ZodISODate;
179
257
  built: z.ZodBoolean;
@@ -190,8 +268,8 @@ declare const WorkV6Schema: z.ZodObject<{
190
268
  format: z.ZodLiteral<6>;
191
269
  changes: z.ZodArray<z.ZodObject<{
192
270
  id: z.ZodString;
193
- title: z.ZodString;
194
271
  signed_off: z.ZodISODate;
272
+ title: z.ZodString;
195
273
  delta: z.ZodString;
196
274
  depends_on: z.ZodArray<z.ZodString>;
197
275
  level: z.ZodNumber;
@@ -229,8 +307,8 @@ declare const WorkTaskV5Schema: z.ZodObject<{
229
307
  type WorkTaskV5 = z.infer<typeof WorkTaskV5Schema>;
230
308
  declare const WorkChangeV5Schema: z.ZodObject<{
231
309
  id: z.ZodString;
232
- title: z.ZodString;
233
310
  signed_off: z.ZodISODate;
311
+ title: z.ZodString;
234
312
  delta: z.ZodString;
235
313
  depends_on: z.ZodArray<z.ZodString>;
236
314
  level: z.ZodNumber;
@@ -251,8 +329,8 @@ declare const WorkChangeV5Schema: z.ZodObject<{
251
329
  }, z.core.$strict>;
252
330
  type WorkChangeV5 = z.infer<typeof WorkChangeV5Schema>;
253
331
  declare const WorkV5Schema: z.ZodObject<{
254
- alterspec: z.ZodString;
255
332
  exported: z.ZodISODate;
333
+ alterspec: z.ZodString;
256
334
  baseline: z.ZodNullable<z.ZodObject<{
257
335
  date: z.ZodISODate;
258
336
  built: z.ZodBoolean;
@@ -269,8 +347,8 @@ declare const WorkV5Schema: z.ZodObject<{
269
347
  format: z.ZodLiteral<5>;
270
348
  changes: z.ZodArray<z.ZodObject<{
271
349
  id: z.ZodString;
272
- title: z.ZodString;
273
350
  signed_off: z.ZodISODate;
351
+ title: z.ZodString;
274
352
  delta: z.ZodString;
275
353
  depends_on: z.ZodArray<z.ZodString>;
276
354
  level: z.ZodNumber;
@@ -305,8 +383,8 @@ declare const WorkTaskV4Schema: z.ZodObject<{
305
383
  type WorkTaskV4 = z.infer<typeof WorkTaskV4Schema>;
306
384
  declare const WorkChangeV4Schema: z.ZodObject<{
307
385
  id: z.ZodString;
308
- title: z.ZodString;
309
386
  signed_off: z.ZodISODate;
387
+ title: z.ZodString;
310
388
  delta: z.ZodString;
311
389
  depends_on: z.ZodArray<z.ZodString>;
312
390
  level: z.ZodNumber;
@@ -341,8 +419,8 @@ declare const WorkV4Schema: z.ZodObject<{
341
419
  format: z.ZodLiteral<4>;
342
420
  changes: z.ZodArray<z.ZodObject<{
343
421
  id: z.ZodString;
344
- title: z.ZodString;
345
422
  signed_off: z.ZodISODate;
423
+ title: z.ZodString;
346
424
  delta: z.ZodString;
347
425
  depends_on: z.ZodArray<z.ZodString>;
348
426
  level: z.ZodNumber;
@@ -624,8 +702,8 @@ declare const AnyWorkSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
624
702
  format: z.ZodLiteral<4>;
625
703
  changes: z.ZodArray<z.ZodObject<{
626
704
  id: z.ZodString;
627
- title: z.ZodString;
628
705
  signed_off: z.ZodISODate;
706
+ title: z.ZodString;
629
707
  delta: z.ZodString;
630
708
  depends_on: z.ZodArray<z.ZodString>;
631
709
  level: z.ZodNumber;
@@ -642,8 +720,8 @@ declare const AnyWorkSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
642
720
  }, z.core.$strict>>;
643
721
  }, z.core.$strict>>;
644
722
  }, z.core.$strict>, z.ZodObject<{
645
- alterspec: z.ZodString;
646
723
  exported: z.ZodISODate;
724
+ alterspec: z.ZodString;
647
725
  baseline: z.ZodNullable<z.ZodObject<{
648
726
  date: z.ZodISODate;
649
727
  built: z.ZodBoolean;
@@ -660,8 +738,8 @@ declare const AnyWorkSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
660
738
  format: z.ZodLiteral<5>;
661
739
  changes: z.ZodArray<z.ZodObject<{
662
740
  id: z.ZodString;
663
- title: z.ZodString;
664
741
  signed_off: z.ZodISODate;
742
+ title: z.ZodString;
665
743
  delta: z.ZodString;
666
744
  depends_on: z.ZodArray<z.ZodString>;
667
745
  level: z.ZodNumber;
@@ -681,8 +759,8 @@ declare const AnyWorkSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
681
759
  }, z.core.$strict>>;
682
760
  }, z.core.$strict>>;
683
761
  }, z.core.$strict>, z.ZodObject<{
684
- alterspec: z.ZodString;
685
762
  exported: z.ZodISODate;
763
+ alterspec: z.ZodString;
686
764
  baseline: z.ZodNullable<z.ZodObject<{
687
765
  date: z.ZodISODate;
688
766
  built: z.ZodBoolean;
@@ -699,8 +777,8 @@ declare const AnyWorkSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
699
777
  format: z.ZodLiteral<6>;
700
778
  changes: z.ZodArray<z.ZodObject<{
701
779
  id: z.ZodString;
702
- title: z.ZodString;
703
780
  signed_off: z.ZodISODate;
781
+ title: z.ZodString;
704
782
  delta: z.ZodString;
705
783
  depends_on: z.ZodArray<z.ZodString>;
706
784
  level: z.ZodNumber;
@@ -720,7 +798,46 @@ declare const AnyWorkSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
720
798
  weight: z.ZodOptional<z.ZodNumber>;
721
799
  }, z.core.$strict>>;
722
800
  }, z.core.$strict>, z.ZodObject<{
801
+ exported: z.ZodISODate;
802
+ alterspec: z.ZodString;
803
+ baseline: z.ZodNullable<z.ZodObject<{
804
+ date: z.ZodISODate;
805
+ built: z.ZodBoolean;
806
+ }, z.core.$strict>>;
807
+ tracks: z.ZodArray<z.ZodObject<{
808
+ code: z.ZodString;
809
+ kind: z.ZodEnum<{
810
+ backend: "backend";
811
+ ui: "ui";
812
+ }>;
813
+ channels: z.ZodArray<z.ZodString>;
814
+ }, z.core.$strict>>;
815
+ names: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
723
816
  format: z.ZodLiteral<7>;
817
+ changes: z.ZodArray<z.ZodObject<{
818
+ id: z.ZodString;
819
+ signed_off: z.ZodISODate;
820
+ title: z.ZodString;
821
+ delta: z.ZodString;
822
+ depends_on: z.ZodArray<z.ZodString>;
823
+ level: z.ZodNumber;
824
+ tasks: z.ZodArray<z.ZodObject<{
825
+ track: z.ZodString;
826
+ objects: z.ZodArray<z.ZodString>;
827
+ items: z.ZodArray<z.ZodString>;
828
+ after: z.ZodArray<z.ZodObject<{
829
+ change: z.ZodString;
830
+ track: z.ZodString;
831
+ }, z.core.$strict>>;
832
+ weights: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
833
+ weight: z.ZodOptional<z.ZodNumber>;
834
+ title: z.ZodOptional<z.ZodString>;
835
+ summary: z.ZodOptional<z.ZodString>;
836
+ labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
837
+ }, z.core.$strict>>;
838
+ }, z.core.$strict>>;
839
+ }, z.core.$strict>, z.ZodObject<{
840
+ format: z.ZodLiteral<8>;
724
841
  alterspec: z.ZodString;
725
842
  exported: z.ZodISODate;
726
843
  baseline: z.ZodNullable<z.ZodObject<{
@@ -756,8 +873,13 @@ declare const AnyWorkSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
756
873
  summary: z.ZodOptional<z.ZodString>;
757
874
  labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
758
875
  }, z.core.$strict>>;
876
+ initiative: z.ZodOptional<z.ZodString>;
759
877
  }, z.core.$strict>>;
760
878
  names: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
879
+ initiatives: z.ZodOptional<z.ZodArray<z.ZodObject<{
880
+ id: z.ZodString;
881
+ title: z.ZodString;
882
+ }, z.core.$strict>>>;
761
883
  }, z.core.$strict>], "format">;
762
884
  type AnyWork = z.infer<typeof AnyWorkSchema>;
763
885
 
@@ -775,4 +897,4 @@ declare function parseWork(text: string): AnyWork;
775
897
  /** The JSON Schema of `work.json` (either format), as alterspec installs it in `.alterspec/schemas/work.json`. */
776
898
  declare function toWorkJsonSchema(): object;
777
899
 
778
- export { type AnyWork, AnyWorkSchema, ItemWeight, TrackCode, WORD_CAPS, WORK_FORMAT, type Work, type WorkChange, WorkChangeSchema, type WorkChangeV3, WorkChangeV3Schema, type WorkChangeV4, WorkChangeV4Schema, type WorkChangeV5, WorkChangeV5Schema, type WorkChangeV6, WorkChangeV6Schema, WorkError, WorkLabel, WorkName, WorkSchema, WorkSummary, type WorkTask, WorkTaskSchema, type WorkTaskV1, WorkTaskV1Schema, type WorkTaskV2, WorkTaskV2Schema, type WorkTaskV4, WorkTaskV4Schema, type WorkTaskV5, WorkTaskV5Schema, type WorkTaskV6, WorkTaskV6Schema, WorkTitle, type WorkTrack, WorkTrackSchema, type WorkV1, WorkV1Schema, type WorkV2, WorkV2Schema, type WorkV3, WorkV3Schema, type WorkV4, WorkV4Schema, type WorkV5, WorkV5Schema, type WorkV6, WorkV6Schema, WorkWeight, parseWork, toWorkJsonSchema };
900
+ export { type AnyWork, AnyWorkSchema, ItemWeight, TrackCode, WORD_CAPS, WORK_FORMAT, type Work, type WorkChange, WorkChangeSchema, type WorkChangeV3, WorkChangeV3Schema, type WorkChangeV4, WorkChangeV4Schema, type WorkChangeV5, WorkChangeV5Schema, type WorkChangeV6, WorkChangeV6Schema, type WorkChangeV7, WorkChangeV7Schema, WorkError, type WorkInitiative, WorkInitiativeSchema, WorkLabel, WorkName, WorkSchema, WorkSummary, type WorkTask, WorkTaskSchema, type WorkTaskV1, WorkTaskV1Schema, type WorkTaskV2, WorkTaskV2Schema, type WorkTaskV4, WorkTaskV4Schema, type WorkTaskV5, WorkTaskV5Schema, type WorkTaskV6, WorkTaskV6Schema, WorkTitle, type WorkTrack, WorkTrackSchema, type WorkV1, WorkV1Schema, type WorkV2, WorkV2Schema, type WorkV3, WorkV3Schema, type WorkV4, WorkV4Schema, type WorkV5, WorkV5Schema, type WorkV6, WorkV6Schema, type WorkV7, WorkV7Schema, WorkWeight, parseWork, toWorkJsonSchema };
package/dist/work.js CHANGED
@@ -13,6 +13,7 @@ var WorkSummary = words(WORD_CAPS.summary);
13
13
  var WorkLabel = words(WORD_CAPS.label);
14
14
  var WorkName = words(WORD_CAPS.name);
15
15
  var ChangeRef = z.string().regex(/^CHG-\d{3,}$/);
16
+ var InitiativeRef = z.string().regex(/^INI-[A-Z0-9]+(?:-[A-Z0-9]+)*$/);
16
17
  var Day = z.iso.date();
17
18
  var WorkTrackSchema = z.object({
18
19
  code: TrackCode,
@@ -77,9 +78,12 @@ var WorkChangeSchema = z.object({
77
78
  /** The change map's level. */
78
79
  level: z.number().int().min(1),
79
80
  /** One per track the change is on; empty = no work. */
80
- tasks: z.array(WorkTaskSchema)
81
+ tasks: z.array(WorkTaskSchema),
82
+ /** The initiative the change belongs to (format 8): its entry in `initiatives`. Absent: none. */
83
+ initiative: InitiativeRef.optional()
81
84
  }).strict();
82
- var WORK_FORMAT = 7;
85
+ var WorkInitiativeSchema = z.object({ id: InitiativeRef, title: z.string().min(1) }).strict();
86
+ var WORK_FORMAT = 8;
83
87
  var WorkSchema = z.object({
84
88
  format: z.literal(WORK_FORMAT),
85
89
  /** The alterspec version that wrote the export. */
@@ -94,14 +98,18 @@ var WorkSchema = z.object({
94
98
  * The title of every object a task's `objects` names, by key, as the spec holds it now (format 5); an object
95
99
  * the spec no longer holds, and a file, has no entry. Absent when no object has one.
96
100
  */
97
- names: z.record(z.string().min(1), WorkName).optional()
101
+ names: z.record(z.string().min(1), WorkName).optional(),
102
+ /** The initiatives the changes name, by ID (format 8). Absent when no change names one. */
103
+ initiatives: z.array(WorkInitiativeSchema).optional()
98
104
  }).strict();
105
+ var WorkChangeV7Schema = WorkChangeSchema.omit({ initiative: true }).strict();
106
+ var WorkV7Schema = WorkSchema.omit({ initiatives: true }).extend({ format: z.literal(7), changes: z.array(WorkChangeV7Schema) }).strict();
99
107
  var WorkTaskV6Schema = WorkTaskSchema.omit({ weight: true }).strict();
100
- var WorkChangeV6Schema = WorkChangeSchema.extend({
108
+ var WorkChangeV6Schema = WorkChangeV7Schema.extend({
101
109
  tasks: z.array(WorkTaskV6Schema),
102
110
  weight: WorkWeight.optional()
103
111
  }).strict();
104
- var WorkV6Schema = WorkSchema.extend({
112
+ var WorkV6Schema = WorkV7Schema.extend({
105
113
  format: z.literal(6),
106
114
  changes: z.array(WorkChangeV6Schema)
107
115
  }).strict();
@@ -109,7 +117,7 @@ var WorkTaskV5Schema = WorkTaskV6Schema.extend({
109
117
  weights: z.record(z.string().min(1), WorkWeight).optional()
110
118
  }).strict();
111
119
  var WorkChangeV5Schema = WorkChangeV6Schema.extend({ tasks: z.array(WorkTaskV5Schema) }).strict();
112
- var WorkV5Schema = WorkSchema.extend({
120
+ var WorkV5Schema = WorkV7Schema.extend({
113
121
  format: z.literal(5),
114
122
  changes: z.array(WorkChangeV5Schema)
115
123
  }).strict();
@@ -138,11 +146,12 @@ var AnyWorkSchema = z.discriminatedUnion("format", [
138
146
  WorkV4Schema,
139
147
  WorkV5Schema,
140
148
  WorkV6Schema,
149
+ WorkV7Schema,
141
150
  WorkSchema
142
151
  ]);
143
152
 
144
153
  // src/work.ts
145
- var FORMATS = [1, 2, 3, 4, 5, 6, 7];
154
+ var FORMATS = [1, 2, 3, 4, 5, 6, 7, 8];
146
155
  var WorkError = class extends Error {
147
156
  constructor(message, issues = []) {
148
157
  super(message);
@@ -189,7 +198,9 @@ export {
189
198
  WorkChangeV4Schema,
190
199
  WorkChangeV5Schema,
191
200
  WorkChangeV6Schema,
201
+ WorkChangeV7Schema,
192
202
  WorkError,
203
+ WorkInitiativeSchema,
193
204
  WorkLabel,
194
205
  WorkName,
195
206
  WorkSchema,
@@ -208,6 +219,7 @@ export {
208
219
  WorkV4Schema,
209
220
  WorkV5Schema,
210
221
  WorkV6Schema,
222
+ WorkV7Schema,
211
223
  WorkWeight,
212
224
  parseWork,
213
225
  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 7 is\n * `WorkSchema`, format 6 `WorkV6Schema` (the change's `weight`, no task `weight`), format 5 `WorkV5Schema` (one weight per item for every track, never 0), 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, 6, 7];\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 6 (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`; in 6 an item's weight is its track's, and may be 0); 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 7 (alterspec 0.42.0) gives each task its own optional `weight` and drops the\n * change's. Format 6 (alterspec 0.41.0) weighs each item per track and allows 0 (nothing to build\n * on that track). 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 * A weight from 1 to 100: the size of a task (format 7; of a whole change in formats 4 to 6), and (to format 5) of a\n * task item, 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/**\n * The weight of a task item on one track, 0–100 (format 6): how much of the behaviour the item specifies that\n * track builds. 0: the track has nothing to build for it (a behaviour only another channel shows, a mockup file);\n * the item stays on the checklist to be read.\n */\nexport const ItemWeight = z.number().int().min(0).max(100);\nexport type ItemWeight = z.infer<typeof ItemWeight>;\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 on this track (format 3; per track and 0–100 from format 6): how much of the\n * behaviour the item specifies this track builds, reasoned at the change's sign-off against alterspec's rubric\n * (a typical acceptance criterion about 10), never anyone's code. 0: nothing to build on this track; the item\n * is read, not built, and counts in no progress. A task whose weights are all 0 has no work and is not handed\n * out. An item the sign-off didn't weigh takes the median of the task's weighed items above 0; a task of a\n * change signed off without weights has no `weights`, and a reader counts each of its items as 10.\n */\n weights: z.record(z.string().min(1), ItemWeight).optional(),\n /**\n * The size of what this track builds in this change, 1–100 (format 7): reasoned at sign-off against alterspec's\n * task rubric (a wording fix about 1–5, one capability's criteria 10–20, a new capability or flow 30–50, a new\n * module or the application's foundation 80–100), never a sum of the item weights and never anyone's code.\n * Absent: the change was signed off without one. For the lists; progress and ETA keep the item weights.\n */\n weight: 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 .strict();\nexport type WorkChange = z.infer<typeof WorkChangeSchema>;\n\nexport const WORK_FORMAT = 7;\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/**\n * Format 6 (alterspec 0.41): the same without the task's `weight`, with the size of the whole change, 1–100, as\n * the change's optional `weight`.\n */\nexport const WorkTaskV6Schema = WorkTaskSchema.omit({ weight: true }).strict();\nexport type WorkTaskV6 = z.infer<typeof WorkTaskV6Schema>;\n\nexport const WorkChangeV6Schema = WorkChangeSchema.extend({\n tasks: z.array(WorkTaskV6Schema),\n weight: WorkWeight.optional(),\n}).strict();\nexport type WorkChangeV6 = z.infer<typeof WorkChangeV6Schema>;\n\nexport const WorkV6Schema = WorkSchema.extend({\n format: z.literal(6),\n changes: z.array(WorkChangeV6Schema),\n}).strict();\nexport type WorkV6 = z.infer<typeof WorkV6Schema>;\n\n/** Format 5 (alterspec 0.38 to 0.40): the same with one weight per item for every track, 1–100. */\nexport const WorkTaskV5Schema = WorkTaskV6Schema.extend({\n weights: z.record(z.string().min(1), WorkWeight).optional(),\n}).strict();\nexport type WorkTaskV5 = z.infer<typeof WorkTaskV5Schema>;\n\nexport const WorkChangeV5Schema = WorkChangeV6Schema.extend({ tasks: z.array(WorkTaskV5Schema) }).strict();\nexport type WorkChangeV5 = z.infer<typeof WorkChangeV5Schema>;\n\nexport const WorkV5Schema = WorkSchema.extend({\n format: z.literal(5),\n changes: z.array(WorkChangeV5Schema),\n}).strict();\nexport type WorkV5 = z.infer<typeof WorkV5Schema>;\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 = WorkTaskV5Schema.omit({ title: true, summary: true, labels: true }).strict();\nexport type WorkTaskV4 = z.infer<typeof WorkTaskV4Schema>;\n\nexport const WorkChangeV4Schema = WorkChangeV5Schema.extend({ tasks: z.array(WorkTaskV4Schema) }).strict();\nexport type WorkChangeV4 = z.infer<typeof WorkChangeV4Schema>;\n\nexport const WorkV4Schema = WorkV5Schema.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 WorkV5Schema,\n WorkV6Schema,\n WorkSchema,\n]);\nexport type AnyWork = z.infer<typeof AnyWorkSchema>;\n"],"mappings":";AAAA,SAAS,KAAAA,UAAS;;;ACAlB,SAAS,SAAS;AAaX,IAAM,YAAY,EAAE,OAAO,EAAE,MAAM,gBAAgB,EAAE,SAAS,+BAA+B,CAAC;AAQ9F,IAAM,aAAa,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,EAAE,IAAI,GAAG;AAQlD,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,CAAC,QACb,EACG,OAAO,EACP,IAAI,KAAK,EAAE,SAAS,WAAW,GAAG,cAAc,CAAC,EACjD,MAAM,uBAAuB,EAAE,SAAS,6CAA6C,CAAC;AAGpF,IAAM,YAAY,MAAM,UAAU,KAAK;AAEvC,IAAM,cAAc,MAAM,UAAU,OAAO;AAE3C,IAAM,YAAY,MAAM,UAAU,KAAK;AAEvC,IAAM,WAAW,MAAM,UAAU,IAAI;AAE5C,IAAM,YAAY,EAAE,OAAO,EAAE,MAAM,cAAc;AACjD,IAAM,MAAM,EAAE,IAAI,KAAK;AAEhB,IAAM,kBAAkB,EAC5B,OAAO;AAAA,EACN,MAAM;AAAA,EACN,MAAM,EAAE,KAAK,CAAC,WAAW,IAAI,CAAC;AAAA;AAAA,EAE9B,UAAU,EAAE,MAAM,EAAE,OAAO,CAAC;AAC9B,CAAC,EACA,OAAO;AAGH,IAAM,iBAAiB,EAC3B,OAAO;AAA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MAAM;AACV,aAAW,KAAK,KAAM,QAAO,OAAO,MAAM,WAAW,IAAI,CAAC,MAAM,GAAG,MAAM,MAAM,EAAE,GAAG,OAAO,CAAC,CAAC;AAC7F,SAAO,OAAO;AAChB;AAOO,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 7 is\n * `WorkSchema`, format 6 `WorkV6Schema` (the change's `weight`, no task `weight`), format 5 `WorkV5Schema` (one weight per item for every track, never 0), 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, 6, 7, 8];\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 6 (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`; in 6 an item's weight is its track's, and may be 0); 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 8 (alterspec 0.43.0) names each change's optional `initiative` and carries the\n * `initiatives` they name (the envelope around a group of changes: why they exist; no status). Format 7 (alterspec 0.42.0) gives each task its own optional `weight` and drops the\n * change's. Format 6 (alterspec 0.41.0) weighs each item per track and allows 0 (nothing to build\n * on that track). 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 * A weight from 1 to 100: the size of a task (format 7; of a whole change in formats 4 to 6), and (to format 5) of a\n * task item, 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/**\n * The weight of a task item on one track, 0–100 (format 6): how much of the behaviour the item specifies that\n * track builds. 0: the track has nothing to build for it (a behaviour only another channel shows, a mockup file);\n * the item stays on the checklist to be read.\n */\nexport const ItemWeight = z.number().int().min(0).max(100);\nexport type ItemWeight = z.infer<typeof ItemWeight>;\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,}$/);\n/** An initiative's ID (alterspec's `INITIATIVE_ID`, written here again: this file imports nothing but zod). */\nconst InitiativeRef = z.string().regex(/^INI-[A-Z0-9]+(?:-[A-Z0-9]+)*$/);\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 on this track (format 3; per track and 0–100 from format 6): how much of the\n * behaviour the item specifies this track builds, reasoned at the change's sign-off against alterspec's rubric\n * (a typical acceptance criterion about 10), never anyone's code. 0: nothing to build on this track; the item\n * is read, not built, and counts in no progress. A task whose weights are all 0 has no work and is not handed\n * out. An item the sign-off didn't weigh takes the median of the task's weighed items above 0; a task of a\n * change signed off without weights has no `weights`, and a reader counts each of its items as 10.\n */\n weights: z.record(z.string().min(1), ItemWeight).optional(),\n /**\n * The size of what this track builds in this change, 1–100 (format 7): reasoned at sign-off against alterspec's\n * task rubric (a wording fix about 1–5, one capability's criteria 10–20, a new capability or flow 30–50, a new\n * module or the application's foundation 80–100), never a sum of the item weights and never anyone's code.\n * Absent: the change was signed off without one. For the lists; progress and ETA keep the item weights.\n */\n weight: 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 /** The initiative the change belongs to (format 8): its entry in `initiatives`. Absent: none. */\n initiative: InitiativeRef.optional(),\n })\n .strict();\nexport type WorkChange = z.infer<typeof WorkChangeSchema>;\n\n/** An initiative a change names (format 8): its prose is `initiatives/<id>.md` in the export. */\nexport const WorkInitiativeSchema = z.object({ id: InitiativeRef, title: z.string().min(1) }).strict();\nexport type WorkInitiative = z.infer<typeof WorkInitiativeSchema>;\n\nexport const WORK_FORMAT = 8;\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 /** The initiatives the changes name, by ID (format 8). Absent when no change names one. */\n initiatives: z.array(WorkInitiativeSchema).optional(),\n })\n .strict();\nexport type Work = z.infer<typeof WorkSchema>;\n\n/** Format 7 (alterspec 0.42): the same without the change's `initiative` and without `initiatives`. */\nexport const WorkChangeV7Schema = WorkChangeSchema.omit({ initiative: true }).strict();\nexport type WorkChangeV7 = z.infer<typeof WorkChangeV7Schema>;\n\nexport const WorkV7Schema = WorkSchema.omit({ initiatives: true })\n .extend({ format: z.literal(7), changes: z.array(WorkChangeV7Schema) })\n .strict();\nexport type WorkV7 = z.infer<typeof WorkV7Schema>;\n\n/**\n * Format 6 (alterspec 0.41): the same without the task's `weight`, with the size of the whole change, 1–100, as\n * the change's optional `weight`.\n */\nexport const WorkTaskV6Schema = WorkTaskSchema.omit({ weight: true }).strict();\nexport type WorkTaskV6 = z.infer<typeof WorkTaskV6Schema>;\n\nexport const WorkChangeV6Schema = WorkChangeV7Schema.extend({\n tasks: z.array(WorkTaskV6Schema),\n weight: WorkWeight.optional(),\n}).strict();\nexport type WorkChangeV6 = z.infer<typeof WorkChangeV6Schema>;\n\nexport const WorkV6Schema = WorkV7Schema.extend({\n format: z.literal(6),\n changes: z.array(WorkChangeV6Schema),\n}).strict();\nexport type WorkV6 = z.infer<typeof WorkV6Schema>;\n\n/** Format 5 (alterspec 0.38 to 0.40): the same with one weight per item for every track, 1–100. */\nexport const WorkTaskV5Schema = WorkTaskV6Schema.extend({\n weights: z.record(z.string().min(1), WorkWeight).optional(),\n}).strict();\nexport type WorkTaskV5 = z.infer<typeof WorkTaskV5Schema>;\n\nexport const WorkChangeV5Schema = WorkChangeV6Schema.extend({ tasks: z.array(WorkTaskV5Schema) }).strict();\nexport type WorkChangeV5 = z.infer<typeof WorkChangeV5Schema>;\n\nexport const WorkV5Schema = WorkV7Schema.extend({\n format: z.literal(5),\n changes: z.array(WorkChangeV5Schema),\n}).strict();\nexport type WorkV5 = z.infer<typeof WorkV5Schema>;\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 = WorkTaskV5Schema.omit({ title: true, summary: true, labels: true }).strict();\nexport type WorkTaskV4 = z.infer<typeof WorkTaskV4Schema>;\n\nexport const WorkChangeV4Schema = WorkChangeV5Schema.extend({ tasks: z.array(WorkTaskV4Schema) }).strict();\nexport type WorkChangeV4 = z.infer<typeof WorkChangeV4Schema>;\n\nexport const WorkV4Schema = WorkV5Schema.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 WorkV5Schema,\n WorkV6Schema,\n WorkV7Schema,\n WorkSchema,\n]);\nexport type AnyWork = z.infer<typeof AnyWorkSchema>;\n"],"mappings":";AAAA,SAAS,KAAAA,UAAS;;;ACAlB,SAAS,SAAS;AAcX,IAAM,YAAY,EAAE,OAAO,EAAE,MAAM,gBAAgB,EAAE,SAAS,+BAA+B,CAAC;AAQ9F,IAAM,aAAa,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,EAAE,IAAI,GAAG;AAQlD,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,CAAC,QACb,EACG,OAAO,EACP,IAAI,KAAK,EAAE,SAAS,WAAW,GAAG,cAAc,CAAC,EACjD,MAAM,uBAAuB,EAAE,SAAS,6CAA6C,CAAC;AAGpF,IAAM,YAAY,MAAM,UAAU,KAAK;AAEvC,IAAM,cAAc,MAAM,UAAU,OAAO;AAE3C,IAAM,YAAY,MAAM,UAAU,KAAK;AAEvC,IAAM,WAAW,MAAM,UAAU,IA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