@alterset/alterspec-client 0.1.0 → 0.4.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.js CHANGED
@@ -16,6 +16,12 @@ var WorkTaskSchema = z.object({
16
16
  track: TrackCode,
17
17
  /** The keys of the objects in the change's delta that put it on the track. */
18
18
  objects: z.array(z.string()),
19
+ /**
20
+ * The task's checklist, derived from the delta: the acceptance criteria (`<CAP>-AC-NN`), screen actions
21
+ * (`<SCR>.Ann`) and contract states (`<UX-SCR>#<state>`) the change adds or changes, and every other object as
22
+ * its key. Sorted, never empty.
23
+ */
24
+ items: z.array(z.string().min(1)).min(1),
19
25
  /** The tasks this one waits for, resolved: the same change's `BE` task, and the track's tasks it builds on. */
20
26
  after: z.array(z.object({ change: ChangeRef, track: TrackCode }).strict())
21
27
  }).strict();
@@ -31,7 +37,7 @@ var WorkChangeSchema = z.object({
31
37
  /** One per track the change is on; empty = no work. */
32
38
  tasks: z.array(WorkTaskSchema)
33
39
  }).strict();
34
- var WORK_FORMAT = 1;
40
+ var WORK_FORMAT = 2;
35
41
  var WorkSchema = z.object({
36
42
  format: z.literal(WORK_FORMAT),
37
43
  /** The alterspec version that wrote the export. */
@@ -43,8 +49,15 @@ var WorkSchema = z.object({
43
49
  /** Every change signed off after the baseline, in the change map's order. */
44
50
  changes: z.array(WorkChangeSchema)
45
51
  }).strict();
52
+ var WorkTaskV1Schema = WorkTaskSchema.omit({ items: true });
53
+ var WorkV1Schema = WorkSchema.extend({
54
+ format: z.literal(1),
55
+ changes: z.array(WorkChangeSchema.extend({ tasks: z.array(WorkTaskV1Schema) }).strict())
56
+ }).strict();
57
+ var AnyWorkSchema = z.discriminatedUnion("format", [WorkV1Schema, WorkSchema]);
46
58
 
47
59
  // src/work.ts
60
+ var FORMATS = [1, 2];
48
61
  var WorkError = class extends Error {
49
62
  constructor(message, issues = []) {
50
63
  super(message);
@@ -65,10 +78,10 @@ function parseWork(text) {
65
78
  throw new WorkError(`work.json is not JSON: ${e.message}`);
66
79
  }
67
80
  const format = data?.format;
68
- if (typeof format === "number" && format !== WORK_FORMAT) {
69
- throw new WorkError(`work.json has format ${format}; this client knows format ${WORK_FORMAT}`);
81
+ if (typeof format === "number" && !FORMATS.includes(format)) {
82
+ throw new WorkError(`work.json has format ${format}; this client knows formats ${FORMATS.join(" and ")}`);
70
83
  }
71
- const r = WorkSchema.safeParse(data);
84
+ const r = AnyWorkSchema.safeParse(data);
72
85
  if (r.success) return r.data;
73
86
  const lines = r.error.issues.map((i) => ` ${pathText(i.path)}: ${i.message}`);
74
87
  throw new WorkError(`work.json is not valid:
@@ -77,17 +90,20 @@ ${lines.join("\n")}`, r.error.issues);
77
90
  function toWorkJsonSchema() {
78
91
  return {
79
92
  title: "alterspec work",
80
- ...z2.toJSONSchema(WorkSchema, { io: "input", unrepresentable: "any" })
93
+ ...z2.toJSONSchema(AnyWorkSchema, { io: "input", unrepresentable: "any" })
81
94
  };
82
95
  }
83
96
  export {
97
+ AnyWorkSchema,
84
98
  TrackCode,
85
99
  WORK_FORMAT,
86
100
  WorkChangeSchema,
87
101
  WorkError,
88
102
  WorkSchema,
89
103
  WorkTaskSchema,
104
+ WorkTaskV1Schema,
90
105
  WorkTrackSchema,
106
+ WorkV1Schema,
91
107
  parseWork,
92
108
  toWorkJsonSchema
93
109
  };
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 { WORK_FORMAT, WorkSchema, type Work } 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.\n */\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/** Parses and validates the text of a `work.json`; throws a `WorkError` naming every field that is wrong. */\nexport function parseWork(text: string): Work {\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' && format !== WORK_FORMAT) {\n throw new WorkError(`work.json has format ${format}; this client knows format ${WORK_FORMAT}`);\n }\n const r = WorkSchema.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`, as alterspec installs it in `.alterspec/schemas/work.json`. */\nexport function toWorkJsonSchema(): object {\n return {\n title: 'alterspec work',\n ...z.toJSONSchema(WorkSchema, { 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.\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\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 /** The tasks this one waits for, resolved: the same change's `BE` task, and the track's tasks it builds on. */\n after: z.array(z.object({ change: ChangeRef, track: TrackCode }).strict()),\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 = 1;\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"],"mappings":";AAAA,SAAS,KAAAA,UAAS;;;ACAlB,SAAS,SAAS;AASX,IAAM,YAAY,EAAE,OAAO,EAAE,MAAM,gBAAgB,EAAE,SAAS,+BAA+B,CAAC;AAGrG,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,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CAAC;AAC7F,SAAO,OAAO;AAChB;AAGO,SAAS,UAAU,MAAoB;AAC5C,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,WAAW,aAAa;AACxD,UAAM,IAAI,UAAU,wBAAwB,MAAM,8BAA8B,WAAW,EAAE;AAAA,EAC/F;AACA,QAAM,IAAI,WAAW,UAAU,IAAI;AACnC,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,YAAY,EAAE,IAAI,SAAS,iBAAiB,MAAM,CAAC;AAAA,EACvE;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 2 is\n * `WorkSchema`, format 1 `WorkV1Schema`; `parseWork` reads both.\n */\n\n/** The formats this client reads. */\nconst FORMATS = [1, 2];\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 or 2 (tell them apart by `format`; only 2 has\n * `items`); 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(' and ')}`);\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 2 (alterspec 0.24.0) adds each task's `items`; format 1 is the same without them, and\n * a reader of both 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\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. Sorted, never empty.\n */\n items: z.array(z.string().min(1)).min(1),\n /** The tasks this one waits for, resolved: the same change's `BE` task, and the track's tasks it builds on. */\n after: z.array(z.object({ change: ChangeRef, track: TrackCode }).strict()),\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 = 2;\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 1 (alterspec 0.23): the same without `items`. */\nexport const WorkTaskV1Schema = WorkTaskSchema.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(WorkChangeSchema.extend({ tasks: z.array(WorkTaskV1Schema) }).strict()),\n}).strict();\nexport type WorkV1 = z.infer<typeof WorkV1Schema>;\n\n/** Either format, told apart by `format`: what a reader of exports from several alterspec versions takes. */\nexport const AnyWorkSchema = z.discriminatedUnion('format', [WorkV1Schema, WorkSchema]);\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;AAGrG,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;AAAA,EACN,OAAO;AAAA;AAAA,EAEP,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAM3B,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC;AAAA;AAAA,EAEvC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,WAAW,OAAO,UAAU,CAAC,EAAE,OAAO,CAAC;AAC3E,CAAC,EACA,OAAO;AAGH,IAAM,mBAAmB,EAC7B,OAAO;AAAA,EACN,IAAI;AAAA,EACJ,OAAO,EAAE,OAAO;AAAA,EAChB,YAAY;AAAA;AAAA,EAEZ,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB;AAAA,EACxC,YAAY,EAAE,MAA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AAO,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,OAAO,CAAC,EAAE;AAAA,EAC1G;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,175 +1,361 @@
1
1
  {
2
2
  "title": "alterspec work",
3
3
  "$schema": "https://json-schema.org/draft/2020-12/schema",
4
- "type": "object",
5
- "properties": {
6
- "format": {
7
- "type": "number",
8
- "const": 1
9
- },
10
- "alterspec": {
11
- "type": "string"
12
- },
13
- "exported": {
14
- "type": "string",
15
- "format": "date",
16
- "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
17
- },
18
- "baseline": {
19
- "anyOf": [
20
- {
21
- "type": "object",
22
- "properties": {
23
- "date": {
24
- "type": "string",
25
- "format": "date",
26
- "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
4
+ "oneOf": [
5
+ {
6
+ "type": "object",
7
+ "properties": {
8
+ "format": {
9
+ "type": "number",
10
+ "const": 1
11
+ },
12
+ "alterspec": {
13
+ "type": "string"
14
+ },
15
+ "exported": {
16
+ "type": "string",
17
+ "format": "date",
18
+ "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
19
+ },
20
+ "baseline": {
21
+ "anyOf": [
22
+ {
23
+ "type": "object",
24
+ "properties": {
25
+ "date": {
26
+ "type": "string",
27
+ "format": "date",
28
+ "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
29
+ },
30
+ "built": {
31
+ "type": "boolean"
32
+ }
33
+ },
34
+ "required": [
35
+ "date",
36
+ "built"
37
+ ],
38
+ "additionalProperties": false
27
39
  },
28
- "built": {
29
- "type": "boolean"
40
+ {
41
+ "type": "null"
30
42
  }
31
- },
32
- "required": [
33
- "date",
34
- "built"
35
- ],
36
- "additionalProperties": false
43
+ ]
37
44
  },
38
- {
39
- "type": "null"
40
- }
41
- ]
42
- },
43
- "tracks": {
44
- "type": "array",
45
- "items": {
46
- "type": "object",
47
- "properties": {
48
- "code": {
49
- "type": "string",
50
- "pattern": "^[A-Z]{2,5}$"
51
- },
52
- "kind": {
53
- "type": "string",
54
- "enum": [
55
- "backend",
56
- "ui"
57
- ]
58
- },
59
- "channels": {
60
- "type": "array",
61
- "items": {
62
- "type": "string"
63
- }
45
+ "tracks": {
46
+ "type": "array",
47
+ "items": {
48
+ "type": "object",
49
+ "properties": {
50
+ "code": {
51
+ "type": "string",
52
+ "pattern": "^[A-Z]{2,5}$"
53
+ },
54
+ "kind": {
55
+ "type": "string",
56
+ "enum": [
57
+ "backend",
58
+ "ui"
59
+ ]
60
+ },
61
+ "channels": {
62
+ "type": "array",
63
+ "items": {
64
+ "type": "string"
65
+ }
66
+ }
67
+ },
68
+ "required": [
69
+ "code",
70
+ "kind",
71
+ "channels"
72
+ ],
73
+ "additionalProperties": false
64
74
  }
65
75
  },
66
- "required": [
67
- "code",
68
- "kind",
69
- "channels"
70
- ],
71
- "additionalProperties": false
72
- }
76
+ "changes": {
77
+ "type": "array",
78
+ "items": {
79
+ "type": "object",
80
+ "properties": {
81
+ "id": {
82
+ "type": "string",
83
+ "pattern": "^CHG-\\d{3,}$"
84
+ },
85
+ "title": {
86
+ "type": "string"
87
+ },
88
+ "signed_off": {
89
+ "type": "string",
90
+ "format": "date",
91
+ "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
92
+ },
93
+ "delta": {
94
+ "type": "string",
95
+ "pattern": "^[0-9a-f]{16}$"
96
+ },
97
+ "depends_on": {
98
+ "type": "array",
99
+ "items": {
100
+ "type": "string",
101
+ "pattern": "^CHG-\\d{3,}$"
102
+ }
103
+ },
104
+ "level": {
105
+ "type": "integer",
106
+ "minimum": 1,
107
+ "maximum": 9007199254740991
108
+ },
109
+ "tasks": {
110
+ "type": "array",
111
+ "items": {
112
+ "type": "object",
113
+ "properties": {
114
+ "track": {
115
+ "type": "string",
116
+ "pattern": "^[A-Z]{2,5}$"
117
+ },
118
+ "objects": {
119
+ "type": "array",
120
+ "items": {
121
+ "type": "string"
122
+ }
123
+ },
124
+ "after": {
125
+ "type": "array",
126
+ "items": {
127
+ "type": "object",
128
+ "properties": {
129
+ "change": {
130
+ "type": "string",
131
+ "pattern": "^CHG-\\d{3,}$"
132
+ },
133
+ "track": {
134
+ "type": "string",
135
+ "pattern": "^[A-Z]{2,5}$"
136
+ }
137
+ },
138
+ "required": [
139
+ "change",
140
+ "track"
141
+ ],
142
+ "additionalProperties": false
143
+ }
144
+ }
145
+ },
146
+ "required": [
147
+ "track",
148
+ "objects",
149
+ "after"
150
+ ],
151
+ "additionalProperties": false
152
+ }
153
+ }
154
+ },
155
+ "required": [
156
+ "id",
157
+ "title",
158
+ "signed_off",
159
+ "delta",
160
+ "depends_on",
161
+ "level",
162
+ "tasks"
163
+ ],
164
+ "additionalProperties": false
165
+ }
166
+ }
167
+ },
168
+ "required": [
169
+ "format",
170
+ "alterspec",
171
+ "exported",
172
+ "baseline",
173
+ "tracks",
174
+ "changes"
175
+ ],
176
+ "additionalProperties": false
73
177
  },
74
- "changes": {
75
- "type": "array",
76
- "items": {
77
- "type": "object",
78
- "properties": {
79
- "id": {
80
- "type": "string",
81
- "pattern": "^CHG-\\d{3,}$"
82
- },
83
- "title": {
84
- "type": "string"
85
- },
86
- "signed_off": {
87
- "type": "string",
88
- "format": "date",
89
- "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
90
- },
91
- "delta": {
92
- "type": "string",
93
- "pattern": "^[0-9a-f]{16}$"
94
- },
95
- "depends_on": {
96
- "type": "array",
97
- "items": {
98
- "type": "string",
99
- "pattern": "^CHG-\\d{3,}$"
100
- }
101
- },
102
- "level": {
103
- "type": "integer",
104
- "minimum": 1,
105
- "maximum": 9007199254740991
106
- },
107
- "tasks": {
108
- "type": "array",
109
- "items": {
178
+ {
179
+ "type": "object",
180
+ "properties": {
181
+ "format": {
182
+ "type": "number",
183
+ "const": 2
184
+ },
185
+ "alterspec": {
186
+ "type": "string"
187
+ },
188
+ "exported": {
189
+ "type": "string",
190
+ "format": "date",
191
+ "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
192
+ },
193
+ "baseline": {
194
+ "anyOf": [
195
+ {
110
196
  "type": "object",
111
197
  "properties": {
112
- "track": {
198
+ "date": {
113
199
  "type": "string",
114
- "pattern": "^[A-Z]{2,5}$"
115
- },
116
- "objects": {
117
- "type": "array",
118
- "items": {
119
- "type": "string"
120
- }
200
+ "format": "date",
201
+ "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
121
202
  },
122
- "after": {
123
- "type": "array",
124
- "items": {
125
- "type": "object",
126
- "properties": {
127
- "change": {
128
- "type": "string",
129
- "pattern": "^CHG-\\d{3,}$"
130
- },
131
- "track": {
132
- "type": "string",
133
- "pattern": "^[A-Z]{2,5}$"
134
- }
135
- },
136
- "required": [
137
- "change",
138
- "track"
139
- ],
140
- "additionalProperties": false
141
- }
203
+ "built": {
204
+ "type": "boolean"
142
205
  }
143
206
  },
144
207
  "required": [
145
- "track",
146
- "objects",
147
- "after"
208
+ "date",
209
+ "built"
148
210
  ],
149
211
  "additionalProperties": false
212
+ },
213
+ {
214
+ "type": "null"
150
215
  }
216
+ ]
217
+ },
218
+ "tracks": {
219
+ "type": "array",
220
+ "items": {
221
+ "type": "object",
222
+ "properties": {
223
+ "code": {
224
+ "type": "string",
225
+ "pattern": "^[A-Z]{2,5}$"
226
+ },
227
+ "kind": {
228
+ "type": "string",
229
+ "enum": [
230
+ "backend",
231
+ "ui"
232
+ ]
233
+ },
234
+ "channels": {
235
+ "type": "array",
236
+ "items": {
237
+ "type": "string"
238
+ }
239
+ }
240
+ },
241
+ "required": [
242
+ "code",
243
+ "kind",
244
+ "channels"
245
+ ],
246
+ "additionalProperties": false
151
247
  }
152
248
  },
153
- "required": [
154
- "id",
155
- "title",
156
- "signed_off",
157
- "delta",
158
- "depends_on",
159
- "level",
160
- "tasks"
161
- ],
162
- "additionalProperties": false
163
- }
249
+ "changes": {
250
+ "type": "array",
251
+ "items": {
252
+ "type": "object",
253
+ "properties": {
254
+ "id": {
255
+ "type": "string",
256
+ "pattern": "^CHG-\\d{3,}$"
257
+ },
258
+ "title": {
259
+ "type": "string"
260
+ },
261
+ "signed_off": {
262
+ "type": "string",
263
+ "format": "date",
264
+ "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
265
+ },
266
+ "delta": {
267
+ "type": "string",
268
+ "pattern": "^[0-9a-f]{16}$"
269
+ },
270
+ "depends_on": {
271
+ "type": "array",
272
+ "items": {
273
+ "type": "string",
274
+ "pattern": "^CHG-\\d{3,}$"
275
+ }
276
+ },
277
+ "level": {
278
+ "type": "integer",
279
+ "minimum": 1,
280
+ "maximum": 9007199254740991
281
+ },
282
+ "tasks": {
283
+ "type": "array",
284
+ "items": {
285
+ "type": "object",
286
+ "properties": {
287
+ "track": {
288
+ "type": "string",
289
+ "pattern": "^[A-Z]{2,5}$"
290
+ },
291
+ "objects": {
292
+ "type": "array",
293
+ "items": {
294
+ "type": "string"
295
+ }
296
+ },
297
+ "items": {
298
+ "minItems": 1,
299
+ "type": "array",
300
+ "items": {
301
+ "type": "string",
302
+ "minLength": 1
303
+ }
304
+ },
305
+ "after": {
306
+ "type": "array",
307
+ "items": {
308
+ "type": "object",
309
+ "properties": {
310
+ "change": {
311
+ "type": "string",
312
+ "pattern": "^CHG-\\d{3,}$"
313
+ },
314
+ "track": {
315
+ "type": "string",
316
+ "pattern": "^[A-Z]{2,5}$"
317
+ }
318
+ },
319
+ "required": [
320
+ "change",
321
+ "track"
322
+ ],
323
+ "additionalProperties": false
324
+ }
325
+ }
326
+ },
327
+ "required": [
328
+ "track",
329
+ "objects",
330
+ "items",
331
+ "after"
332
+ ],
333
+ "additionalProperties": false
334
+ }
335
+ }
336
+ },
337
+ "required": [
338
+ "id",
339
+ "title",
340
+ "signed_off",
341
+ "delta",
342
+ "depends_on",
343
+ "level",
344
+ "tasks"
345
+ ],
346
+ "additionalProperties": false
347
+ }
348
+ }
349
+ },
350
+ "required": [
351
+ "format",
352
+ "alterspec",
353
+ "exported",
354
+ "baseline",
355
+ "tracks",
356
+ "changes"
357
+ ],
358
+ "additionalProperties": false
164
359
  }
165
- },
166
- "required": [
167
- "format",
168
- "alterspec",
169
- "exported",
170
- "baseline",
171
- "tracks",
172
- "changes"
173
- ],
174
- "additionalProperties": false
360
+ ]
175
361
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alterset/alterspec-client",
3
- "version": "0.1.0",
3
+ "version": "0.4.0",
4
4
  "description": "The alterspec client: takes tasks of an alterspec export from the dispatcher into a developer's repository.",
5
5
  "license": "MIT",
6
6
  "author": "Alterset d.o.o.",
@@ -31,7 +31,8 @@
31
31
  "./package.json": "./package.json"
32
32
  },
33
33
  "files": [
34
- "dist"
34
+ "dist",
35
+ "assets"
35
36
  ],
36
37
  "engines": {
37
38
  "node": ">=20"
@@ -42,7 +43,7 @@
42
43
  },
43
44
  "publishConfig": {
44
45
  "registry": "https://registry.npmjs.org/",
45
- "access": "restricted"
46
+ "access": "public"
46
47
  },
47
48
  "dependencies": {
48
49
  "commander": "^14.0.3",