@yaks/task 0.0.0-stage → 0.2.36

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.
Files changed (68) hide show
  1. package/DecisionForm.js +118 -0
  2. package/DecisionForm.js.map +1 -0
  3. package/DecisionForm.ts +211 -0
  4. package/LICENSE +202 -0
  5. package/README.md +389 -2
  6. package/_dist/DecisionForm.d.ts +25 -0
  7. package/_dist/DecisionForm.d.ts.map +1 -0
  8. package/_dist/comp.d.ts +20 -0
  9. package/_dist/comp.d.ts.map +1 -0
  10. package/_dist/decision.d.ts +41 -0
  11. package/_dist/decision.d.ts.map +1 -0
  12. package/_dist/deps.d.ts +58 -0
  13. package/_dist/deps.d.ts.map +1 -0
  14. package/_dist/graph.d.ts +3 -0
  15. package/_dist/graph.d.ts.map +1 -0
  16. package/_dist/mod.d.ts +71 -0
  17. package/_dist/mod.d.ts.map +1 -0
  18. package/_dist/plugin.d.ts +28 -0
  19. package/_dist/plugin.d.ts.map +1 -0
  20. package/_dist/text.d.ts +5 -0
  21. package/_dist/text.d.ts.map +1 -0
  22. package/_dist/tools.d.ts +20 -0
  23. package/_dist/tools.d.ts.map +1 -0
  24. package/_dist/views.d.ts +6 -0
  25. package/_dist/views.d.ts.map +1 -0
  26. package/_dist/vocab.d.ts +7 -0
  27. package/_dist/vocab.d.ts.map +1 -0
  28. package/_dist/words.d.ts +28 -0
  29. package/_dist/words.d.ts.map +1 -0
  30. package/comp.js +66 -0
  31. package/comp.js.map +1 -0
  32. package/comp.ts +77 -0
  33. package/decision.js +156 -0
  34. package/decision.js.map +1 -0
  35. package/decision.ts +174 -0
  36. package/deno.json +1 -0
  37. package/deps.js +127 -0
  38. package/deps.js.map +1 -0
  39. package/deps.ts +163 -0
  40. package/graph.js +9 -0
  41. package/graph.js.map +1 -0
  42. package/graph.ts +10 -0
  43. package/inspect.js +131 -0
  44. package/inspect.js.map +1 -0
  45. package/inspect.ts +144 -0
  46. package/mod.js +71 -0
  47. package/mod.js.map +1 -0
  48. package/mod.ts +83 -0
  49. package/package.json +53 -4
  50. package/plugin.js +46 -0
  51. package/plugin.js.map +1 -0
  52. package/plugin.ts +40 -0
  53. package/text.js +22 -0
  54. package/text.js.map +1 -0
  55. package/text.ts +30 -0
  56. package/tools.js +303 -0
  57. package/tools.js.map +1 -0
  58. package/tools.ts +282 -0
  59. package/views.js +35 -0
  60. package/views.js.map +1 -0
  61. package/views.ts +39 -0
  62. package/vocab.js +18 -0
  63. package/vocab.js.map +1 -0
  64. package/vocab.json +860 -0
  65. package/vocab.ts +20 -0
  66. package/words.js +46 -0
  67. package/words.js.map +1 -0
  68. package/words.ts +57 -0
package/vocab.ts ADDED
@@ -0,0 +1,20 @@
1
+ // The task components and nothing that runs: the module a server imports as
2
+ // `@yaks/task/vocab`. It reaches no storage, no SQL and no runtime, so a
3
+ // browser tab that loads this vocabulary loads nothing else.
4
+ //
5
+ // A task's status is declared in the document itself (the `status` keyword on
6
+ // `task`), so every store reads it from there; nothing here hands one an
7
+ // expression.
8
+
9
+ import type { VocabDoc } from 'jsr:@yaks/vocab@0.2.36'
10
+ import { taskDoc } from './comp.js'
11
+ import manifest from './package.json' with { type: 'json' }
12
+
13
+ export { taskDoc }
14
+
15
+ /** What this package is: its manifest's description, the one place it is
16
+ * written, which a host stamps on each document here. */
17
+ export let description: string = manifest.description
18
+
19
+ /** Every document this plugin declares. */
20
+ export let docs: VocabDoc[] = [taskDoc]
package/words.js ADDED
@@ -0,0 +1,46 @@
1
+ // What a task's status means once it is read.
2
+ //
3
+ // The status itself is computed, never stored. ./vocab.json declares it with
4
+ // the `status` keyword: a ladder over the marks a task wears, where `cancelled`
5
+ // reads cancelled, `completed` (@yaks/kernel's) done, and neither open.
6
+ // @yaks/sql and @yaks/match read it from that one declaration, so no code here
7
+ // writes the rule out. Order is the rule: a task cancelled after it was
8
+ // completed reads `cancelled`, since calling work off is a later fact about it
9
+ // than finishing was.
10
+ //
11
+ // The ladder is extensible because status is: a graph that leases its tasks
12
+ // adds a rung where it declares the lease, and @yaks/session reads a held claim
13
+ // as `wip`. Somebody working on a task has not finished it, which is why
14
+ // `settled` names the two statuses that end one rather than every rung.
15
+ import { statusOf as ladder } from "@yaks/match";
16
+ import { TASK } from "./comp.js";
17
+ /**
18
+ * A task's status, read off the bundle through the ladder the vocabulary
19
+ * declares: the first rung it wears, else the status its store read, else
20
+ * `open`. An entity that is not a task has none, and reads `null`.
21
+ *
22
+ * ```ts
23
+ * import { assertEquals } from '@std/assert'
24
+ * import { loadVocab } from '@yaks/vocab'
25
+ * import { kernelDoc, kernelKeywords } from '@yaks/kernel'
26
+ * import { statusOf, taskDoc } from '@yaks/task'
27
+ *
28
+ * let v = loadVocab([kernelDoc, taskDoc], [kernelKeywords])
29
+ * let task = { entity: { eid: 't1' }, task: {} }
30
+ * assertEquals(statusOf(v, task), 'open')
31
+ * assertEquals(statusOf(v, { ...task, completed: {} }), 'done')
32
+ * assertEquals(statusOf(v, { ...task, completed: {}, cancelled: {} }), 'cancelled')
33
+ * assertEquals(statusOf(v, { entity: { eid: 'x' }, completed: {} }), null)
34
+ * ```
35
+ */ export let statusOf = (v, b)=>ladder(v, TASK, b);
36
+ /** What {@link statusOf} reads of a task: `task` and the mark on each rung of
37
+ * the ladder the vocabulary declares. A read naming only these answers the
38
+ * status without the rest the task wears. */ export let statusComps = (v)=>[
39
+ TASK,
40
+ ...(v.comp(TASK)?.ladder?.rungs ?? []).map((r)=>r.comp)
41
+ ];
42
+ /** Does this status mean the work is over: finished, or called off? An open
43
+ * task has not settled, and neither has one somebody is on (`wip`). This is
44
+ * what {@link https://jsr.io/@yaks/task/doc/~/openDeps | openDeps} counts by
45
+ * its absence. */ export let settled = (status)=>status == 'done' || status == 'cancelled';
46
+ //# sourceMappingURL=words.js.map
package/words.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"words.js","sources":["./words.ts"],"names":[],"mappings":"AAAA,8CAA8C;AAC9C,EAAE;AACF,6EAA6E;AAC7E,gFAAgF;AAChF,wEAAwE;AACxE,+EAA+E;AAC/E,wEAAwE;AACxE,+EAA+E;AAC/E,sBAAsB;AACtB,EAAE;AACF,4EAA4E;AAC5E,gFAAgF;AAChF,yEAAyE;AACzE,wEAAwE;AAExE,SAAS,YAAY,MAAM,2BAAgC;AAE3D,SAAS,IAAI,oBAAmB;AAEhC;;;;;;;;;;;;;;;;;;CAkBC,GACD,OAAO,IAAI,WAAW,CACpB,GACA,IACkB,OAAO,GAAG,MAAM,GAAE;AAEtC;;2CAE2C,GAC3C,OAAO,IAAI,cAAc,CAAC,IAAuB;IAC/C;OACG,CAAC,EAAE,IAAI,CAAC,OAAO,QAAQ,SAAS,EAAE,EAAE,GAAG,CAAC,CAAC,IAAM,EAAE,IAAI;GACzD,CAAA;AAED;;;gBAGgB,GAChB,OAAO,IAAI,UAAU,CAAC,SACpB,UAAU,UAAU,UAAU,YAAW"}
package/words.ts ADDED
@@ -0,0 +1,57 @@
1
+ // What a task's status means once it is read.
2
+ //
3
+ // The status itself is computed, never stored. ./vocab.json declares it with
4
+ // the `status` keyword: a ladder over the marks a task wears, where `cancelled`
5
+ // reads cancelled, `completed` (@yaks/kernel's) done, and neither open.
6
+ // @yaks/sql and @yaks/match read it from that one declaration, so no code here
7
+ // writes the rule out. Order is the rule: a task cancelled after it was
8
+ // completed reads `cancelled`, since calling work off is a later fact about it
9
+ // than finishing was.
10
+ //
11
+ // The ladder is extensible because status is: a graph that leases its tasks
12
+ // adds a rung where it declares the lease, and @yaks/session reads a held claim
13
+ // as `wip`. Somebody working on a task has not finished it, which is why
14
+ // `settled` names the two statuses that end one rather than every rung.
15
+
16
+ import { statusOf as ladder } from '@yaks/match'
17
+ import type { Vocab } from 'jsr:@yaks/vocab@0.2.36'
18
+ import { TASK } from './comp.js'
19
+
20
+ /**
21
+ * A task's status, read off the bundle through the ladder the vocabulary
22
+ * declares: the first rung it wears, else the status its store read, else
23
+ * `open`. An entity that is not a task has none, and reads `null`.
24
+ *
25
+ * ```ts
26
+ * import { assertEquals } from '@std/assert'
27
+ * import { loadVocab } from '@yaks/vocab'
28
+ * import { kernelDoc, kernelKeywords } from '@yaks/kernel'
29
+ * import { statusOf, taskDoc } from '@yaks/task'
30
+ *
31
+ * let v = loadVocab([kernelDoc, taskDoc], [kernelKeywords])
32
+ * let task = { entity: { eid: 't1' }, task: {} }
33
+ * assertEquals(statusOf(v, task), 'open')
34
+ * assertEquals(statusOf(v, { ...task, completed: {} }), 'done')
35
+ * assertEquals(statusOf(v, { ...task, completed: {}, cancelled: {} }), 'cancelled')
36
+ * assertEquals(statusOf(v, { entity: { eid: 'x' }, completed: {} }), null)
37
+ * ```
38
+ */
39
+ export let statusOf = (
40
+ v: Vocab,
41
+ b: Record<string, unknown>,
42
+ ): string | null => ladder(v, TASK, b)
43
+
44
+ /** What {@link statusOf} reads of a task: `task` and the mark on each rung of
45
+ * the ladder the vocabulary declares. A read naming only these answers the
46
+ * status without the rest the task wears. */
47
+ export let statusComps = (v: Vocab): string[] => [
48
+ TASK,
49
+ ...(v.comp(TASK)?.ladder?.rungs ?? []).map((r) => r.comp),
50
+ ]
51
+
52
+ /** Does this status mean the work is over: finished, or called off? An open
53
+ * task has not settled, and neither has one somebody is on (`wip`). This is
54
+ * what {@link https://jsr.io/@yaks/task/doc/~/openDeps | openDeps} counts by
55
+ * its absence. */
56
+ export let settled = (status?: string | null): boolean =>
57
+ status == 'done' || status == 'cancelled'