@graview/core 0.2.10 → 0.2.12
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/README.md +4 -1
- package/dist/ago-words.d.ts +3 -0
- package/dist/ago-words.d.ts.map +1 -0
- package/dist/ago-words.js +14 -0
- package/dist/ago-words.js.map +1 -0
- package/dist/app-places.d.ts.map +1 -1
- package/dist/app-places.js +2 -1
- package/dist/app-places.js.map +1 -1
- package/dist/binding.d.ts +25 -2
- package/dist/binding.d.ts.map +1 -1
- package/dist/binding.js +141 -47
- package/dist/binding.js.map +1 -1
- package/dist/catalog.d.ts +3 -1
- package/dist/catalog.d.ts.map +1 -1
- package/dist/catalog.js +43 -38
- package/dist/catalog.js.map +1 -1
- package/dist/changed-once.d.ts +32 -0
- package/dist/changed-once.d.ts.map +1 -0
- package/dist/changed-once.js +41 -0
- package/dist/changed-once.js.map +1 -0
- package/dist/cli/check/lenses.d.ts.map +1 -1
- package/dist/cli/check/lenses.js +21 -1
- package/dist/cli/check/lenses.js.map +1 -1
- package/dist/cli/document-schema.d.ts.map +1 -1
- package/dist/cli/document-schema.js +30 -1
- package/dist/cli/document-schema.js.map +1 -1
- package/dist/describe.d.ts +1 -0
- package/dist/describe.d.ts.map +1 -1
- package/dist/describe.js +2 -0
- package/dist/describe.js.map +1 -1
- package/dist/document/act-findings.d.ts +1 -1
- package/dist/document/act-findings.d.ts.map +1 -1
- package/dist/document/act-findings.js +32 -1
- package/dist/document/act-findings.js.map +1 -1
- package/dist/document/blocks.d.ts.map +1 -1
- package/dist/document/blocks.js +2 -2
- package/dist/document/blocks.js.map +1 -1
- package/dist/document/compile.d.ts.map +1 -1
- package/dist/document/compile.js +4 -0
- package/dist/document/compile.js.map +1 -1
- package/dist/document/compiled.d.ts.map +1 -1
- package/dist/document/compiled.js +6 -1
- package/dist/document/compiled.js.map +1 -1
- package/dist/document/describe-place.d.ts.map +1 -1
- package/dist/document/describe-place.js +13 -0
- package/dist/document/describe-place.js.map +1 -1
- package/dist/document/edit.d.ts.map +1 -1
- package/dist/document/edit.js +34 -1
- package/dist/document/edit.js.map +1 -1
- package/dist/document/graview-template.d.ts.map +1 -1
- package/dist/document/graview-template.js +7 -0
- package/dist/document/graview-template.js.map +1 -1
- package/dist/document/to-document.d.ts.map +1 -1
- package/dist/document/to-document.js +4 -0
- package/dist/document/to-document.js.map +1 -1
- package/dist/document.schema.json +190 -6
- package/dist/field-sight.d.ts.map +1 -1
- package/dist/field-sight.js +2 -0
- package/dist/field-sight.js.map +1 -1
- package/dist/geo.d.ts +23 -0
- package/dist/geo.d.ts.map +1 -0
- package/dist/geo.js +29 -0
- package/dist/geo.js.map +1 -0
- package/dist/graph/touched.d.ts +12 -0
- package/dist/graph/touched.d.ts.map +1 -1
- package/dist/graph/touched.js +39 -0
- package/dist/graph/touched.js.map +1 -1
- package/dist/index.d.ts +9 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -1
- package/dist/index.js.map +1 -1
- package/dist/lenses-that-list.d.ts.map +1 -1
- package/dist/lenses-that-list.js +1 -1
- package/dist/lenses-that-list.js.map +1 -1
- package/dist/map-point.d.ts +11 -0
- package/dist/map-point.d.ts.map +1 -0
- package/dist/map-point.js +21 -0
- package/dist/map-point.js.map +1 -0
- package/dist/map-words.d.ts +19 -0
- package/dist/map-words.d.ts.map +1 -0
- package/dist/map-words.js +36 -0
- package/dist/map-words.js.map +1 -0
- package/dist/mutations/define-mutation.d.ts +8 -0
- package/dist/mutations/define-mutation.d.ts.map +1 -1
- package/dist/mutations/define-mutation.js +16 -1
- package/dist/mutations/define-mutation.js.map +1 -1
- package/dist/mutations/form.d.ts.map +1 -1
- package/dist/mutations/form.js +3 -1
- package/dist/mutations/form.js.map +1 -1
- package/dist/ops/declines.d.ts +3 -0
- package/dist/ops/declines.d.ts.map +1 -1
- package/dist/ops/declines.js +6 -2
- package/dist/ops/declines.js.map +1 -1
- package/dist/permissions/sight.d.ts +3 -0
- package/dist/permissions/sight.d.ts.map +1 -1
- package/dist/permissions/sight.js.map +1 -1
- package/dist/place-points.d.ts +22 -0
- package/dist/place-points.d.ts.map +1 -0
- package/dist/place-points.js +36 -0
- package/dist/place-points.js.map +1 -0
- package/dist/places.d.ts +33 -0
- package/dist/places.d.ts.map +1 -1
- package/dist/places.js +60 -0
- package/dist/places.js.map +1 -1
- package/dist/publish.d.ts +1 -0
- package/dist/publish.d.ts.map +1 -1
- package/dist/publishing.d.ts +14 -0
- package/dist/publishing.d.ts.map +1 -1
- package/dist/publishing.js +30 -1
- package/dist/publishing.js.map +1 -1
- package/dist/revisions/problems.d.ts +3 -1
- package/dist/revisions/problems.d.ts.map +1 -1
- package/dist/revisions/problems.js +3 -3
- package/dist/revisions/problems.js.map +1 -1
- package/dist/schema/file-fields.d.ts +7 -1
- package/dist/schema/file-fields.d.ts.map +1 -1
- package/dist/schema/file-fields.js +10 -8
- package/dist/schema/file-fields.js.map +1 -1
- package/dist/schema/files.d.ts +32 -0
- package/dist/schema/files.d.ts.map +1 -1
- package/dist/schema/files.js +14 -1
- package/dist/schema/files.js.map +1 -1
- package/dist/schema/geo-field.d.ts +7 -0
- package/dist/schema/geo-field.d.ts.map +1 -0
- package/dist/schema/geo-field.js +19 -0
- package/dist/schema/geo-field.js.map +1 -0
- package/dist/schema/json-schema.d.ts +0 -5
- package/dist/schema/json-schema.d.ts.map +1 -1
- package/dist/schema/json-schema.js +17 -0
- package/dist/schema/json-schema.js.map +1 -1
- package/dist/seen.d.ts.map +1 -1
- package/dist/seen.js +5 -3
- package/dist/seen.js.map +1 -1
- package/dist/store.d.ts +15 -0
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +51 -16
- package/dist/store.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/views/far-kinds.d.ts +51 -0
- package/dist/views/far-kinds.d.ts.map +1 -0
- package/dist/views/far-kinds.js +57 -0
- package/dist/views/far-kinds.js.map +1 -0
- package/dist/views/types.d.ts +8 -0
- package/dist/views/types.d.ts.map +1 -1
- package/dist/views/types.js.map +1 -1
- package/dist/who.js +2 -2
- package/dist/who.js.map +1 -1
- package/dist/words.d.ts +2 -0
- package/dist/words.d.ts.map +1 -1
- package/dist/words.js +2 -0
- package/dist/words.js.map +1 -1
- package/dist/workflow-shape.d.ts +13 -1
- package/dist/workflow-shape.d.ts.map +1 -1
- package/dist/workflow-shape.js.map +1 -1
- package/dist/workflows/findings.d.ts.map +1 -1
- package/dist/workflows/findings.js.map +1 -1
- package/dist/workflows/on-the-map.d.ts +2 -2
- package/dist/workflows/on-the-map.d.ts.map +1 -1
- package/dist/workflows/on-the-map.js +2 -13
- package/dist/workflows/on-the-map.js.map +1 -1
- package/dist/workflows/step-act.js +2 -2
- package/dist/workflows/step-act.js.map +1 -1
- package/dist/workflows/step-publish.d.ts +4 -0
- package/dist/workflows/step-publish.d.ts.map +1 -0
- package/dist/workflows/step-publish.js +41 -0
- package/dist/workflows/step-publish.js.map +1 -0
- package/dist/workflows/steps.d.ts +1 -0
- package/dist/workflows/steps.d.ts.map +1 -1
- package/dist/workflows/steps.js +2 -0
- package/dist/workflows/steps.js.map +1 -1
- package/dist/workflows/world.d.ts +2 -0
- package/dist/workflows/world.d.ts.map +1 -1
- package/dist/workflows/world.js +3 -0
- package/dist/workflows/world.js.map +1 -1
- package/dist/workflows.d.ts +2 -1
- package/dist/workflows.d.ts.map +1 -1
- package/dist/workflows.js +1 -0
- package/dist/workflows.js.map +1 -1
- package/package.json +1 -1
package/dist/store.js
CHANGED
|
@@ -6,14 +6,14 @@ import { Graph, GraphError, MissingRecordError } from "./graph/graph.js";
|
|
|
6
6
|
import { resolveModules } from "./modules.js";
|
|
7
7
|
import { diffSnapshots, diffTouched, EMPTY_DIFF, isEmptyDiff } from "./graph/diff.js";
|
|
8
8
|
import { normalize, writesOf } from "./graph/primitives.js";
|
|
9
|
-
import { untouched } from "./graph/touched.js";
|
|
9
|
+
import { keptMaking, untouched } from "./graph/touched.js";
|
|
10
10
|
import { keepLinked, keepsLinked } from "./keep-linked.js";
|
|
11
11
|
import { bareOp, inverseOf } from "./ops/inverse.js";
|
|
12
12
|
import { LabelIndex, refusalFor } from "./labels.js";
|
|
13
13
|
import { heldRefKinds, nodeRefArgs } from "./mutations/node-ref.js";
|
|
14
14
|
import { verifyFold } from "./integrity.js";
|
|
15
15
|
import { evaluate } from "./invariants/engine.js";
|
|
16
|
-
import { compileMutation, mintPersonId } from "./mutations/define-mutation.js";
|
|
16
|
+
import { compileMutation, emptyRecordsLeftOut, mintPersonId } from "./mutations/define-mutation.js";
|
|
17
17
|
import { wouldRun } from "./mutations/would-run.js";
|
|
18
18
|
import { actSpelledAs, nearestAct } from "./mutations/act-spelling.js";
|
|
19
19
|
import { InvalidArguments } from "./mutations/invalid-arguments.js";
|
|
@@ -35,7 +35,7 @@ import { MOST_PROPOSED, PROPOSE_CHANGES, proposeChangesMutation } from "./mutati
|
|
|
35
35
|
import { namesUnseen, redact } from "./ops/withheld.js";
|
|
36
36
|
import { writersBehind } from "./ops/writers.js";
|
|
37
37
|
import { nounOf, withArticle } from "./schema/define-node.js";
|
|
38
|
-
import { behind, fieldsJudged, mayKeepField, partialSight, recordsOf, sees } from "./permissions/sight.js";
|
|
38
|
+
import { behind, FIELD_SIGHT, fieldsJudged, mayKeepField, partialSight, recordsOf, sees } from "./permissions/sight.js";
|
|
39
39
|
import { PermissionDeniedError } from "./permissions/types.js";
|
|
40
40
|
import { checkUndo, UndoBlockedError, undoneInverses, undoPrimitives } from "./ops/undo.js";
|
|
41
41
|
import { validateGraph } from "./validate-graph.js";
|
|
@@ -328,7 +328,8 @@ export class Store {
|
|
|
328
328
|
// A store that knows its app's zone begins on the day there, so the first turn of the day says what it moved.
|
|
329
329
|
if (this.dayTimeZone)
|
|
330
330
|
this.ticked = { day: isoToday(this.dayTimeZone), on: isoToday(this.dayTimeZone) };
|
|
331
|
-
|
|
331
|
+
// Who sees a place sees its point, and no one else (`place-points.ts`, taught to the store by field sight).
|
|
332
|
+
this.policy = FIELD_SIGHT.points?.(options.policy, options.schema) ?? options.policy;
|
|
332
333
|
this.publishing = options.publishing;
|
|
333
334
|
this.tidying = options.tidying;
|
|
334
335
|
this.votes = options.votes;
|
|
@@ -660,7 +661,10 @@ export class Store {
|
|
|
660
661
|
/** A call with its act's name as the store spells it, so the log and every check read the one name. */
|
|
661
662
|
spelledCall(call) {
|
|
662
663
|
const name = this.spelled(call.name);
|
|
663
|
-
|
|
664
|
+
// A record argument the act may go without, sent as "", is no value: never a record looked for (`emptyRecordsLeftOut`).
|
|
665
|
+
const input = this.mutations.get(name)?.input;
|
|
666
|
+
const args = input ? emptyRecordsLeftOut(input, call.args) : call.args;
|
|
667
|
+
return name === call.name && args === call.args ? call : { ...call, name, args };
|
|
664
668
|
}
|
|
665
669
|
/** Off by module, or a derived act of a kind the workspace has off. */
|
|
666
670
|
mutationDisabled(mutation) {
|
|
@@ -747,15 +751,44 @@ export class Store {
|
|
|
747
751
|
* `$me` will be, so it is rehearsed: nothing is kept, and asking makes nobody.
|
|
748
752
|
*/
|
|
749
753
|
if (verdict.ok && this.personFor(principal) && this.policy?.grants.some((grant) => grant.ownEnd)) {
|
|
750
|
-
|
|
754
|
+
const refusal = this.refusedOncePersonMade(call, principal);
|
|
755
|
+
if (refusal)
|
|
756
|
+
return { ok: false, refusal };
|
|
757
|
+
}
|
|
758
|
+
return verdict;
|
|
759
|
+
}
|
|
760
|
+
/**
|
|
761
|
+
* WHAT `apply` REFUSES OF A CALL FOR WHO MAY ONCE A PROFILE'S PERSON IS
|
|
762
|
+
* MADE, telling nobody. Judged on the copy `wouldDo` keeps with the person
|
|
763
|
+
* made (`withPersonMade`), one for every call asked while this store's
|
|
764
|
+
* `version` stands: the several bar asks it of every chosen record for
|
|
765
|
+
* every act, and a copy each was thousands of copies. `apply` asks who may
|
|
766
|
+
* and what an agent was declared able to do again once the person is
|
|
767
|
+
* there, and nothing else it refuses for who may reads that person, so the
|
|
768
|
+
* copy answers as a rehearsal of the call would. The rest is rehearsed
|
|
769
|
+
* whole, as before: a call naming a record made in its own change, a
|
|
770
|
+
* proposal (its calls judged with what they make resolved), the app's own
|
|
771
|
+
* actor (what people said it may not do is judged as its call compiles),
|
|
772
|
+
* and a profile `apply` would not take as given.
|
|
773
|
+
*/
|
|
774
|
+
refusedOncePersonMade(call, principal) {
|
|
775
|
+
const as = withValidProfile(principal);
|
|
776
|
+
try {
|
|
777
|
+
const proposing = this.proposer !== undefined && this.mutations.get(this.spelled(call.name)) === this.proposer;
|
|
778
|
+
if (namesMade(call) || proposing || isAutomated(as) || !this.personFor(as))
|
|
751
779
|
this.rehearsal().applying([call], { author: principal });
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
780
|
+
else {
|
|
781
|
+
const twin = this.withPersonMade(as);
|
|
782
|
+
const spelled = twin.spelledCall(call);
|
|
783
|
+
twin.permittedTo(spelled, as);
|
|
784
|
+
twin.declaredTo(spelled, as);
|
|
756
785
|
}
|
|
757
786
|
}
|
|
758
|
-
|
|
787
|
+
catch (error) {
|
|
788
|
+
if (error instanceof PermissionDeniedError)
|
|
789
|
+
return error.refusal;
|
|
790
|
+
}
|
|
791
|
+
return undefined;
|
|
759
792
|
}
|
|
760
793
|
/** What `permits` answers from the grants alone; on an undo, a call already made, so it asks no record of who took it back. */
|
|
761
794
|
judged(call, principal, undoing = false) {
|
|
@@ -1901,7 +1934,7 @@ export class Store {
|
|
|
1901
1934
|
(permitted(call, as), declared(call, as));
|
|
1902
1935
|
const definition = this.mutation(call.name);
|
|
1903
1936
|
if (definition === this.publisher) {
|
|
1904
|
-
const op = PUBLISHING.op(this, { id: this.nextId(), at: this.now() }, call, batch, as, options);
|
|
1937
|
+
const op = PUBLISHING.op(this, { id: this.nextId(), at: this.now() }, call, batch, as, { ...options, ...given("lineage", lined) });
|
|
1905
1938
|
ops.push(op);
|
|
1906
1939
|
intents.push(op.intent);
|
|
1907
1940
|
continue;
|
|
@@ -2063,7 +2096,8 @@ export class Store {
|
|
|
2063
2096
|
receive(ops, options = {}) {
|
|
2064
2097
|
this.stillNow();
|
|
2065
2098
|
const known = new Set(this.log.all().map((op) => op.id));
|
|
2066
|
-
|
|
2099
|
+
// Each record an op adds kept without what its payload said of its making: the op that lands it here says that (`keptMaking`).
|
|
2100
|
+
const fresh = ops.filter((op) => !known.has(op.id)).map(keptMaking);
|
|
2067
2101
|
if (fresh.length === 0)
|
|
2068
2102
|
return [];
|
|
2069
2103
|
const before = this.graph.snapshot();
|
|
@@ -2194,7 +2228,7 @@ export class Store {
|
|
|
2194
2228
|
const rollback = this.graph.snapshot();
|
|
2195
2229
|
const intent = options.intent ?? "Apply a change";
|
|
2196
2230
|
const lineage = this.heldLineage(lineageOf(options.lineage), author);
|
|
2197
|
-
const handed = this.asSplices(primitives, options.base).map(normalize);
|
|
2231
|
+
const handed = keptMaking({ primitives: this.asSplices(primitives, options.base).map(normalize) }).primitives;
|
|
2198
2232
|
// What follows it (Roadmap f-keep-linked), worked out on the graph as it lands: the host's change keeps derived records in step too.
|
|
2199
2233
|
this.graph.applyPrimitives(handed);
|
|
2200
2234
|
let recorded = handed;
|
|
@@ -2814,9 +2848,10 @@ export class Store {
|
|
|
2814
2848
|
this.graph.retouch(forgotten, this.log.all());
|
|
2815
2849
|
// 2. What the server says, in its order.
|
|
2816
2850
|
const known = new Set(this.log.all().map((op) => op.id));
|
|
2817
|
-
for (const
|
|
2818
|
-
if (known.has(
|
|
2851
|
+
for (const handed of change.confirmed) {
|
|
2852
|
+
if (known.has(handed.id))
|
|
2819
2853
|
continue;
|
|
2854
|
+
const op = keptMaking(handed);
|
|
2820
2855
|
try {
|
|
2821
2856
|
this.graph.applyPrimitives(op.primitives, { restoring: op.undoes !== undefined });
|
|
2822
2857
|
}
|