@graview/core 0.1.2 → 0.1.4

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 (123) hide show
  1. package/dist/app.d.ts +9 -1
  2. package/dist/app.d.ts.map +1 -1
  3. package/dist/app.js.map +1 -1
  4. package/dist/capabilities.js +1 -1
  5. package/dist/capabilities.js.map +1 -1
  6. package/dist/cli/check/policy.d.ts.map +1 -1
  7. package/dist/cli/check/policy.js +40 -0
  8. package/dist/cli/check/policy.js.map +1 -1
  9. package/dist/cli/index.d.ts +2 -1
  10. package/dist/cli/index.d.ts.map +1 -1
  11. package/dist/cli/index.js.map +1 -1
  12. package/dist/document/canonical.d.ts +2 -1
  13. package/dist/document/canonical.d.ts.map +1 -1
  14. package/dist/document/canonical.js +2 -1
  15. package/dist/document/canonical.js.map +1 -1
  16. package/dist/document/compile.d.ts.map +1 -1
  17. package/dist/document/compile.js +22 -2
  18. package/dist/document/compile.js.map +1 -1
  19. package/dist/document/diff.d.ts.map +1 -1
  20. package/dist/document/diff.js +8 -1
  21. package/dist/document/diff.js.map +1 -1
  22. package/dist/document/edit.d.ts +7 -1
  23. package/dist/document/edit.d.ts.map +1 -1
  24. package/dist/document/edit.js +58 -2
  25. package/dist/document/edit.js.map +1 -1
  26. package/dist/document/index.d.ts +1 -1
  27. package/dist/document/index.d.ts.map +1 -1
  28. package/dist/document/migrate.d.ts.map +1 -1
  29. package/dist/document/migrate.js +3 -2
  30. package/dist/document/migrate.js.map +1 -1
  31. package/dist/document/patch.d.ts.map +1 -1
  32. package/dist/document/patch.js +2 -5
  33. package/dist/document/patch.js.map +1 -1
  34. package/dist/document/schema.d.ts +12 -10
  35. package/dist/document/schema.d.ts.map +1 -1
  36. package/dist/document/schema.js +2 -0
  37. package/dist/document/schema.js.map +1 -1
  38. package/dist/document/to-document.d.ts.map +1 -1
  39. package/dist/document/to-document.js +5 -1
  40. package/dist/document/to-document.js.map +1 -1
  41. package/dist/graph/graph.d.ts +9 -0
  42. package/dist/graph/graph.d.ts.map +1 -1
  43. package/dist/graph/graph.js +18 -4
  44. package/dist/graph/graph.js.map +1 -1
  45. package/dist/index.d.ts +11 -8
  46. package/dist/index.d.ts.map +1 -1
  47. package/dist/index.js +7 -5
  48. package/dist/index.js.map +1 -1
  49. package/dist/integrity.d.ts.map +1 -1
  50. package/dist/integrity.js +35 -5
  51. package/dist/integrity.js.map +1 -1
  52. package/dist/invariants/types.d.ts +1 -1
  53. package/dist/invariants/types.d.ts.map +1 -1
  54. package/dist/labels.js +1 -1
  55. package/dist/labels.js.map +1 -1
  56. package/dist/mutations/define-mutation.d.ts +22 -2
  57. package/dist/mutations/define-mutation.d.ts.map +1 -1
  58. package/dist/mutations/define-mutation.js +21 -8
  59. package/dist/mutations/define-mutation.js.map +1 -1
  60. package/dist/mutations/node-ref.d.ts +5 -2
  61. package/dist/mutations/node-ref.d.ts.map +1 -1
  62. package/dist/mutations/node-ref.js +28 -7
  63. package/dist/mutations/node-ref.js.map +1 -1
  64. package/dist/mutations/types.d.ts +2 -2
  65. package/dist/mutations/types.d.ts.map +1 -1
  66. package/dist/ops/log.d.ts +22 -0
  67. package/dist/ops/log.d.ts.map +1 -1
  68. package/dist/ops/log.js +14 -0
  69. package/dist/ops/log.js.map +1 -1
  70. package/dist/ops/served.d.ts +80 -0
  71. package/dist/ops/served.d.ts.map +1 -0
  72. package/dist/ops/served.js +316 -0
  73. package/dist/ops/served.js.map +1 -0
  74. package/dist/ops/types.d.ts +8 -0
  75. package/dist/ops/types.d.ts.map +1 -1
  76. package/dist/ops/undo.d.ts +6 -0
  77. package/dist/ops/undo.d.ts.map +1 -1
  78. package/dist/ops/undo.js +3 -0
  79. package/dist/ops/undo.js.map +1 -1
  80. package/dist/ops/withheld.d.ts +63 -8
  81. package/dist/ops/withheld.d.ts.map +1 -1
  82. package/dist/ops/withheld.js +198 -22
  83. package/dist/ops/withheld.js.map +1 -1
  84. package/dist/ops/writers.d.ts +29 -0
  85. package/dist/ops/writers.d.ts.map +1 -0
  86. package/dist/ops/writers.js +98 -0
  87. package/dist/ops/writers.js.map +1 -0
  88. package/dist/permissions/sight.d.ts +33 -4
  89. package/dist/permissions/sight.d.ts.map +1 -1
  90. package/dist/permissions/sight.js +106 -22
  91. package/dist/permissions/sight.js.map +1 -1
  92. package/dist/presence.d.ts +48 -1
  93. package/dist/presence.d.ts.map +1 -1
  94. package/dist/presence.js +51 -2
  95. package/dist/presence.js.map +1 -1
  96. package/dist/refusal.d.ts +38 -0
  97. package/dist/refusal.d.ts.map +1 -0
  98. package/dist/refusal.js +44 -0
  99. package/dist/refusal.js.map +1 -0
  100. package/dist/schema/json-schema.d.ts.map +1 -1
  101. package/dist/schema/json-schema.js +27 -1
  102. package/dist/schema/json-schema.js.map +1 -1
  103. package/dist/schema/schema.d.ts +19 -4
  104. package/dist/schema/schema.d.ts.map +1 -1
  105. package/dist/schema/schema.js.map +1 -1
  106. package/dist/schema/types.d.ts +11 -0
  107. package/dist/schema/types.d.ts.map +1 -1
  108. package/dist/seen.d.ts +60 -1
  109. package/dist/seen.d.ts.map +1 -1
  110. package/dist/seen.js +467 -29
  111. package/dist/seen.js.map +1 -1
  112. package/dist/store.d.ts +151 -10
  113. package/dist/store.d.ts.map +1 -1
  114. package/dist/store.js +228 -40
  115. package/dist/store.js.map +1 -1
  116. package/dist/testing.js.map +1 -1
  117. package/dist/validate-graph.d.ts +2 -1
  118. package/dist/validate-graph.d.ts.map +1 -1
  119. package/dist/validate-graph.js +8 -1
  120. package/dist/validate-graph.js.map +1 -1
  121. package/dist/version.d.ts +1 -1
  122. package/dist/version.js +1 -1
  123. package/package.json +2 -2
package/dist/seen.d.ts CHANGED
@@ -1,5 +1,10 @@
1
+ import type { GraphDiff } from "./graph/diff.js";
2
+ import type { GraphNodeBase } from "./graph/types.js";
3
+ import type { GraphEdge } from "./graph/types.js";
4
+ import type { Violation } from "./invariants/types.js";
1
5
  import { type LogReading } from "./ops/log.js";
2
6
  import type { Operation } from "./ops/types.js";
7
+ import { type SeatLens } from "./ops/withheld.js";
3
8
  import type { Policy, Principal } from "./permissions/types.js";
4
9
  import type { AnySchema } from "./schema/schema.js";
5
10
  import type { Store } from "./store.js";
@@ -17,12 +22,21 @@ interface Judged {
17
22
  in(id: string): readonly {
18
23
  readonly id: string;
19
24
  }[];
25
+ /** A store's own graph says its links, so an op can be judged where it stood (FR-55). */
26
+ outEdges?(id: string): readonly GraphEdge[];
27
+ inEdges?(id: string): readonly GraphEdge[];
20
28
  };
21
29
  readonly log: LogReading;
22
30
  /** The kinds of the modules this workspace has off (FR-12), kept from every seat as a sight keeps a record. */
23
31
  readonly modules?: {
24
32
  readonly disabledKinds: ReadonlySet<string>;
25
33
  };
34
+ /** The declaration, to say which of a kind's fields a record may be served without (FR-55). */
35
+ readonly schema?: {
36
+ tryDefinition(kind: string): {
37
+ readonly fields: unknown;
38
+ } | undefined;
39
+ };
26
40
  }
27
41
  /**
28
42
  * WHETHER ANYTHING IS KEPT FROM THIS SEAT: a sight the policy declares
@@ -35,10 +49,55 @@ export declare function hidesFrom(store: Judged, principal: Principal): boolean;
35
49
  * now; one since removed by the kind the log says it was, and so never by
36
50
  * an edge it no longer has; and a string that names no record at all (a
37
51
  * label in a call's arguments) is nothing to keep from anybody.
52
+ *
53
+ * THE JUDGEMENT FOLLOWS THE STORE (FR-51). It reads the policy, the
54
+ * modules that are off and who made each record as it is asked, not as it
55
+ * was taken: one taken before a commit and asked after it knows the record
56
+ * just made is its maker's own. Asking costs nothing more for that — who
57
+ * made what is an index the log keeps as it goes (`recordsOf`).
38
58
  */
39
59
  export declare function seesId(store: Judged, principal: Principal): (id: string) => boolean;
40
- /** The store's log as one seat may read it: every op in its place, the ones it may not see withheld (FR-16). */
60
+ /**
61
+ * WHAT ONE SEAT IS SERVED (FR-55) — the judgement every surface built on
62
+ * the seat view reads, so a snapshot, a log, an answer and the wire cannot
63
+ * disagree about it.
64
+ *
65
+ * Its sight (`seesId`) says which records it may be told of. An id is
66
+ * minted from a label, so a seen record's field that holds the id of one
67
+ * it may not see tells it that record's name: such a field is CLEARED in
68
+ * what the seat is served — the record stays, usable, without it — when
69
+ * the kind's declaration lets a record be without it. When the field is
70
+ * one the record cannot do without, clearing it would serve a record that
71
+ * fails its own declaration, and a client refuses to load that: the record
72
+ * is WITHHELD from the seat whole instead, as if its sight did not reach
73
+ * it — not in the graph, the snapshot, the log's primitives or an edge.
74
+ * Which ids a field names is judged by the seat's sight alone, so a record
75
+ * naming one withheld this way still names a record the seat may see.
76
+ */
77
+ export declare function seatLens(store: Judged, principal: Principal): SeatLens;
78
+ /** The store's log as one seat may read it: every op in its place, the ones it may not see withheld (FR-16), and no id it may not see in any of them (FR-55). */
41
79
  export declare function logSeenBy(store: Judged, principal: Principal): readonly Operation[];
80
+ /**
81
+ * A CHANGE'S ANSWER AS ONE SEAT MAY BE TOLD IT (FR-55) — the diff, the
82
+ * primitives, the ops and the rules it would break or mend of a preview,
83
+ * an apply or an undo, for a surface that hands a seat what its own act
84
+ * did: an act may touch what its own seat may not see. Records and edges
85
+ * it is not served go, a field naming one it may not see is cleared as
86
+ * the view clears it, the ops are redacted as its log is, and a sentence
87
+ * that names what it may not see says only that a change it cannot see
88
+ * happened. With nothing kept from the seat, the answer as it is.
89
+ */
90
+ export declare function answerSeenBy<A extends {
91
+ readonly diff?: GraphDiff<GraphNodeBase>;
92
+ readonly primitives?: readonly unknown[];
93
+ readonly reads?: readonly string[];
94
+ readonly writes?: readonly string[];
95
+ readonly intent?: string;
96
+ readonly introduces?: readonly Violation[];
97
+ readonly resolves?: readonly Violation[];
98
+ readonly violationsAfter?: readonly Violation[];
99
+ readonly ops?: readonly Operation[];
100
+ }>(store: Judged, principal: Principal, answer: A): A;
42
101
  /** A log reading over a seat's redacted ops, for `checkUndo`. */
43
102
  export declare function readingOf(ops: readonly Operation[], epochs: LogReading["epochs"]): LogReading;
44
103
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"seen.d.ts","sourceRoot":"","s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