@graview/ship 0.1.0 → 0.1.2

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 (73) hide show
  1. package/README.md +54 -6
  2. package/dist/browser-adapter.d.ts +9 -9
  3. package/dist/browser-adapter.d.ts.map +1 -1
  4. package/dist/browser-adapter.js +6 -3
  5. package/dist/browser-adapter.js.map +1 -1
  6. package/dist/browser.d.ts +10 -6
  7. package/dist/browser.d.ts.map +1 -1
  8. package/dist/browser.js +4 -2
  9. package/dist/browser.js.map +1 -1
  10. package/dist/cli.d.ts +17 -7
  11. package/dist/cli.d.ts.map +1 -1
  12. package/dist/cli.js +41 -7
  13. package/dist/cli.js.map +1 -1
  14. package/dist/export.d.ts +27 -2
  15. package/dist/export.d.ts.map +1 -1
  16. package/dist/export.js +38 -5
  17. package/dist/export.js.map +1 -1
  18. package/dist/file-adapter.d.ts +8 -8
  19. package/dist/file-adapter.d.ts.map +1 -1
  20. package/dist/file-adapter.js +58 -8
  21. package/dist/file-adapter.js.map +1 -1
  22. package/dist/handler.d.ts +162 -0
  23. package/dist/handler.d.ts.map +1 -0
  24. package/dist/handler.js +585 -0
  25. package/dist/handler.js.map +1 -0
  26. package/dist/health.d.ts +9 -0
  27. package/dist/health.d.ts.map +1 -1
  28. package/dist/health.js +5 -1
  29. package/dist/health.js.map +1 -1
  30. package/dist/index.d.ts +12 -7
  31. package/dist/index.d.ts.map +1 -1
  32. package/dist/index.js +5 -3
  33. package/dist/index.js.map +1 -1
  34. package/dist/live.d.ts +150 -0
  35. package/dist/live.d.ts.map +1 -0
  36. package/dist/live.js +44 -0
  37. package/dist/live.js.map +1 -0
  38. package/dist/meta.d.ts +13 -0
  39. package/dist/meta.d.ts.map +1 -0
  40. package/dist/meta.js +2 -0
  41. package/dist/meta.js.map +1 -0
  42. package/dist/open-store.d.ts +56 -7
  43. package/dist/open-store.d.ts.map +1 -1
  44. package/dist/open-store.js +141 -12
  45. package/dist/open-store.js.map +1 -1
  46. package/dist/remote.d.ts +93 -12
  47. package/dist/remote.d.ts.map +1 -1
  48. package/dist/remote.js +446 -76
  49. package/dist/remote.js.map +1 -1
  50. package/dist/runtime.d.ts +32 -0
  51. package/dist/runtime.d.ts.map +1 -0
  52. package/dist/runtime.js +21 -0
  53. package/dist/runtime.js.map +1 -0
  54. package/dist/seat-headers.d.ts +20 -0
  55. package/dist/seat-headers.d.ts.map +1 -0
  56. package/dist/seat-headers.js +20 -0
  57. package/dist/seat-headers.js.map +1 -0
  58. package/dist/serve.d.ts +15 -107
  59. package/dist/serve.d.ts.map +1 -1
  60. package/dist/serve.js +82 -217
  61. package/dist/serve.js.map +1 -1
  62. package/dist/source-edit.d.ts.map +1 -1
  63. package/dist/source-edit.js +6 -1
  64. package/dist/source-edit.js.map +1 -1
  65. package/dist/steps.d.ts +43 -0
  66. package/dist/steps.d.ts.map +1 -1
  67. package/dist/steps.js +69 -0
  68. package/dist/steps.js.map +1 -1
  69. package/dist/websocket.d.ts +14 -0
  70. package/dist/websocket.d.ts.map +1 -0
  71. package/dist/websocket.js +155 -0
  72. package/dist/websocket.js.map +1 -0
  73. package/package.json +6 -2
package/dist/health.js CHANGED
@@ -3,13 +3,17 @@ export function health(store, options = {}) {
3
3
  const dangling = [...store.graph.allEdges()]
4
4
  .filter((edge) => !ids.has(edge.from) || !ids.has(edge.to))
5
5
  .map((edge) => `${edge.kind}:${edge.from}->${edge.to}`);
6
- const violations = store.violations().length;
6
+ const all = store.violations();
7
+ const violations = all.length;
7
8
  return {
8
9
  ok: dangling.length === 0,
9
10
  nodes: ids.size,
10
11
  edges: [...store.graph.allEdges()].length,
11
12
  violations,
13
+ couldNotJudge: all.filter((violation) => violation.status === "could-not-judge").length,
14
+ overBudget: all.filter((violation) => violation.status === "over-budget").length,
12
15
  danglingEdges: dangling,
16
+ findings: store.findings().length,
13
17
  at: (options.now ?? (() => new Date().toISOString()))(),
14
18
  };
15
19
  }
@@ -1 +1 @@
1
- {"version":3,"file":"health.js","sourceRoot":"","sources":["../src/health.ts"],"names":[],"mappings":"AAiBA,MAAM,UAAU,MAAM,CACpB,KAAe,EACf,UAA2C,EAAE;IAE7C,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;IACxE,MAAM,QAAQ,GAAG,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;SACzC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;SAC1D,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,GAAG,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC;IAC1D,MAAM,UAAU,GAAG,KAAK,CAAC,UAAU,EAAE,CAAC,MAAM,CAAC;IAC7C,OAAO;QACL,EAAE,EAAE,QAAQ,CAAC,MAAM,KAAK,CAAC;QACzB,KAAK,EAAE,GAAG,CAAC,IAAI;QACf,KAAK,EAAE,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC,MAAM;QACzC,UAAU;QACV,aAAa,EAAE,QAAQ;QACvB,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,CAAC,EAAE;KACxD,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"health.js","sourceRoot":"","sources":["../src/health.ts"],"names":[],"mappings":"AA0BA,MAAM,UAAU,MAAM,CACpB,KAAe,EACf,UAA2C,EAAE;I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G,IAAI,CAAC,GAAG,EAAE,CAAC,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,CAAC,EAAE;KACxD,CAAC;AACJ,CAAC"}
package/dist/index.d.ts CHANGED
@@ -3,24 +3,29 @@ export type { FileAdapter } from "./file-adapter.js";
3
3
  export { browserStartsFresh, createBrowserAdapter, forgetFreshParam, freshHref, } from "./browser-adapter.js";
4
4
  export type { BrowserAdapter, BrowserAdapterOptions, StorageLike } from "./browser-adapter.js";
5
5
  export { migrateSnapshot, pendingMigrations } from "./migrations.js";
6
- export { primitivesFor, primitivesForSteps, sayStep, stepsMigration } from "./steps.js";
6
+ export { countSteps, primitivesFor, primitivesForSteps, sayStep, stepsMigration } from "./steps.js";
7
7
  export { applySteps, contentOperation, SEED_SYNC_AUTHOR, seedSteps } from "./sync-seed.js";
8
8
  export type { SeedSyncOptions } from "./sync-seed.js";
9
- export type { MigrationStep } from "./steps.js";
9
+ export type { MigrationStep, StepCount } from "./steps.js";
10
10
  export type { MigrationRun } from "./migrations.js";
11
11
  export { openStore } from "./open-store.js";
12
- export type { OpenStoreOptions, OpenedStore } from "./open-store.js";
12
+ export type { Compaction, OpenStoreOptions, OpenedStore } from "./open-store.js";
13
13
  export { applyToSnapshot } from "./snapshot.js";
14
14
  export type { GraphSnapshot } from "./snapshot.js";
15
15
  export { assertBundle, exportBundle } from "./export.js";
16
- export type { AppBundle } from "./export.js";
16
+ export type { AppBundle, ExportOptions } from "./export.js";
17
+ export type { StoredMeta } from "./meta.js";
17
18
  export { health } from "./health.js";
18
19
  export type { HealthReport } from "./health.js";
19
- export { openRemote } from "./remote.js";
20
+ export { openRemote, seatHeaders } from "./remote.js";
20
21
  export { createBroadcastPresence, presenceChannelName } from "./presence.js";
21
22
  export type { BroadcastPresenceOptions, ChannelLike } from "./presence.js";
22
- export type { RemoteOptions, RemoteStore } from "./remote.js";
23
- export { SEAT_HEADERS, serveStore, WIRE } from "./serve.js";
23
+ export type { LiveSocketLike, RemoteConflict, RemoteOptions, RemoteStore } from "./remote.js";
24
+ export { conflictSentence, LIVE_PATH } from "./live.js";
25
+ export type { LiveClientMessage, LiveConnection, LiveServerMessage, LiveSocket } from "./live.js";
26
+ export { createStoreHandler, presenceSeenBy } from "./handler.js";
27
+ export type { StoreHandler, StoreHandlerOptions } from "./handler.js";
28
+ export { SEAT_HEADERS, seatFromHeaders, serveStore, WIRE } from "./serve.js";
24
29
  export type { ServeOptions, ServedStore } from "./serve.js";
25
30
  export { backendFrom, serve, SERVE_USAGE, syncSeed } from "./cli.js";
26
31
  export type { StoreBackend } from "./cli.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACtD,YAAY,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EACL,kBAAkB,EAClB,oBAAoB,EACpB,gBAAgB,EAChB,SAAS,GACV,MAAM,sBAAsB,CAAC;AAC9B,YAAY,EAAE,cAAc,EAAE,qBAAqB,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAC/F,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AACxF,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3F,YAAY,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACtD,YAAY,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAChD,YAAY,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,YAAY,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;A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a,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC9F,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACxD,YAAY,EAAE,iBAAiB,EAAE,cAAc,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAClG,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAClE,YAAY,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACtE,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAC7E,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACrE,YAAY,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EACL,eAAe,EACf,UAAU,EACV,YAAY,EACZ,aAAa,EACb,kBAAkB,EAClB,eAAe,GAChB,MAAM,aAAa,CAAC;AACrB,YAAY,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC"}
package/dist/index.js CHANGED
@@ -1,15 +1,17 @@
1
1
  export { createFileAdapter } from "./file-adapter.js";
2
2
  export { browserStartsFresh, createBrowserAdapter, forgetFreshParam, freshHref, } from "./browser-adapter.js";
3
3
  export { migrateSnapshot, pendingMigrations } from "./migrations.js";
4
- export { primitivesFor, primitivesForSteps, sayStep, stepsMigration } from "./steps.js";
4
+ export { countSteps, primitivesFor, primitivesForSteps, sayStep, stepsMigration } from "./steps.js";
5
5
  export { applySteps, contentOperation, SEED_SYNC_AUTHOR, seedSteps } from "./sync-seed.js";
6
6
  export { openStore } from "./open-store.js";
7
7
  export { applyToSnapshot } from "./snapshot.js";
8
8
  export { assertBundle, exportBundle } from "./export.js";
9
9
  export { health } from "./health.js";
10
- export { openRemote } from "./remote.js";
10
+ export { openRemote, seatHeaders } from "./remote.js";
11
11
  export { createBroadcastPresence, presenceChannelName } from "./presence.js";
12
- export { SEAT_HEADERS, serveStore, WIRE } from "./serve.js";
12
+ export { conflictSentence, LIVE_PATH } from "./live.js";
13
+ export { createStoreHandler, presenceSeenBy } from "./handler.js";
14
+ export { SEAT_HEADERS, seatFromHeaders, serveStore, WIRE } from "./serve.js";
13
15
  export { backendFrom, serve, SERVE_USAGE, syncSeed } from "./cli.js";
14
16
  export { assertPhotoFits, photosUsed, storageBytes, PhotoTooLarge, PHOTO_BUDGET_BYTES, PHOTO_MAX_BYTES, } from "./photos.js";
15
17
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAEtD,OAAO,EACL,kBAAkB,EAClB,oBAAoB,EACpB,gBAAgB,EAChB,SAAS,GACV,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AACxF,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAI3F,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAEhD,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEzD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,uBAAuB,EAAE,mBAAmB,EAAE,MAAM,eAAe,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AAe,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAE7E,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAErE,OAAO,EACL,eAAe,EACf,UAAU,EACV,YAAY,EACZ,aAAa,EACb,kBAAkB,EAClB,eAAe,GAChB,MAAM,aAAa,CAAC"}
package/dist/live.d.ts ADDED
@@ -0,0 +1,150 @@
1
+ import type { FieldConflict, FieldRevision, MutationCall, Operation, Presence } from "@graview/core";
2
+ /**
3
+ * THE LIVE WIRE (FR-05): the same store, pushed down a WebSocket.
4
+ *
5
+ * Polling stays — it is the wire a person can reproduce with `curl`, and
6
+ * every runtime answers it — and beside it, at `LIVE_PATH`, one socket per
7
+ * client carries the same things as messages: calls in, the ops they made
8
+ * out, everybody else's ops the moment they land, and who is here. Each
9
+ * message is one JSON object, told apart by `t`.
10
+ *
11
+ * The protocol is numbered by `WIRE_PROTOCOL` (`@graview/core`), which
12
+ * `hello` and `welcome` both say. The socket is an addition to protocol 1,
13
+ * not a new protocol: every client of protocol 1 is still served, so the
14
+ * number stays where it is (docs/stability.md, "The wire").
15
+ *
16
+ * Seqs mean what they mean on `GET /graview/since?seq=N`: the position of
17
+ * an op in the store's log, and a client's seq is the last one it has. -1
18
+ * is "none yet".
19
+ *
20
+ * What a seat may not see holds here exactly as on the HTTP routes (FR-02,
21
+ * FR-16): every op a socket is sent is the op as that seat may see it,
22
+ * withheld in place where it touched what the seat may not see, and who is
23
+ * here is told as the seat may be told it.
24
+ */
25
+ export declare const LIVE_PATH = "/graview/live";
26
+ /** What a client says. A field the server does not know is ignored, never refused. */
27
+ export type LiveClientMessage =
28
+ /**
29
+ * The first word on a socket. `seq` is the last op the client has: the
30
+ * welcome carries exactly the ops after it. Without one, the welcome
31
+ * carries the whole state, as `GET /graview/state` would.
32
+ */
33
+ {
34
+ readonly t: "hello";
35
+ readonly seq?: number;
36
+ readonly protocol?: number;
37
+ }
38
+ /**
39
+ * Calls, as `POST /graview/ops` takes them. `cid` names the answer.
40
+ * `batch` is the batch the ops land in — the client's own provisional
41
+ * one, so a call it sent twice across a reconnect is answered with the
42
+ * ops it already made rather than made again. `base` is the revision of
43
+ * each field the calls change as the client last saw it; one that moved
44
+ * since is a `conflict`.
45
+ */
46
+ | {
47
+ readonly t: "call";
48
+ readonly cid: string;
49
+ readonly calls: readonly MutationCall[];
50
+ readonly intent?: string;
51
+ readonly batch?: string;
52
+ readonly via?: string;
53
+ readonly base?: readonly FieldRevision[];
54
+ }
55
+ /** Batches to take back, judged as the seat that asks. */
56
+ | {
57
+ readonly t: "undo";
58
+ readonly cid: string;
59
+ readonly batches: readonly string[];
60
+ readonly intent?: string;
61
+ readonly batch?: string;
62
+ readonly via?: string;
63
+ }
64
+ /** Where this client is, as `POST /graview/here` takes it. */
65
+ | {
66
+ readonly t: "here";
67
+ readonly presence: Presence;
68
+ }
69
+ /** Gone, as `POST /graview/leave`. */
70
+ | {
71
+ readonly t: "bye";
72
+ };
73
+ /** What the server says. */
74
+ export type LiveServerMessage =
75
+ /**
76
+ * The answer to `hello`: the protocol the server speaks, the last seq in
77
+ * its log, and the ops after the client's seq. `state` only when the
78
+ * hello named no seq.
79
+ */
80
+ {
81
+ readonly t: "welcome";
82
+ readonly protocol: number;
83
+ readonly seq: number;
84
+ readonly ops: readonly Operation[];
85
+ /** `horizon`: the seq `log` begins at, when the store was compacted (FR-23); absent, 0. */
86
+ readonly state?: {
87
+ readonly version: number;
88
+ readonly snapshot: unknown;
89
+ readonly log: readonly Operation[];
90
+ readonly migrated: readonly string[];
91
+ readonly enabledModules?: readonly string[];
92
+ readonly horizon?: number;
93
+ };
94
+ }
95
+ /** A call or undo landed: the ops it made, in the batch they landed in. Every op before them has already been sent. */
96
+ | {
97
+ readonly t: "ack";
98
+ readonly cid: string;
99
+ readonly seq: number;
100
+ readonly batch: string;
101
+ readonly ops: readonly Operation[];
102
+ }
103
+ /** Refused, in the policy's own sentence. Nothing landed. */
104
+ | {
105
+ readonly t: "refused";
106
+ readonly cid: string;
107
+ readonly sentence: string;
108
+ }
109
+ /** A stale write: each field that moved since the call's base, theirs and yours. Nothing landed. */
110
+ | {
111
+ readonly t: "conflict";
112
+ readonly cid: string;
113
+ readonly sentence: string;
114
+ readonly conflicts: readonly FieldConflict[];
115
+ }
116
+ /** Ops that landed, everybody's, in seq order and none skipped; `seq` is the last of them. */
117
+ | {
118
+ readonly t: "ops";
119
+ readonly seq: number;
120
+ readonly ops: readonly Operation[];
121
+ }
122
+ /** Who else is here now. */
123
+ | {
124
+ readonly t: "presence";
125
+ readonly who: readonly Presence[];
126
+ }
127
+ /** A message the server could not read. */
128
+ | {
129
+ readonly t: "error";
130
+ readonly sentence: string;
131
+ };
132
+ /**
133
+ * WHAT A HOST HANDS THE PROTOCOL: a way to send one text message down the
134
+ * socket, and to close it. A Worker's `WebSocketPair`, a Durable Object's
135
+ * accepted socket, Node's upgrade, a test's array: whatever carries text.
136
+ */
137
+ export interface LiveSocket {
138
+ send(text: string): void;
139
+ close?(code?: number, reason?: string): void;
140
+ }
141
+ /** The server's end of one socket: hand it every message the client sends, and say when the socket closed. */
142
+ export interface LiveConnection {
143
+ receive(text: string): void;
144
+ close(): void;
145
+ }
146
+ /** Said as a person would read it: a short value, or "nothing". */
147
+ export declare function sayValue(value: unknown): string;
148
+ /** "Ana changed label to “Book the church hall” while you were editing; yours was “Book the village hall”. Keep theirs, or send yours again." */
149
+ export declare function conflictSentence(conflicts: readonly FieldConflict[]): string;
150
+ //# sourceMappingURL=live.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"live.d.ts","sourceRoot":"","sources":["../src/live.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,YAAY,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAErG;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,SAAS,kBAAkB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,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,GAAG,EAAE,SAAS,SAAS,EAAE,CAAA;CAAE;AACjF,4BAA4B;GAC1B;IAAE,QAAQ,CAAC,CAAC,EAAE,UAAU,CAAC;IAAC,QAAQ,CAAC,GAAG,EAAE,SAAS,QAAQ,EAAE,CAAA;CAAE;AAC/D,2CAA2C;GACzC;IAAE,QAAQ,CAAC,CAAC,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC;AAEvD;;;;GAIG;AACH,MAAM,WAAW,UAAU;IACzB,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,KAAK,CAAC,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9C;AAED,8GAA8G;AAC9G,MAAM,WAAW,cAAc;IAC7B,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,KAAK,IAAI,IAAI,CAAC;CACf;AAED,mEAAmE;AACnE,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAM/C;AAED,iJAAiJ;AACjJ,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,SAAS,aAAa,EAAE,GAAG,MAAM,CAK5E"}
package/dist/live.js ADDED
@@ -0,0 +1,44 @@
1
+ /**
2
+ * THE LIVE WIRE (FR-05): the same store, pushed down a WebSocket.
3
+ *
4
+ * Polling stays — it is the wire a person can reproduce with `curl`, and
5
+ * every runtime answers it — and beside it, at `LIVE_PATH`, one socket per
6
+ * client carries the same things as messages: calls in, the ops they made
7
+ * out, everybody else's ops the moment they land, and who is here. Each
8
+ * message is one JSON object, told apart by `t`.
9
+ *
10
+ * The protocol is numbered by `WIRE_PROTOCOL` (`@graview/core`), which
11
+ * `hello` and `welcome` both say. The socket is an addition to protocol 1,
12
+ * not a new protocol: every client of protocol 1 is still served, so the
13
+ * number stays where it is (docs/stability.md, "The wire").
14
+ *
15
+ * Seqs mean what they mean on `GET /graview/since?seq=N`: the position of
16
+ * an op in the store's log, and a client's seq is the last one it has. -1
17
+ * is "none yet".
18
+ *
19
+ * What a seat may not see holds here exactly as on the HTTP routes (FR-02,
20
+ * FR-16): every op a socket is sent is the op as that seat may see it,
21
+ * withheld in place where it touched what the seat may not see, and who is
22
+ * here is told as the seat may be told it.
23
+ */
24
+ export const LIVE_PATH = "/graview/live";
25
+ /** Said as a person would read it: a short value, or "nothing". */
26
+ export function sayValue(value) {
27
+ if (value === undefined || value === null || value === "")
28
+ return "nothing";
29
+ if (typeof value === "string")
30
+ return `“${value.length > 60 ? `${value.slice(0, 57)}…` : value}”`;
31
+ if (typeof value === "number" || typeof value === "boolean")
32
+ return String(value);
33
+ const text = JSON.stringify(value);
34
+ return text.length > 60 ? `${text.slice(0, 57)}…` : text;
35
+ }
36
+ /** "Ana changed label to “Book the church hall” while you were editing; yours was “Book the village hall”. Keep theirs, or send yours again." */
37
+ export function conflictSentence(conflicts) {
38
+ const first = conflicts[0];
39
+ if (!first)
40
+ return "Someone changed this while you were editing.";
41
+ const more = conflicts.length > 1 ? ` (and ${conflicts.length - 1} more)` : "";
42
+ return `${first.by} changed ${first.field} to ${sayValue(first.theirs)} while you were editing; yours was ${sayValue(first.yours)}${more}. Keep theirs, or send yours again.`;
43
+ }
44
+ //# sourceMappingURL=live.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"live.js","sourceRoot":"","sources":["../src/live.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,eAAe,CAAC;AA8EzC,mEAAmE;AACnE,MAAM,UAAU,QAAQ,CAAC,KAAc;IACrC,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,EAAE;QAAE,OAAO,SAAS,CAAC;IAC5E,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,IAAI,KAAK,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC;IAClG,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,KAAK,KAAK,SAAS;QAAE,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;IAClF,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IACnC,OAAO,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC;AAC3D,CAAC;AAED,iJAAiJ;AACjJ,MAAM,UAAU,gBAAgB,CAAC,SAAmC;IAClE,MAAM,KAAK,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;IAC3B,IAAI,CAAC,KAAK;QAAE,OAAO,8CAA8C,CAAC;IAClE,MAAM,IAAI,GAAG,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,SAAS,CAAC,MAAM,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC;IAC/E,OAAO,GAAG,KAAK,CAAC,EAAE,YAAY,KAAK,CAAC,KAAK,OAAO,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,sCAAsC,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,IAAI,qCAAqC,CAAC;AAChL,CAAC"}
package/dist/meta.d.ts ADDED
@@ -0,0 +1,13 @@
1
+ import type { FormatName } from "@graview/core";
2
+ /**
3
+ * What a store keeps beside its graph: the declaration version it was last
4
+ * migrated to, and — from FR-31 — the framework that wrote it and the
5
+ * formats it wrote in, so a reader can tell a newer shape from its own.
6
+ * A meta written before the stamp has neither, and reads as format 1.
7
+ */
8
+ export interface StoredMeta {
9
+ readonly version: number;
10
+ readonly framework?: string;
11
+ readonly formats?: Partial<Record<FormatName, number>>;
12
+ }
13
+ //# sourceMappingURL=meta.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"meta.d.ts","sourceRoot":"","sources":["../src/meta.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAEhD;;;;;GAKG;AACH,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC;CACxD"}
package/dist/meta.js ADDED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=meta.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"meta.js","sourceRoot":"","sources":["../src/meta.ts"],"names":[],"mappings":""}
@@ -1,4 +1,5 @@
1
- import { Store, type AnySchema, type GraviewApp, type Operation, type PersistenceAdapter, type StoreOptions } from "@graview/core";
1
+ import { Store, type AnySchema, type CompactOptions, type Epoch, type GraviewApp, type Operation, type PersistenceAdapter, type StoreOptions, type VerifyResult } from "@graview/core";
2
+ import type { StoredMeta } from "./meta.js";
2
3
  import type { GraphSnapshot } from "./snapshot.js";
3
4
  /**
4
5
  * ONE declaration plus ONE adapter is a running deployment.
@@ -12,12 +13,8 @@ import type { GraphSnapshot } from "./snapshot.js";
12
13
  export interface OpenStoreOptions<S extends AnySchema> {
13
14
  readonly app: GraviewApp<S>;
14
15
  readonly adapter: PersistenceAdapter<string> & {
15
- loadMeta?(scope: string): {
16
- version: number;
17
- } | null;
18
- saveMeta?(scope: string, meta: {
19
- version: number;
20
- }): void;
16
+ loadMeta?(scope: string): StoredMeta | null;
17
+ saveMeta?(scope: string, meta: StoredMeta): void;
21
18
  };
22
19
  readonly scope?: string;
23
20
  /** First-run data when nothing is stored yet. */
@@ -37,21 +34,73 @@ export interface OpenStoreOptions<S extends AnySchema> {
37
34
  * first, so the seed really is the first load again.
38
35
  */
39
36
  readonly fresh?: boolean;
37
+ /**
38
+ * Prove the stored graph against its log on open (FR-20). When the two
39
+ * disagree, the graph is rebuilt from the log, saved, and the opened
40
+ * store says so in `rebuilt`. A log that does not fold at all cannot be
41
+ * rebuilt from, and the open throws rather than trusting either.
42
+ */
43
+ readonly verify?: boolean;
40
44
  /**
41
45
  * Overrides for the store. The declaration's own policy and modules are
42
46
  * applied before these, so an app that declares who may do what gets it
43
47
  * enforced by the store ship opens without saying so twice.
44
48
  */
45
49
  readonly storeOptions?: Partial<StoreOptions<S>>;
50
+ /**
51
+ * THE MODULES THIS WORKSPACE HAS ON (FR-12): the host's word, usually
52
+ * what the workspace pays for. The store opens with the set its log last
53
+ * said, and when this differs, turning the difference off or on is
54
+ * written as an op authored `system · modules` — in the history like any
55
+ * change — before the store is handed back. Absent, the log's word
56
+ * stands, and every module when it never said one.
57
+ */
58
+ readonly enabledModules?: readonly string[];
46
59
  }
47
60
  export interface OpenedStore<S extends AnySchema> {
48
61
  readonly store: Store<S>;
49
62
  /** Operations the opening appended: the migration run, when one happened. */
50
63
  readonly migrated: readonly Operation[];
64
+ /**
65
+ * The epoch this opening began (FR-27), when it began one: the seed a new
66
+ * scope starts from, the graph a migration run left (with the change in
67
+ * a sentence), or what a store from before epochs held.
68
+ */
69
+ readonly epoch?: Epoch;
70
+ /** What verifying on open found, when `verify` was asked for. */
71
+ readonly verified?: VerifyResult;
72
+ /**
73
+ * The graph was rebuilt from the log because the stored one disagreed:
74
+ * the hash it had (`from`), the hash it has now (`to`), and the op after
75
+ * which the stored graph had drifted, when one could be named.
76
+ */
77
+ readonly rebuilt?: {
78
+ readonly from: string;
79
+ readonly to: string;
80
+ readonly divergedAfter?: string;
81
+ };
51
82
  /** Resolves when every write accepted so far has settled on the adapter. */
52
83
  flush(): Promise<void>;
53
84
  /** Stops persisting. The store keeps working; nothing further is written. */
54
85
  close(): void;
86
+ /**
87
+ * COMPACTS THE LOG BEHIND AN UNDO HORIZON (FR-23). The checkpoint
88
+ * `store.checkpoint(options)` makes (by default: keep the last 90 days
89
+ * and the last 1000 ops, whichever keeps more) becomes the horizon; the
90
+ * adapter archives the ops and epochs before it, then the store lets go
91
+ * of them. The next open loads the checkpoint and the tail, undo stops at
92
+ * the horizon and says so, and `exportBundle(app, store, { full: true })`
93
+ * still carries everything. Settles after every write accepted before
94
+ * it. Refused by an adapter that keeps no archive.
95
+ */
96
+ compact(options?: CompactOptions): Promise<Compaction>;
97
+ }
98
+ /** What `compact` did: where the log now begins, and how many ops it archived (0 when nothing was old enough). */
99
+ export interface Compaction {
100
+ readonly horizon: number;
101
+ readonly archived: number;
102
+ /** The checkpoint that became the horizon, when one did. */
103
+ readonly checkpoint?: Epoch;
55
104
  }
56
105
  export declare function openStore<S extends AnySchema>(options: OpenStoreOptions<S>): Promise<OpenedStore<S>>;
57
106
  //# sourceMappingURL=open-store.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"open-store.d.ts","sourceRoot":"","sources":["../src/open-store.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EACL,KAAK,SAAS,EACd,KAAK,UAAU,EACf,KAAK,SAAS,EACd,KAAK,kBAAkB,EACvB,KAAK,YAAY,EAClB,MAAM,eAAe,CAAC;AAEvB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAEnD;;;;;;;;GAQG;AAEH,MAAM,WAAW,gBAAgB,CAAC,CAAC,SAAS,SAAS;IACnD,QAAQ,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC;IAC5B,QAAQ,CAAC,OAAO,EAAE,kBAAkB,CAAC,MAAM,CAAC,GAAG;QAC7C,QAAQ,CAAC,CAAC,KAAK,EAAE,MAAM,GAAG;YAAE,OAAO,EAAE,MAAM,CAAA;SAAE,GAAG,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