@graview/core 0.1.48 → 0.1.50
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/answer-seen.js +2 -2
- package/dist/answer-seen.js.map +1 -1
- package/dist/app.d.ts +11 -0
- package/dist/app.d.ts.map +1 -1
- package/dist/app.js.map +1 -1
- package/dist/capabilities.d.ts +7 -1
- package/dist/capabilities.d.ts.map +1 -1
- package/dist/capabilities.js.map +1 -1
- package/dist/cli/check/forms.js +2 -2
- package/dist/cli/check/forms.js.map +1 -1
- package/dist/cli/check/index.d.ts +1 -0
- package/dist/cli/check/index.d.ts.map +1 -1
- package/dist/cli/check/index.js +1 -0
- package/dist/cli/check/index.js.map +1 -1
- package/dist/cli/check/policy.d.ts.map +1 -1
- package/dist/cli/check/policy.js +9 -1
- package/dist/cli/check/policy.js.map +1 -1
- package/dist/cli/check/publishing.d.ts +13 -0
- package/dist/cli/check/publishing.d.ts.map +1 -0
- package/dist/cli/check/publishing.js +36 -0
- package/dist/cli/check/publishing.js.map +1 -0
- package/dist/cli/check/relations.d.ts.map +1 -1
- package/dist/cli/check/relations.js +4 -1
- package/dist/cli/check/relations.js.map +1 -1
- package/dist/cli/check.d.ts.map +1 -1
- package/dist/cli/check.js +2 -1
- package/dist/cli/check.js.map +1 -1
- package/dist/cli/describe.d.ts.map +1 -1
- package/dist/cli/describe.js +15 -0
- package/dist/cli/describe.js.map +1 -1
- package/dist/cli/docs.d.ts.map +1 -1
- package/dist/cli/docs.js +2 -1
- package/dist/cli/docs.js.map +1 -1
- package/dist/cli/index.d.ts +1 -0
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +3 -1
- package/dist/cli/index.js.map +1 -1
- package/dist/document/act-spellings.d.ts +12 -0
- package/dist/document/act-spellings.d.ts.map +1 -0
- package/dist/document/act-spellings.js +56 -0
- package/dist/document/act-spellings.js.map +1 -0
- package/dist/document/blocks.d.ts.map +1 -1
- package/dist/document/blocks.js +4 -2
- package/dist/document/blocks.js.map +1 -1
- package/dist/document/compile.d.ts.map +1 -1
- package/dist/document/compile.js +5 -2
- package/dist/document/compile.js.map +1 -1
- package/dist/document/compiled.d.ts.map +1 -1
- package/dist/document/compiled.js +5 -0
- package/dist/document/compiled.js.map +1 -1
- package/dist/document/describe-forms.js +2 -2
- package/dist/document/describe-forms.js.map +1 -1
- package/dist/document/field-spec.d.ts.map +1 -1
- package/dist/document/field-spec.js +8 -2
- package/dist/document/field-spec.js.map +1 -1
- package/dist/document/format-findings.d.ts.map +1 -1
- package/dist/document/format-findings.js +5 -0
- package/dist/document/format-findings.js.map +1 -1
- package/dist/document/page-fields.d.ts.map +1 -1
- package/dist/document/page-fields.js +8 -6
- package/dist/document/page-fields.js.map +1 -1
- package/dist/document/schema.d.ts +13 -0
- package/dist/document/schema.d.ts.map +1 -1
- package/dist/document/schema.js +16 -0
- package/dist/document/schema.js.map +1 -1
- package/dist/document/to-document.d.ts.map +1 -1
- package/dist/document/to-document.js +1 -0
- package/dist/document/to-document.js.map +1 -1
- package/dist/document.schema.json +42 -2
- package/dist/field-sight.js +5 -4
- package/dist/field-sight.js.map +1 -1
- package/dist/format-error.d.ts +54 -0
- package/dist/format-error.d.ts.map +1 -0
- package/dist/format-error.js +73 -0
- package/dist/format-error.js.map +1 -0
- package/dist/formats.d.ts +16 -13
- package/dist/formats.d.ts.map +1 -1
- package/dist/formats.js +18 -17
- package/dist/formats.js.map +1 -1
- package/dist/forms.d.ts +1 -1
- package/dist/forms.d.ts.map +1 -1
- package/dist/forms.js +1 -1
- package/dist/forms.js.map +1 -1
- package/dist/graph/diff.js +1 -1
- package/dist/graph/diff.js.map +1 -1
- package/dist/graph/edge-fields.d.ts +20 -0
- package/dist/graph/edge-fields.d.ts.map +1 -0
- package/dist/graph/edge-fields.js +21 -0
- package/dist/graph/edge-fields.js.map +1 -0
- package/dist/graph/graph.d.ts +3 -0
- package/dist/graph/graph.d.ts.map +1 -1
- package/dist/graph/graph.js +57 -4
- package/dist/graph/graph.js.map +1 -1
- package/dist/graph/primitives.d.ts +22 -2
- package/dist/graph/primitives.d.ts.map +1 -1
- package/dist/graph/primitives.js +20 -0
- package/dist/graph/primitives.js.map +1 -1
- package/dist/graph/types.d.ts +15 -1
- package/dist/graph/types.d.ts.map +1 -1
- package/dist/graph/types.js +0 -0
- package/dist/graph/types.js.map +1 -1
- package/dist/history.d.ts +23 -2
- package/dist/history.d.ts.map +1 -1
- package/dist/history.js +23 -3
- package/dist/history.js.map +1 -1
- package/dist/index.d.ts +19 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +15 -3
- package/dist/index.js.map +1 -1
- package/dist/integrity.d.ts.map +1 -1
- package/dist/integrity.js +2 -1
- package/dist/integrity.js.map +1 -1
- package/dist/intelligence-bridge.d.ts +11 -2
- package/dist/intelligence-bridge.d.ts.map +1 -1
- package/dist/linked.d.ts +1 -0
- package/dist/linked.d.ts.map +1 -1
- package/dist/linked.js +1 -0
- package/dist/linked.js.map +1 -1
- package/dist/mutations/asked-order.d.ts +54 -0
- package/dist/mutations/asked-order.d.ts.map +1 -0
- package/dist/mutations/asked-order.js +78 -0
- package/dist/mutations/asked-order.js.map +1 -0
- package/dist/mutations/define-mutation.d.ts +4 -0
- package/dist/mutations/define-mutation.d.ts.map +1 -1
- package/dist/mutations/define-mutation.js +32 -8
- package/dist/mutations/define-mutation.js.map +1 -1
- package/dist/mutations/derive-edits.d.ts.map +1 -1
- package/dist/mutations/derive-edits.js +3 -1
- package/dist/mutations/derive-edits.js.map +1 -1
- package/dist/mutations/form.d.ts +7 -0
- package/dist/mutations/form.d.ts.map +1 -1
- package/dist/mutations/form.js +9 -0
- package/dist/mutations/form.js.map +1 -1
- package/dist/mutations/keep-link.d.ts.map +1 -1
- package/dist/mutations/keep-link.js +4 -2
- package/dist/mutations/keep-link.js.map +1 -1
- package/dist/mutations/type-text.d.ts +49 -0
- package/dist/mutations/type-text.d.ts.map +1 -0
- package/dist/mutations/type-text.js +106 -0
- package/dist/mutations/type-text.js.map +1 -0
- package/dist/mutations/types.d.ts +8 -0
- package/dist/mutations/types.d.ts.map +1 -1
- package/dist/mutations/visitor-form.d.ts.map +1 -1
- package/dist/mutations/visitor-form.js +4 -4
- package/dist/mutations/visitor-form.js.map +1 -1
- package/dist/ops/digest.d.ts +17 -6
- package/dist/ops/digest.d.ts.map +1 -1
- package/dist/ops/digest.js +36 -15
- package/dist/ops/digest.js.map +1 -1
- package/dist/ops/kept-fields.d.ts +1 -1
- package/dist/ops/kept-fields.d.ts.map +1 -1
- package/dist/ops/kept-fields.js +4 -1
- package/dist/ops/kept-fields.js.map +1 -1
- package/dist/ops/lineage.d.ts +37 -5
- package/dist/ops/lineage.d.ts.map +1 -1
- package/dist/ops/lineage.js +47 -16
- package/dist/ops/lineage.js.map +1 -1
- package/dist/ops/log.d.ts.map +1 -1
- package/dist/ops/log.js +3 -0
- package/dist/ops/log.js.map +1 -1
- package/dist/ops/provenance.d.ts.map +1 -1
- package/dist/ops/provenance.js +3 -1
- package/dist/ops/provenance.js.map +1 -1
- package/dist/ops/revisions.d.ts +8 -2
- package/dist/ops/revisions.d.ts.map +1 -1
- package/dist/ops/revisions.js +12 -3
- package/dist/ops/revisions.js.map +1 -1
- package/dist/ops/served.d.ts.map +1 -1
- package/dist/ops/served.js +30 -4
- package/dist/ops/served.js.map +1 -1
- package/dist/ops/suggestions.d.ts +50 -4
- package/dist/ops/suggestions.d.ts.map +1 -1
- package/dist/ops/suggestions.js +13 -7
- package/dist/ops/suggestions.js.map +1 -1
- package/dist/ops/tidying.d.ts +33 -4
- package/dist/ops/tidying.d.ts.map +1 -1
- package/dist/ops/tidying.js +50 -9
- package/dist/ops/tidying.js.map +1 -1
- package/dist/ops/types.d.ts +51 -3
- package/dist/ops/types.d.ts.map +1 -1
- package/dist/ops/types.js +16 -1
- package/dist/ops/types.js.map +1 -1
- package/dist/ops/undo.d.ts +15 -2
- package/dist/ops/undo.d.ts.map +1 -1
- package/dist/ops/undo.js +22 -3
- package/dist/ops/undo.js.map +1 -1
- package/dist/ops/withheld.d.ts.map +1 -1
- package/dist/ops/withheld.js +4 -0
- package/dist/ops/withheld.js.map +1 -1
- package/dist/ops/writers.d.ts.map +1 -1
- package/dist/ops/writers.js +3 -0
- package/dist/ops/writers.js.map +1 -1
- package/dist/past.d.ts +1 -0
- package/dist/past.d.ts.map +1 -1
- package/dist/past.js +9 -2
- package/dist/past.js.map +1 -1
- package/dist/persistence/memory.d.ts +1 -1
- package/dist/persistence/memory.d.ts.map +1 -1
- package/dist/persistence/memory.js +5 -1
- package/dist/persistence/memory.js.map +1 -1
- package/dist/persistence/sql.d.ts +1 -1
- package/dist/persistence/sql.d.ts.map +1 -1
- package/dist/persistence/sql.js +45 -5
- package/dist/persistence/sql.js.map +1 -1
- package/dist/persistence/sqlite.d.ts +1 -0
- package/dist/persistence/sqlite.d.ts.map +1 -1
- package/dist/persistence/sqlite.js +1 -0
- package/dist/persistence/sqlite.js.map +1 -1
- package/dist/persistence/types.d.ts +34 -1
- package/dist/persistence/types.d.ts.map +1 -1
- package/dist/persistence/types.js +35 -1
- package/dist/persistence/types.js.map +1 -1
- package/dist/presence.d.ts +2 -1
- package/dist/presence.d.ts.map +1 -1
- package/dist/presence.js +2 -1
- package/dist/presence.js.map +1 -1
- package/dist/publish.d.ts +78 -0
- package/dist/publish.d.ts.map +1 -0
- package/dist/publish.js +23 -0
- package/dist/publish.js.map +1 -0
- package/dist/publishing.d.ts +10 -0
- package/dist/publishing.d.ts.map +1 -0
- package/dist/publishing.js +168 -0
- package/dist/publishing.js.map +1 -0
- package/dist/refused.d.ts +13 -6
- package/dist/refused.d.ts.map +1 -1
- package/dist/refused.js +13 -6
- package/dist/refused.js.map +1 -1
- package/dist/schema/collaborative.d.ts +14 -0
- package/dist/schema/collaborative.d.ts.map +1 -0
- package/dist/schema/collaborative.js +65 -0
- package/dist/schema/collaborative.js.map +1 -0
- package/dist/schema/json-schema.d.ts +1 -1
- package/dist/schema/json-schema.d.ts.map +1 -1
- package/dist/schema/json-schema.js +11 -1
- package/dist/schema/json-schema.js.map +1 -1
- package/dist/seen.d.ts +44 -1
- package/dist/seen.d.ts.map +1 -1
- package/dist/seen.js +59 -14
- package/dist/seen.js.map +1 -1
- package/dist/store.d.ts +79 -4
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +123 -25
- package/dist/store.js.map +1 -1
- package/dist/subscriptions.d.ts.map +1 -1
- package/dist/subscriptions.js +13 -1
- package/dist/subscriptions.js.map +1 -1
- package/dist/sync/engine.d.ts.map +1 -1
- package/dist/sync/engine.js +43 -15
- package/dist/sync/engine.js.map +1 -1
- package/dist/sync/index.d.ts +1 -1
- package/dist/sync/index.d.ts.map +1 -1
- package/dist/sync/index.js +1 -1
- package/dist/sync/index.js.map +1 -1
- package/dist/sync/types.d.ts +10 -0
- package/dist/sync/types.d.ts.map +1 -1
- package/dist/sync/types.js +8 -0
- package/dist/sync/types.js.map +1 -1
- package/dist/testing.d.ts.map +1 -1
- package/dist/testing.js +1 -0
- package/dist/testing.js.map +1 -1
- package/dist/text/diff.d.ts +10 -0
- package/dist/text/diff.d.ts.map +1 -0
- package/dist/text/diff.js +26 -0
- package/dist/text/diff.js.map +1 -0
- package/dist/text/since.d.ts +29 -0
- package/dist/text/since.d.ts.map +1 -0
- package/dist/text/since.js +66 -0
- package/dist/text/since.js.map +1 -0
- package/dist/text/splice.d.ts +51 -0
- package/dist/text/splice.d.ts.map +1 -0
- package/dist/text/splice.js +71 -0
- package/dist/text/splice.js.map +1 -0
- package/dist/text/typing-hook.d.ts +37 -0
- package/dist/text/typing-hook.d.ts.map +1 -0
- package/dist/text/typing-hook.js +16 -0
- package/dist/text/typing-hook.js.map +1 -0
- package/dist/tidying.d.ts +25 -7
- package/dist/tidying.d.ts.map +1 -1
- package/dist/tidying.js +26 -11
- package/dist/tidying.js.map +1 -1
- package/dist/typing.d.ts +2 -0
- package/dist/typing.d.ts.map +1 -0
- package/dist/typing.js +109 -0
- package/dist/typing.js.map +1 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/who.d.ts +1 -1
- package/dist/who.d.ts.map +1 -1
- package/dist/who.js +5 -2
- package/dist/who.js.map +1 -1
- package/package.json +12 -2
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { Primitive } from "../graph/primitives.js";
|
|
2
|
+
import type { FieldRevision } from "../ops/revisions.js";
|
|
3
|
+
import type { Operation } from "../ops/types.js";
|
|
4
|
+
import type { AnyMutationDefinition } from "../mutations/types.js";
|
|
5
|
+
/** The name of the act that types into a text field typed together. */
|
|
6
|
+
export declare const TYPE_TEXT = "type-text";
|
|
7
|
+
/** What a store hands the hooks: its declaration, graph and log. */
|
|
8
|
+
export interface TypingStore {
|
|
9
|
+
readonly schema: {
|
|
10
|
+
tryDefinition(kind: string): unknown;
|
|
11
|
+
};
|
|
12
|
+
readonly graph: {
|
|
13
|
+
getNode(id: string): unknown;
|
|
14
|
+
};
|
|
15
|
+
readonly log: {
|
|
16
|
+
all(): readonly Operation[];
|
|
17
|
+
readonly horizon: number;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
export declare const TYPING: {
|
|
21
|
+
/** "Type text", for one store: a keystroke carried over the log since the revision it was made at. */
|
|
22
|
+
typeText?: (store: TypingStore) => AnyMutationDefinition<never>;
|
|
23
|
+
/** Who may type into a field of a record of a kind: the acts any one of which permits it. */
|
|
24
|
+
via?: (schema: TypingStore["schema"], mutations: readonly AnyMutationDefinition<never>[], kind: string | undefined, field: unknown) => readonly string[];
|
|
25
|
+
/** Whether one field of a kind is typed together, by the declaration. */
|
|
26
|
+
collaborative?: (schema: TypingStore["schema"], kind: string | undefined, field: string) => boolean;
|
|
27
|
+
/** These primitives with each whole write over text typed together written as a splice. */
|
|
28
|
+
asSplices?: (store: TypingStore, primitives: readonly Primitive[], base?: readonly FieldRevision[]) => Primitive[];
|
|
29
|
+
/** What each op of an undo puts back, newest first, its splices carried over the typing since. */
|
|
30
|
+
undone?: (log: readonly Operation[], ops: readonly Operation[]) => {
|
|
31
|
+
readonly op: Operation;
|
|
32
|
+
readonly primitives: readonly Primitive[];
|
|
33
|
+
}[];
|
|
34
|
+
/** Of a later op, against what an undo takes back: true when it only typed on text the undo only typed, else the records whose typed text it wrote whole. */
|
|
35
|
+
aside?: (targets: readonly Primitive[], later: Operation) => true | readonly string[];
|
|
36
|
+
};
|
|
37
|
+
//# sourceMappingURL=typing-hook.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typing-hook.d.ts","sourceRoot":"","sources":["../../src/text/typing-hook.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAenE,uEAAuE;AACvE,eAAO,MAAM,SAAS,cAAc,CAAC;AAErC,oEAAoE;AACpE,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,MAAM,EAAE;QAAE,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,CAAC;IAC1D,QAAQ,CAAC,KAAK,EAAE;QAAE,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,CAAC;IACjD,QAAQ,CAAC,GAAG,EAAE;QAAE,GAAG,IAAI,SAAS,SAAS,EAAE,CAAC;QAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;CACzE;AAED,eAAO,MAAM,MAAM,EAAE;IACnB,sGAAsG;IACtG,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,qBAAqB,CAAC,KAAK,CAAC,CAAC;IAChE,6FAA6F;IAC7F,GAAG,CAAC,EAAE,CAAC,MAAM,EAAE,WAAW,CAAC,QAAQ,CAAC,EAAE,SAAS,EAAE,SAAS,qBAAqB,CAAC,KAAK,CAAC,EAAE,EAAE,IAAI,EAAE,MAAM,GAAG,SAAS,EAAE,KAAK,EAAE,OAAO,KAAK,SAAS,MAAM,EAAE,CAAC;IACzJ,yEAAyE;IACzE,aAAa,CAAC,EAAE,CAAC,MAAM,EAAE,WAAW,CAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,GAAG,SAAS,EAAE,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC;IACpG,2FAA2F;IAC3F,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,SAAS,SAAS,EAAE,EAAE,IAAI,CAAC,EAAE,SAAS,aAAa,EAAE,KAAK,SAAS,EAAE,CAAC;IACnH,kGAAkG;IAClG,MAAM,CAAC,EAAE,CAAC,GAAG,EAAE,SAAS,SAAS,EAAE,EAAE,GAAG,EAAE,SAAS,SAAS,EAAE,KAAK;QAAE,QAAQ,CAAC,EAAE,EAAE,SAAS,CAAC;QAAC,QAAQ,CAAC,UAAU,EAAE,SAAS,SAAS,EAAE,CAAA;KAAE,EAAE,CAAC;IAC3I,6JAA6J;IAC7J,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,SAAS,SAAS,EAAE,EAAE,KAAK,EAAE,SAAS,KAAK,IAAI,GAAG,SAAS,MAAM,EAAE,CAAC;CAClF,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* WHAT TYPING TOGETHER NEEDS THAT A PAGE OPENING AN APP DOES NOT (Roadmap
|
|
3
|
+
* f-collab-text). An app opens far more often than somebody types into a
|
|
4
|
+
* long field, so the store carries only these hooks; `@graview/core/typing`
|
|
5
|
+
* fills them — a keystroke carried over the log since its revision, a whole
|
|
6
|
+
* write merged as a splice, an undo carried over others' typing — and a
|
|
7
|
+
* host that serves seats loads it (`@graview/ship`'s server entry does), as
|
|
8
|
+
* a face does once a field typed together is focused. Unloaded, a store
|
|
9
|
+
* answers to no `type-text`, writes a whole value as a patch, and lets a
|
|
10
|
+
* later keystroke on a field block an undo of typing in it, as any later
|
|
11
|
+
* write does.
|
|
12
|
+
*/
|
|
13
|
+
/** The name of the act that types into a text field typed together. */
|
|
14
|
+
export const TYPE_TEXT = "type-text";
|
|
15
|
+
export const TYPING = {};
|
|
16
|
+
//# sourceMappingURL=typing-hook.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typing-hook.js","sourceRoot":"","sources":["../../src/text/typing-hook.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;GAWG;AAEH,uEAAuE;AACvE,MAAM,CAAC,MAAM,SAAS,GAAG,WAAW,CAAC;AASrC,MAAM,CAAC,MAAM,MAAM,GAaf,EAAE,CAAC"}
|
package/dist/tidying.d.ts
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import type { MutationCall } from "./mutations/types.js";
|
|
2
2
|
import { type Lineage } from "./ops/lineage.js";
|
|
3
|
-
import { type Suggestion } from "./ops/suggestions.js";
|
|
3
|
+
import { type Dismissal, type Suggestion } from "./ops/suggestions.js";
|
|
4
4
|
import type { Author, Operation, Via } from "./ops/types.js";
|
|
5
5
|
import type { Principal } from "./permissions/types.js";
|
|
6
6
|
import type { AnySchema } from "./schema/schema.js";
|
|
7
7
|
import type { ApplyOptions, ApplyResult, Store } from "./store.js";
|
|
8
|
-
export { declinedIn, declinesIn, suggestionKey, tidyingOf, tidyingRefusal } from "./ops/tidying.js";
|
|
9
|
-
export {
|
|
10
|
-
export
|
|
8
|
+
export { declinedIn, declinesIn, meaningKey, suggestionKey, tidyingOf, tidyingRefusal } from "./ops/tidying.js";
|
|
9
|
+
export type { ActMeanings } from "./ops/tidying.js";
|
|
10
|
+
export { isDismissed, suggestionsIn } from "./ops/suggestions.js";
|
|
11
|
+
export type { Dismissal, DismissalStore, Suggestion, WaitingOptions } from "./ops/suggestions.js";
|
|
11
12
|
export { digestWords, foldDigests, isSuggestionBatch } from "./ops/digest.js";
|
|
12
13
|
export type { ActivityRow } from "./ops/digest.js";
|
|
13
14
|
export { LEFT_ALONE } from "./graph/archived.js";
|
|
@@ -21,6 +22,17 @@ export interface SuggestOptions {
|
|
|
21
22
|
readonly lineage: Lineage;
|
|
22
23
|
readonly via?: Via;
|
|
23
24
|
readonly intent?: string;
|
|
25
|
+
/**
|
|
26
|
+
* WHEN IT STOPS WAITING, as an ISO time (`Operation.expiresAt`): then it
|
|
27
|
+
* leaves the tray and cannot be accepted, and an actor that still thinks
|
|
28
|
+
* so judges it again. Unsaid, it waits until a person answers it.
|
|
29
|
+
*/
|
|
30
|
+
readonly expiresAt?: string;
|
|
31
|
+
}
|
|
32
|
+
/** What reading the suggestions waiting is told besides who reads them. */
|
|
33
|
+
export interface SuggestionsOptions {
|
|
34
|
+
/** What the person reading said "not now" to (`Dismissal`), kept where the host keeps their own state. */
|
|
35
|
+
readonly dismissed?: readonly Dismissal[];
|
|
24
36
|
}
|
|
25
37
|
/**
|
|
26
38
|
* A SUGGESTION THAT WAITS. The calls are judged as `applyAll` would judge
|
|
@@ -40,9 +52,11 @@ export declare function suggest<S extends AnySchema>(store: Store<S>, calls: rea
|
|
|
40
52
|
* THE SUGGESTIONS WAITING, oldest first — as `principal` may see them,
|
|
41
53
|
* when one is named, or as the seat a seat's view (`seenBy`) is of: a
|
|
42
54
|
* suggestion that names a record the seat may not see is not among them
|
|
43
|
-
* (it is withheld, as any op that names one is).
|
|
55
|
+
* (it is withheld, as any op that names one is). One that expired is not
|
|
56
|
+
* waiting; one the reader said "not now" to (`options.dismissed`) is left
|
|
57
|
+
* out for them alone.
|
|
44
58
|
*/
|
|
45
|
-
export declare function suggestions<S extends AnySchema>(store: Store<S>, principal?: Principal): readonly Suggestion[];
|
|
59
|
+
export declare function suggestions<S extends AnySchema>(store: Store<S>, principal?: Principal, options?: SuggestionsOptions): readonly Suggestion[];
|
|
46
60
|
/**
|
|
47
61
|
* ACCEPT A SUGGESTION: its calls applied as one gesture, as the person
|
|
48
62
|
* (`options.author`, or the store's principal) — judged as any change of
|
|
@@ -57,6 +71,10 @@ export declare function acceptSuggestion<S extends AnySchema>(store: Store<S>, i
|
|
|
57
71
|
* to the app's own actor from now on. Undone, it waits again.
|
|
58
72
|
*/
|
|
59
73
|
export declare function declineSuggestion<S extends AnySchema>(store: Store<S>, id: string, options?: ApplyOptions): ApplyResult<S>;
|
|
60
|
-
/**
|
|
74
|
+
/**
|
|
75
|
+
* The op that declined these calls — the whole suggestion, or any one of
|
|
76
|
+
* them on its own, as asked or meaning the same (`meaningKey`) — or
|
|
77
|
+
* undefined: what an actor asks before it suggests.
|
|
78
|
+
*/
|
|
61
79
|
export declare function declined(store: Pick<Store<AnySchema>, "log">, calls: readonly MutationCall[]): Operation | undefined;
|
|
62
80
|
//# sourceMappingURL=tidying.d.ts.map
|
package/dist/tidying.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tidying.d.ts","sourceRoot":"","sources":["../src/tidying.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAa,KAAK,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,
|
|
1
|
+
{"version":3,"file":"tidying.d.ts","sourceRoot":"","sources":["../src/tidying.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAa,KAAK,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAA0B,KAAK,SAAS,EAAE,KAAK,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAE/F,OAAO,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAC7D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,KAAK,E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,GAAG,SAAS,CAuC5I;AAED;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,CAAC,SAAS,SAAS,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,SAAS,CAAC,EAAE,SAAS,EAAE,OAAO,GAAE,kBAAuB,GAAG,SAAS,UAAU,EAAE,CAOhJ;AAWD;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,SAAS,SAAS,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,EAAE,OAAO,GAAE,YAAiB,GAAG,WAAW,CAAC,CAAC,CAAC,CAK7H;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,SAAS,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,EAAE,OAAO,GAAE,YAAiB,GAAG,WAAW,CAAC,CAAC,CAAC,CAK9H;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE,KAAK,CAAC,EAAE,KAAK,EAAE,SAAS,YAAY,EAAE,GAAG,SAAS,GAAG,SAAS,CAGpH"}
|
package/dist/tidying.js
CHANGED
|
@@ -16,12 +16,12 @@
|
|
|
16
16
|
*/
|
|
17
17
|
import { GraphError } from "./graph/graph.js";
|
|
18
18
|
import { lineageOf } from "./ops/lineage.js";
|
|
19
|
-
import { suggestionsIn } from "./ops/suggestions.js";
|
|
20
|
-
import { declinedIn,
|
|
19
|
+
import { expired, suggestionsIn } from "./ops/suggestions.js";
|
|
20
|
+
import { declinedIn, meaningKey } from "./ops/tidying.js";
|
|
21
21
|
import { seatOf } from "./seat-of.js";
|
|
22
22
|
import { EMPTY_DIFF } from "./graph/diff.js";
|
|
23
|
-
export { declinedIn, declinesIn, suggestionKey, tidyingOf, tidyingRefusal } from "./ops/tidying.js";
|
|
24
|
-
export { suggestionsIn } from "./ops/suggestions.js";
|
|
23
|
+
export { declinedIn, declinesIn, meaningKey, suggestionKey, tidyingOf, tidyingRefusal } from "./ops/tidying.js";
|
|
24
|
+
export { isDismissed, suggestionsIn } from "./ops/suggestions.js";
|
|
25
25
|
export { digestWords, foldDigests, isSuggestionBatch } from "./ops/digest.js";
|
|
26
26
|
export { LEFT_ALONE } from "./graph/archived.js";
|
|
27
27
|
const keptOf = (store) => store;
|
|
@@ -46,8 +46,12 @@ export function suggest(store, calls, options) {
|
|
|
46
46
|
if (lineage === undefined)
|
|
47
47
|
throw new GraphError("A suggestion says what it is based on: { basis, confidence? }");
|
|
48
48
|
const author = options.author ?? kept.by;
|
|
49
|
-
|
|
50
|
-
|
|
49
|
+
if (options.expiresAt !== undefined && Number.isNaN(Date.parse(options.expiresAt)))
|
|
50
|
+
throw new GraphError(`A suggestion expires at a time: "${options.expiresAt}" is not one (an ISO time, like 2026-10-23T06:00:00Z).`);
|
|
51
|
+
// The same change, however it is spelled, is the one that waits — even one a person said "not now" to.
|
|
52
|
+
const meanings = kept.actMeanings();
|
|
53
|
+
const key = meaningKey(calls, meanings);
|
|
54
|
+
const waiting = suggestions(whole).find((one) => meaningKey(one.calls, meanings) === key);
|
|
51
55
|
if (waiting)
|
|
52
56
|
return whole.log.get(waiting.id);
|
|
53
57
|
kept.refuseDeclined(calls, author);
|
|
@@ -73,6 +77,7 @@ export function suggest(store, calls, options) {
|
|
|
73
77
|
...given("via", options.via),
|
|
74
78
|
lineage,
|
|
75
79
|
suggests: calls,
|
|
80
|
+
...given("expiresAt", options.expiresAt),
|
|
76
81
|
};
|
|
77
82
|
whole.log.append(op);
|
|
78
83
|
whole.notify(EMPTY_DIFF, [op]);
|
|
@@ -82,19 +87,24 @@ export function suggest(store, calls, options) {
|
|
|
82
87
|
* THE SUGGESTIONS WAITING, oldest first — as `principal` may see them,
|
|
83
88
|
* when one is named, or as the seat a seat's view (`seenBy`) is of: a
|
|
84
89
|
* suggestion that names a record the seat may not see is not among them
|
|
85
|
-
* (it is withheld, as any op that names one is).
|
|
90
|
+
* (it is withheld, as any op that names one is). One that expired is not
|
|
91
|
+
* waiting; one the reader said "not now" to (`options.dismissed`) is left
|
|
92
|
+
* out for them alone.
|
|
86
93
|
*/
|
|
87
|
-
export function suggestions(store, principal) {
|
|
94
|
+
export function suggestions(store, principal, options = {}) {
|
|
88
95
|
const seat = seatOf(store);
|
|
89
96
|
const whole = seat?.store ?? store;
|
|
90
97
|
const who = principal ?? seat?.principal;
|
|
91
98
|
// A seat that sees everything is handed the store itself.
|
|
92
99
|
const ops = (who !== undefined ? whole.seenBy(who) : whole).log.all();
|
|
93
|
-
return suggestionsIn(ops, (id) => whole.graph.has(id));
|
|
100
|
+
return suggestionsIn(ops, (id) => whole.graph.has(id), { now: keptOf(whole).now(), dismissed: options.dismissed });
|
|
94
101
|
}
|
|
95
102
|
/** A suggestion still waiting that this author may see, or a sentence saying it is not. */
|
|
96
103
|
function waitingFor(store, id, author) {
|
|
97
104
|
const found = suggestions(store, author).find((one) => one.id === id);
|
|
105
|
+
const op = found ? undefined : store.log.get(id);
|
|
106
|
+
if (op?.suggests && expired(op, keptOf(store).now()))
|
|
107
|
+
throw new GraphError(`That suggestion expired on ${op.expiresAt.slice(0, 10)}.`);
|
|
98
108
|
if (!found)
|
|
99
109
|
throw new GraphError("That suggestion is no longer waiting: it was accepted or declined, or it is not one you can see.");
|
|
100
110
|
return found;
|
|
@@ -123,8 +133,13 @@ export function declineSuggestion(store, id, options = {}) {
|
|
|
123
133
|
const suggestion = waitingFor(whole, id, author);
|
|
124
134
|
return whole.undo(suggestion.batch, { ...options, author });
|
|
125
135
|
}
|
|
126
|
-
/**
|
|
136
|
+
/**
|
|
137
|
+
* The op that declined these calls — the whole suggestion, or any one of
|
|
138
|
+
* them on its own, as asked or meaning the same (`meaningKey`) — or
|
|
139
|
+
* undefined: what an actor asks before it suggests.
|
|
140
|
+
*/
|
|
127
141
|
export function declined(store, calls) {
|
|
128
|
-
|
|
142
|
+
const kept = store;
|
|
143
|
+
return declinedIn(store.log.all(), calls, typeof kept.actMeanings === "function" ? kept.actMeanings() : undefined);
|
|
129
144
|
}
|
|
130
145
|
//# sourceMappingURL=tidying.js.map
|
package/dist/tidying.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tidying.js","sourceRoot":"","sources":["../src/tidying.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,OAAO,EAAE,SAAS,EAAgB,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,aAAa,
|
|
1
|
+
{"version":3,"file":"tidying.js","sourceRoot":"","sources":["../src/tidying.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,OAAO,EAAE,SAAS,EAAgB,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,OAAO,EAAE,aAAa,EAAmC,MAAM,sBAAsB,CAAC;AAC/F,OAAO,EAAE,UAAU,EAAE,UAAU,EAAoB,MAAM,kBAAkB,CAAC;AAI5E,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEtC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,aAAa,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEhH,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAElE,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAE9E,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AA0CjD,MAAM,MAAM,GAAG,CAAsB,KAAe,EAAE,EAAE,CAAC,KAA2B,CAAC;AACrF,MAAM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AAC,EAAE,CAAC;IAClD,MAAM,UAAU,GAAG,UAAU,CAAC,KAAK,EAAE,EAAE,EAAE,MAAM,CAAC,CAAC;IACjD,OAAO,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,EAAE,GAAG,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC;AAC9D,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,QAAQ,CAAC,KAAoC,EAAE,KAA8B;IAC3F,MAAM,IAAI,GAAG,KAA4C,CAAC;IAC1D,OAAO,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,EAAE,KAAK,EAAE,OAAO,IAAI,CAAC,WAAW,KAAK,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;AACrH,CAAC"}
|
package/dist/typing.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typing.d.ts","sourceRoot":"","sources":["../src/typing.ts"],"names":[],"mappings":""}
|
package/dist/typing.js
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { inverseOf } from "./ops/inverse.js";
|
|
2
|
+
import { typeTextMutation, typeTextVia } from "./mutations/type-text.js";
|
|
3
|
+
import { collaborativeFieldOf } from "./schema/collaborative.js";
|
|
4
|
+
import { carried, splicesOn, textAt, wholeAsSplice, writesWhole } from "./text/since.js";
|
|
5
|
+
import { TYPING } from "./text/typing-hook.js";
|
|
6
|
+
/**
|
|
7
|
+
* A WHOLE VALUE WRITTEN OVER TEXT TYPED TOGETHER IS A SPLICE: a patch an
|
|
8
|
+
* act, an edit, an agent or an import writes to such a field, where the
|
|
9
|
+
* record holds text, is rewritten into the one splice that makes the change
|
|
10
|
+
* — against the text the caller read at the revision `base` names for it,
|
|
11
|
+
* else against the text now. A field that holds no text yet, or is cleared,
|
|
12
|
+
* is written whole, as before. Read in order, so a record the same op made
|
|
13
|
+
* or a field it already changed is read as it will be.
|
|
14
|
+
*/
|
|
15
|
+
function asSplices(store, primitives, base) {
|
|
16
|
+
if (!primitives.some((one) => one.op === "patch-node"))
|
|
17
|
+
return [...primitives];
|
|
18
|
+
const made = new Set();
|
|
19
|
+
const touched = new Set();
|
|
20
|
+
const out = [];
|
|
21
|
+
for (const primitive of primitives) {
|
|
22
|
+
if (primitive.op === "add-node")
|
|
23
|
+
made.add(primitive.node.id);
|
|
24
|
+
if (primitive.op !== "patch-node" || made.has(primitive.id)) {
|
|
25
|
+
if (primitive.op === "splice-text")
|
|
26
|
+
touched.add(`${primitive.id}\u0000${primitive.field}`);
|
|
27
|
+
out.push(primitive);
|
|
28
|
+
continue;
|
|
29
|
+
}
|
|
30
|
+
const record = store.graph.getNode(primitive.id);
|
|
31
|
+
const before = {};
|
|
32
|
+
const after = {};
|
|
33
|
+
const splices = [];
|
|
34
|
+
for (const [field, value] of Object.entries(primitive.after)) {
|
|
35
|
+
const current = record?.[field];
|
|
36
|
+
const at = `${primitive.id}\u0000${field}`;
|
|
37
|
+
if (typeof value === "string" && typeof current === "string" && current !== "" && !touched.has(at) && collaborativeFieldOf(store.schema, record?.kind, field)) {
|
|
38
|
+
const claimed = base?.find((entry) => entry.node === primitive.id && entry.field === field);
|
|
39
|
+
const splice = wholeAsSplice(current, value, claimed ? textAt(store.log.all(), store.log.horizon, primitive.id, field, claimed.rev, current) : undefined);
|
|
40
|
+
if (splice) {
|
|
41
|
+
splices.push({ op: "splice-text", id: primitive.id, field, ...splice });
|
|
42
|
+
touched.add(at);
|
|
43
|
+
continue;
|
|
44
|
+
}
|
|
45
|
+
// Merged, it changes nothing: written as the caller wrote it, a patch of what the field already holds.
|
|
46
|
+
}
|
|
47
|
+
before[field] = primitive.before[field];
|
|
48
|
+
after[field] = value;
|
|
49
|
+
touched.add(at);
|
|
50
|
+
}
|
|
51
|
+
if (Object.keys(after).length > 0)
|
|
52
|
+
out.push(splices.length > 0 ? { op: "patch-node", id: primitive.id, before, after } : primitive);
|
|
53
|
+
out.push(...splices);
|
|
54
|
+
}
|
|
55
|
+
return out;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* WHAT EACH OP OF AN UNDO PUTS BACK, newest first, as the store appends
|
|
59
|
+
* them: its inverse, with each splice in it carried over every splice of
|
|
60
|
+
* the same field that came after it — the rest of its own op, the log
|
|
61
|
+
* since, and what the undo has put back already. So an undo of one
|
|
62
|
+
* person's typing takes back only their words: text somebody else typed
|
|
63
|
+
* since stays where it went, and text of theirs somebody else already
|
|
64
|
+
* deleted shrinks out of what is taken back.
|
|
65
|
+
*/
|
|
66
|
+
function undone(log, ops) {
|
|
67
|
+
const putBack = [];
|
|
68
|
+
return [...ops]
|
|
69
|
+
.sort((a, b) => b.seq - a.seq)
|
|
70
|
+
.map((op) => {
|
|
71
|
+
const inverse = inverseOf(op);
|
|
72
|
+
if (!inverse.some((one) => one.op === "splice-text")) {
|
|
73
|
+
putBack.push(...inverse);
|
|
74
|
+
return { op, primitives: inverse };
|
|
75
|
+
}
|
|
76
|
+
const later = log.filter((one) => one.seq > op.seq).flatMap((one) => one.primitives);
|
|
77
|
+
const count = op.primitives.length;
|
|
78
|
+
const out = [];
|
|
79
|
+
inverse.forEach((one, at) => {
|
|
80
|
+
if (one.op !== "splice-text")
|
|
81
|
+
return void out.push(one);
|
|
82
|
+
const splice = carried(one, splicesOn([...op.primitives.slice(count - at), ...later, ...putBack, ...out], one.id, one.field));
|
|
83
|
+
if (splice.removed !== "" || splice.inserted !== "")
|
|
84
|
+
out.push({ op: "splice-text", id: one.id, field: one.field, ...splice });
|
|
85
|
+
});
|
|
86
|
+
putBack.push(...out);
|
|
87
|
+
return { op, primitives: out };
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* TYPING ON TEXT ONLY TYPED, SINCE, STANDS IN NOBODY'S WAY: a later op that
|
|
92
|
+
* only splices, into fields the undone ops wrote no other way than by
|
|
93
|
+
* splicing, read the record for its text, and the undo carries its inverse
|
|
94
|
+
* over that typing. Text written whole since — or the record taken out —
|
|
95
|
+
* still blocks an undo of typing into it, whatever that op read.
|
|
96
|
+
*/
|
|
97
|
+
function aside(targets, later) {
|
|
98
|
+
const wholes = (node, field) => targets.some((one) => writesWhole(one, node, field));
|
|
99
|
+
if (later.primitives.length > 0 && later.primitives.every((one) => one.op === "splice-text" && !wholes(one.id, one.field)))
|
|
100
|
+
return true;
|
|
101
|
+
return targets.flatMap((one) => (one.op === "splice-text" && later.primitives.some((other) => writesWhole(other, one.id, one.field)) ? [one.id] : []));
|
|
102
|
+
}
|
|
103
|
+
TYPING.typeText = typeTextMutation;
|
|
104
|
+
TYPING.via = typeTextVia;
|
|
105
|
+
TYPING.collaborative = collaborativeFieldOf;
|
|
106
|
+
TYPING.asSplices = asSplices;
|
|
107
|
+
TYPING.undone = undone;
|
|
108
|
+
TYPING.aside = aside;
|
|
109
|
+
//# sourceMappingURL=typing.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typing.js","sourceRoot":"","sources":["../src/typing.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE7C,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAEzE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACzF,OAAO,EAAE,MAAM,EAAoB,MAAM,uBAAuB,CAAC;AAEjE;;;;;;;;GAQG;AACH,SAAS,SAAS,CAAC,KAAkB,EAAE,UAAgC,EAAE,IAA+B;IACtG,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,EAAE,KAAK,YAAY,CAAC;QAAE,OAAO,CAAC,GAAG,UAAU,CAAC,CAAC;IAC/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AAa,IAAI,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,WAAW,CAAC,KAAK,EAAE,GAAG,CAAC,EAAE,EAAE,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AACzJ,CAAC;AAED,MAAM,CAAC,QAAQ,GAAG,gBAAgB,CAAC;AACnC,MAAM,CAAC,GAAG,GAAG,WAAoB,CAAC;AAClC,MAAM,CAAC,aAAa,GAAG,oBAAoB,CAAC;AAC5C,MAAM,CAAC,SAAS,GAAG,SAAS,CAAC;AAC7B,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC;AACvB,MAAM,CAAC,KAAK,GAAG,KAAK,CAAC"}
|
package/dist/version.d.ts
CHANGED
package/dist/version.js
CHANGED
package/dist/who.d.ts
CHANGED
package/dist/who.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"who.d.ts","sourceRoot":"","sources":["../src/who.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"who.d.ts","sourceRoot":"","sources":["../src/who.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,KAAK,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAExD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAEpD;;;;;;GAMG;AACH,MAAM,WAAW,MAAM;IACrB,8CAA8C;IAC9C,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,yBAAyB;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,yEAAyE;IACzE,QAAQ,CAAC,IAAI,CAAC,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC;CACnC;AAED;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAC1B,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,GAAG,YAAY,CAAC,EAC3D,KAAK,EAAE;IACL,QAAQ,CAAC,KAAK,EAAE;QAAE,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,CAAC;YAAE,EAAE,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,MAAM,CAAA;SAAE,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,SAAS,CAAA;KAAE,CAAC;IAC9G,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAC;IAC3B,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS;QAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAA;KAAE,EAAE,CAAC;IACtF,2EAA2E;IAC3E,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CACrC,GACA,MAAM,CAgCR"}
|
package/dist/who.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { authorKindOf } from "./ops/types.js";
|
|
1
2
|
import { labelOf } from "./schema/define-node.js";
|
|
2
3
|
/**
|
|
3
4
|
* AN AUTHOR BY NAME. A principal's id is its user node's id where the app
|
|
@@ -17,8 +18,10 @@ export function nameOfAuthor(author, where) {
|
|
|
17
18
|
const { onBehalfOf, ...itself } = author;
|
|
18
19
|
return `${nameOfAuthor(itself, where)}, for ${nameOfAuthor(onBehalfOf, where)}`;
|
|
19
20
|
}
|
|
21
|
+
// A kind a newer build wrote reads as the app itself (`authorKindOf`).
|
|
22
|
+
const kind = authorKindOf(author);
|
|
20
23
|
if (author.id === undefined)
|
|
21
|
-
return author.name ?? (
|
|
24
|
+
return author.name ?? (kind === "agent" ? "an agent" : kind === "visitor" ? "a visitor" : kind);
|
|
22
25
|
const node = where.graph.getNode(author.id);
|
|
23
26
|
if (node)
|
|
24
27
|
return labelOf(where.schema.tryDefinition(node.kind), node);
|
|
@@ -44,7 +47,7 @@ export function nameOfAuthor(author, where) {
|
|
|
44
47
|
return "a visitor via a form";
|
|
45
48
|
// A plain name ("kai") is how a host without seats names somebody; a namespaced id is not a name.
|
|
46
49
|
if (/[:_/]/.test(author.id))
|
|
47
|
-
return { human: "somebody", agent: "an agent", rule: "a rule", system: "the system" }[
|
|
50
|
+
return { human: "somebody", visitor: "a visitor", agent: "an agent", rule: "a rule", system: "the system" }[kind];
|
|
48
51
|
return author.id;
|
|
49
52
|
}
|
|
50
53
|
//# sourceMappingURL=who.js.map
|
package/dist/who.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"who.js","sourceRoot":"","sources":["../src/who.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"who.js","sourceRoot":"","sources":["../src/who.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAe,MAAM,gBAAgB,CAAC;AAE3D,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAmBlD;;;;;;;;GAQG;AACH,MAAM,UAAU,YAAY,CAC1B,MAA2D,EAC3D,KAMC;IAED;;;OAGG;IACH,IAAI,MAAM,CAAC,UAAU,EAAE,CAAC;QACtB,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM,EAAE,GAAG,MAAM,CAAC;QACzC,OAAO,GAAG,YAAY,CAAC,MAAM,EAAE,KAAK,CAAC,SAAS,YAAY,CAAC,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC;IAClF,CAAC;IACD,uEAAuE;IACvE,MAAM,IAAI,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC;IAClC,IAAI,MAAM,CAAC,EAAE,KAAK,SAAS;QAAE,OAAO,MAAM,CAAC,IAAI,IAAI,CAAC,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,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AAQ,EAAE,MAAM,EAAE,YAAY,EAAE,CAAC,IAAI,CAAC,CAAC;IAC/I,OAAO,MAAM,CAAC,EAAE,CAAC;AACnB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graview/core",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.50",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -93,10 +93,18 @@
|
|
|
93
93
|
"types": "./dist/seat.d.ts",
|
|
94
94
|
"default": "./dist/seat.js"
|
|
95
95
|
},
|
|
96
|
+
"./publishing": {
|
|
97
|
+
"types": "./dist/publishing.d.ts",
|
|
98
|
+
"default": "./dist/publishing.js"
|
|
99
|
+
},
|
|
96
100
|
"./field-sight": {
|
|
97
101
|
"types": "./dist/field-sight.d.ts",
|
|
98
102
|
"default": "./dist/field-sight.js"
|
|
99
103
|
},
|
|
104
|
+
"./typing": {
|
|
105
|
+
"types": "./dist/typing.d.ts",
|
|
106
|
+
"default": "./dist/typing.js"
|
|
107
|
+
},
|
|
100
108
|
"./search": {
|
|
101
109
|
"types": "./dist/search.d.ts",
|
|
102
110
|
"default": "./dist/search.js"
|
|
@@ -181,7 +189,9 @@
|
|
|
181
189
|
],
|
|
182
190
|
"sideEffects": [
|
|
183
191
|
"./dist/field-sight.js",
|
|
184
|
-
"./src/field-sight.ts"
|
|
192
|
+
"./src/field-sight.ts",
|
|
193
|
+
"./dist/publishing.js",
|
|
194
|
+
"./src/publishing.ts"
|
|
185
195
|
],
|
|
186
196
|
"repository": {
|
|
187
197
|
"type": "git",
|