@relate/contrib-web 0.0.0-stage → 0.1.0

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 (191) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +242 -2
  3. package/conformance/example-site/blank.html +2 -0
  4. package/conformance/example-site/broken.html +35 -0
  5. package/conformance/example-site/index.html +35 -0
  6. package/conformance/example-site/notes.html +35 -0
  7. package/conformance/example-site/page-1.html +35 -0
  8. package/conformance/example-site/page-2.html +35 -0
  9. package/conformance/example-site/public/descriptor-b.json +16 -0
  10. package/conformance/example-site/public/descriptor-broken.json +16 -0
  11. package/conformance/example-site/public/descriptor-mismatch.json +16 -0
  12. package/conformance/example-site/public/descriptor.json +16 -0
  13. package/conformance/example-site/public/graph-b.json +14408 -0
  14. package/conformance/example-site/public/graph.json +10808 -0
  15. package/conformance/example-site/rel-page.ts +147 -0
  16. package/conformance/example-site/vite.config.ts +23 -0
  17. package/conformance/make-example.ts +22 -0
  18. package/conformance/run.ts +152 -0
  19. package/conformance/scenarios.ts +285 -0
  20. package/dist/application/options.d.ts +9 -0
  21. package/dist/application/options.js +64 -0
  22. package/dist/application/options.js.map +1 -0
  23. package/dist/application/ranges.d.ts +7 -0
  24. package/dist/application/ranges.js +14 -0
  25. package/dist/application/ranges.js.map +1 -0
  26. package/dist/application/storage.d.ts +34 -0
  27. package/dist/application/storage.js +60 -0
  28. package/dist/application/storage.js.map +1 -0
  29. package/dist/application/types.d.ts +49 -0
  30. package/dist/application/types.js +2 -0
  31. package/dist/application/types.js.map +1 -0
  32. package/dist/build/canonical.d.ts +5 -0
  33. package/dist/build/canonical.js +26 -0
  34. package/dist/build/canonical.js.map +1 -0
  35. package/dist/build/descriptor.d.ts +16 -0
  36. package/dist/build/descriptor.js +13 -0
  37. package/dist/build/descriptor.js.map +1 -0
  38. package/dist/build/index.d.ts +6 -0
  39. package/dist/build/index.js +6 -0
  40. package/dist/build/index.js.map +1 -0
  41. package/dist/build/inline.d.ts +16 -0
  42. package/dist/build/inline.js +44 -0
  43. package/dist/build/inline.js.map +1 -0
  44. package/dist/build/prepare.d.ts +11 -0
  45. package/dist/build/prepare.js +25 -0
  46. package/dist/build/prepare.js.map +1 -0
  47. package/dist/catalog/api.d.ts +30 -0
  48. package/dist/catalog/api.js +56 -0
  49. package/dist/catalog/api.js.map +1 -0
  50. package/dist/catalog/catalog.d.ts +51 -0
  51. package/dist/catalog/catalog.js +104 -0
  52. package/dist/catalog/catalog.js.map +1 -0
  53. package/dist/catalog/directory.d.ts +30 -0
  54. package/dist/catalog/directory.js +116 -0
  55. package/dist/catalog/directory.js.map +1 -0
  56. package/dist/catalog/file.d.ts +12 -0
  57. package/dist/catalog/file.js +84 -0
  58. package/dist/catalog/file.js.map +1 -0
  59. package/dist/catalog/index.d.ts +10 -0
  60. package/dist/catalog/index.js +12 -0
  61. package/dist/catalog/index.js.map +1 -0
  62. package/dist/catalog/memory-storage.d.ts +16 -0
  63. package/dist/catalog/memory-storage.js +56 -0
  64. package/dist/catalog/memory-storage.js.map +1 -0
  65. package/dist/catalog/opfs-storage.d.ts +10 -0
  66. package/dist/catalog/opfs-storage.js +71 -0
  67. package/dist/catalog/opfs-storage.js.map +1 -0
  68. package/dist/catalog/remove.d.ts +21 -0
  69. package/dist/catalog/remove.js +85 -0
  70. package/dist/catalog/remove.js.map +1 -0
  71. package/dist/catalog/storage.d.ts +11 -0
  72. package/dist/catalog/storage.js +4 -0
  73. package/dist/catalog/storage.js.map +1 -0
  74. package/dist/catalog/types.d.ts +68 -0
  75. package/dist/catalog/types.js +4 -0
  76. package/dist/catalog/types.js.map +1 -0
  77. package/dist/client/application.d.ts +32 -0
  78. package/dist/client/application.js +99 -0
  79. package/dist/client/application.js.map +1 -0
  80. package/dist/client/client.d.ts +2 -0
  81. package/dist/client/client.js +445 -0
  82. package/dist/client/client.js.map +1 -0
  83. package/dist/client/diagnostic.d.ts +6 -0
  84. package/dist/client/diagnostic.js +35 -0
  85. package/dist/client/diagnostic.js.map +1 -0
  86. package/dist/client/events.d.ts +27 -0
  87. package/dist/client/events.js +31 -0
  88. package/dist/client/events.js.map +1 -0
  89. package/dist/client/failure.d.ts +13 -0
  90. package/dist/client/failure.js +40 -0
  91. package/dist/client/failure.js.map +1 -0
  92. package/dist/client/scope.d.ts +15 -0
  93. package/dist/client/scope.js +39 -0
  94. package/dist/client/scope.js.map +1 -0
  95. package/dist/client/status.d.ts +14 -0
  96. package/dist/client/status.js +34 -0
  97. package/dist/client/status.js.map +1 -0
  98. package/dist/client/subscriptions.d.ts +31 -0
  99. package/dist/client/subscriptions.js +64 -0
  100. package/dist/client/subscriptions.js.map +1 -0
  101. package/dist/client/types.d.ts +82 -0
  102. package/dist/client/types.js +2 -0
  103. package/dist/client/types.js.map +1 -0
  104. package/dist/config.d.ts +30 -0
  105. package/dist/config.js +28 -0
  106. package/dist/config.js.map +1 -0
  107. package/dist/conformance/run.d.ts +61 -0
  108. package/dist/conformance/run.js +121 -0
  109. package/dist/conformance/run.js.map +1 -0
  110. package/dist/conformance/scenarios.d.ts +25 -0
  111. package/dist/conformance/scenarios.js +257 -0
  112. package/dist/conformance/scenarios.js.map +1 -0
  113. package/dist/data/descriptor.d.ts +20 -0
  114. package/dist/data/descriptor.js +75 -0
  115. package/dist/data/descriptor.js.map +1 -0
  116. package/dist/data/types.d.ts +41 -0
  117. package/dist/data/types.js +3 -0
  118. package/dist/data/types.js.map +1 -0
  119. package/dist/data/validate.d.ts +22 -0
  120. package/dist/data/validate.js +118 -0
  121. package/dist/data/validate.js.map +1 -0
  122. package/dist/errors.d.ts +9 -0
  123. package/dist/errors.js +14 -0
  124. package/dist/errors.js.map +1 -0
  125. package/dist/index.d.ts +17 -0
  126. package/dist/index.js +8 -0
  127. package/dist/index.js.map +1 -0
  128. package/dist/profiles/index.d.ts +5 -0
  129. package/dist/profiles/index.js +9 -0
  130. package/dist/profiles/index.js.map +1 -0
  131. package/dist/profiles/per-page.d.ts +2 -0
  132. package/dist/profiles/per-page.js +11 -0
  133. package/dist/profiles/per-page.js.map +1 -0
  134. package/dist/profiles/persistent.d.ts +5 -0
  135. package/dist/profiles/persistent.js +14 -0
  136. package/dist/profiles/persistent.js.map +1 -0
  137. package/dist/validate.d.ts +5 -0
  138. package/dist/validate.js +4 -0
  139. package/dist/validate.js.map +1 -0
  140. package/dist/worker/application/classify.d.ts +30 -0
  141. package/dist/worker/application/classify.js +57 -0
  142. package/dist/worker/application/classify.js.map +1 -0
  143. package/dist/worker/application/init.d.ts +12 -0
  144. package/dist/worker/application/init.js +64 -0
  145. package/dist/worker/application/init.js.map +1 -0
  146. package/dist/worker/application/lifecycle.d.ts +29 -0
  147. package/dist/worker/application/lifecycle.js +86 -0
  148. package/dist/worker/application/lifecycle.js.map +1 -0
  149. package/dist/worker/application/losses.d.ts +11 -0
  150. package/dist/worker/application/losses.js +61 -0
  151. package/dist/worker/application/losses.js.map +1 -0
  152. package/dist/worker/application/migrate.d.ts +16 -0
  153. package/dist/worker/application/migrate.js +54 -0
  154. package/dist/worker/application/migrate.js.map +1 -0
  155. package/dist/worker/application/open-store.d.ts +31 -0
  156. package/dist/worker/application/open-store.js +60 -0
  157. package/dist/worker/application/open-store.js.map +1 -0
  158. package/dist/worker/application/seed.d.ts +14 -0
  159. package/dist/worker/application/seed.js +50 -0
  160. package/dist/worker/application/seed.js.map +1 -0
  161. package/dist/worker/application/transfer.d.ts +31 -0
  162. package/dist/worker/application/transfer.js +134 -0
  163. package/dist/worker/application/transfer.js.map +1 -0
  164. package/dist/worker/cache.d.ts +15 -0
  165. package/dist/worker/cache.js +45 -0
  166. package/dist/worker/cache.js.map +1 -0
  167. package/dist/worker/encode.d.ts +1 -0
  168. package/dist/worker/encode.js +43 -0
  169. package/dist/worker/encode.js.map +1 -0
  170. package/dist/worker/engine.d.ts +35 -0
  171. package/dist/worker/engine.js +99 -0
  172. package/dist/worker/engine.js.map +1 -0
  173. package/dist/worker/legacy-copy.d.ts +2 -0
  174. package/dist/worker/legacy-copy.js +19 -0
  175. package/dist/worker/legacy-copy.js.map +1 -0
  176. package/dist/worker/loader.d.ts +40 -0
  177. package/dist/worker/loader.js +96 -0
  178. package/dist/worker/loader.js.map +1 -0
  179. package/dist/worker/protocol.d.ts +121 -0
  180. package/dist/worker/protocol.js +2 -0
  181. package/dist/worker/protocol.js.map +1 -0
  182. package/dist/worker/store.d.ts +12 -0
  183. package/dist/worker/store.js +39 -0
  184. package/dist/worker/store.js.map +1 -0
  185. package/dist/worker/sweep.d.ts +8 -0
  186. package/dist/worker/sweep.js +21 -0
  187. package/dist/worker/sweep.js.map +1 -0
  188. package/dist/worker/worker.d.ts +1 -0
  189. package/dist/worker/worker.js +198 -0
  190. package/dist/worker/worker.js.map +1 -0
  191. package/package.json +81 -3
@@ -0,0 +1,15 @@
1
+ import type { GraphDocument } from "../data/types.js";
2
+ import type { Client } from "./types.js";
3
+ export declare function newScope(): string;
4
+ export interface View {
5
+ readonly scope: string;
6
+ /** Resolves when the view's data has been added for the first time (or the attempt has ended). */
7
+ readonly ready: Promise<void>;
8
+ /** Drop the view's data and stop re-adding it. Safe to call while the data is still being added. */
9
+ detach(): Promise<void>;
10
+ }
11
+ /**
12
+ * Add `document` as the data of one page view. If the instance is ready it is added now; otherwise it is added
13
+ * when the next instance is ready, before subscriptions re-run. After a replacement it is added again.
14
+ */
15
+ export declare function attachView(client: Client, document: GraphDocument, scope?: string): View;
@@ -0,0 +1,39 @@
1
+ export function newScope() {
2
+ return globalThis.crypto?.randomUUID?.() ?? `view-${Math.random().toString(36).slice(2)}${Date.now().toString(36)}`;
3
+ }
4
+ const ignore = () => undefined;
5
+ /**
6
+ * Add `document` as the data of one page view. If the instance is ready it is added now; otherwise it is added
7
+ * when the next instance is ready, before subscriptions re-run. After a replacement it is added again.
8
+ */
9
+ export function attachView(client, document, scope = newScope()) {
10
+ let detached = false;
11
+ let resolveReady;
12
+ const ready = new Promise((resolve) => (resolveReady = resolve));
13
+ const add = async () => {
14
+ if (detached)
15
+ return;
16
+ try {
17
+ await client.addScoped(document, scope);
18
+ }
19
+ finally {
20
+ resolveReady();
21
+ }
22
+ if (detached)
23
+ await client.dropScope(scope).catch(ignore);
24
+ };
25
+ const off = client.onGeneration(add);
26
+ if (client.status === "ready")
27
+ void add().catch(ignore);
28
+ return {
29
+ scope,
30
+ ready,
31
+ async detach() {
32
+ detached = true;
33
+ off();
34
+ await client.dropScope(scope).catch(ignore);
35
+ resolveReady();
36
+ },
37
+ };
38
+ }
39
+ //# sourceMappingURL=scope.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scope.js","sourceRoot":"","sources":["../../src/client/scope.ts"],"names":[],"mappings":"AAMA,MAAM,UAAU,QAAQ;IACtB,OAAO,UAAU,CAAC,MAAM,EAAE,UAAU,EAAE,EAAE,IAAI,QAAQ,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,EAAE,CAAC;AACtH,CAAC;AAUD,MAAM,MAAM,GAAG,GAAS,EAAE,CAAC,SAAS,CAAC;AAErC;;;GAGG;AACH,MAAM,UAAU,UAAU,CAAC,MAAc,EAAE,QAAuB,EAAE,KAAK,GAAW,QAAQ,EAAE;IAC5F,IAAI,QAAQ,GAAG,KAAK,CAAC;IACrB,IAAI,YAAyB,CAAC;IAC9B,MAAM,KAAK,GAAG,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,YAAY,GAAG,OAAO,CAAC,CAAC,CAAC;IAEvE,MAAM,GAAG,GAAG,KAAK,IAAmB,EAAE;QACpC,IAAI,QAAQ;YAAE,OAAO;QACrB,IAAI,CAAC;YACH,MAAM,MAAM,CAAC,SAAS,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;QAC1C,CAAC;gBAAS,CAAC;YACT,YAAY,EAAE,CAAC;QACjB,CAAC;QACD,IAAI,QAAQ;YAAE,MAAM,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAC5D,CAAC,CAAC;IAEF,MAAM,GAAG,GAAG,MAAM,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC;IACrC,IAAI,MAAM,CAAC,MAAM,KAAK,OAAO;QAAE,KAAK,GAAG,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAExD,OAAO;QACL,KAAK;QACL,KAAK;QACL,KAAK,CAAC,MAAM;YACV,QAAQ,GAAG,IAAI,CAAC;YAChB,GAAG,EAAE,CAAC;YACN,MAAM,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;YAC5C,YAAY,EAAE,CAAC;QACjB,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,14 @@
1
+ export type Status = "loading" | "ready" | "recovering" | "failed";
2
+ export declare class StatusMachine {
3
+ private readonly onChange?;
4
+ private current;
5
+ private count;
6
+ constructor(onChange?: ((status: Status, generation: number) => void) | undefined);
7
+ get status(): Status;
8
+ get generation(): number;
9
+ markReady(): void;
10
+ markRecovering(): void;
11
+ markFailed(): void;
12
+ markLoading(): void;
13
+ private set;
14
+ }
@@ -0,0 +1,34 @@
1
+ export class StatusMachine {
2
+ onChange;
3
+ current = "loading";
4
+ count = 0;
5
+ constructor(onChange) {
6
+ this.onChange = onChange;
7
+ }
8
+ get status() {
9
+ return this.current;
10
+ }
11
+ get generation() {
12
+ return this.count;
13
+ }
14
+ markReady() {
15
+ this.count++;
16
+ this.set("ready");
17
+ }
18
+ markRecovering() {
19
+ this.set("recovering");
20
+ }
21
+ markFailed() {
22
+ this.set("failed");
23
+ }
24
+ markLoading() {
25
+ this.set("loading");
26
+ }
27
+ set(next) {
28
+ if (next === this.current)
29
+ return;
30
+ this.current = next;
31
+ this.onChange?.(next, this.count);
32
+ }
33
+ }
34
+ //# sourceMappingURL=status.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"status.js","sourceRoot":"","sources":["../../src/client/status.ts"],"names":[],"mappings":"AAIA,MAAM,OAAO,aAAa;IAIK,QAAQ;IAH7B,OAAO,GAAW,SAAS,CAAC;IAC5B,KAAK,GAAG,CAAC,CAAC;IAElB,YAA6B,QAAuD;wBAAvD,QAAQ;IAAkD,CAAC;IAExF,IAAI,MAAM;QACR,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAED,IAAI,UAAU;QACZ,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;IAED,SAAS;QACP,IAAI,CAAC,KAAK,EAAE,CAAC;QACb,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IACpB,CAAC;IAED,cAAc;QACZ,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;IACzB,CAAC;IAED,UAAU;QACR,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IACrB,CAAC;IAED,WAAW;QACT,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;IACtB,CAAC;IAEO,GAAG,CAAC,IAAY;QACtB,IAAI,IAAI,KAAK,IAAI,CAAC,OAAO;YAAE,OAAO;QAClC,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;QACpB,IAAI,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC;CACF"}
@@ -0,0 +1,31 @@
1
+ import type { Envelope } from "../data/types.js";
2
+ import type { Status } from "./status.js";
3
+ export interface Update {
4
+ status: Status;
5
+ generation: number;
6
+ rows: Array<Record<string, unknown>> | null;
7
+ error: string | null;
8
+ }
9
+ export type Unsubscribe = () => void;
10
+ export type Runner = (statement: string, params: object | null) => Promise<Envelope>;
11
+ export declare class Registry {
12
+ private readonly subscriptions;
13
+ private readonly generationListeners;
14
+ /** The newest generation seen; results from an older one are dropped. */
15
+ private latest;
16
+ /**
17
+ * Register a query. When the instance is ready it runs at once; otherwise the listener is told the current
18
+ * status (so a component can show its placeholder) and the query runs when the instance is ready.
19
+ */
20
+ subscribe(statement: string, params: object | null, listener: (update: Update) => void, current: {
21
+ status: Status;
22
+ generation: number;
23
+ }, run: Runner): Unsubscribe;
24
+ /** Register a listener for new instances. It runs before subscriptions re-run, and may be asynchronous. */
25
+ onGeneration(listener: (generation: number) => void | Promise<void>): Unsubscribe;
26
+ /** A new instance is ready: run the generation listeners in order, then re-run every subscription. */
27
+ ready(generation: number, run: Runner): Promise<void>;
28
+ /** Tell every subscriber about a status that is not `ready`; their rows are cleared. */
29
+ notify(status: Status, generation: number): void;
30
+ private runOne;
31
+ }
@@ -0,0 +1,64 @@
1
+ export class Registry {
2
+ subscriptions = new Set();
3
+ generationListeners = new Set();
4
+ /** The newest generation seen; results from an older one are dropped. */
5
+ latest = 0;
6
+ /**
7
+ * Register a query. When the instance is ready it runs at once; otherwise the listener is told the current
8
+ * status (so a component can show its placeholder) and the query runs when the instance is ready.
9
+ */
10
+ subscribe(statement, params, listener, current, run) {
11
+ const subscription = { statement, params, listener, active: true };
12
+ this.subscriptions.add(subscription);
13
+ if (current.status === "ready") {
14
+ this.latest = Math.max(this.latest, current.generation);
15
+ void this.runOne(subscription, current.generation, run);
16
+ }
17
+ else {
18
+ listener({ status: current.status, generation: current.generation, rows: null, error: null });
19
+ }
20
+ return () => {
21
+ subscription.active = false;
22
+ this.subscriptions.delete(subscription);
23
+ };
24
+ }
25
+ /** Register a listener for new instances. It runs before subscriptions re-run, and may be asynchronous. */
26
+ onGeneration(listener) {
27
+ this.generationListeners.add(listener);
28
+ return () => void this.generationListeners.delete(listener);
29
+ }
30
+ /** A new instance is ready: run the generation listeners in order, then re-run every subscription. */
31
+ async ready(generation, run) {
32
+ this.latest = generation;
33
+ for (const listener of [...this.generationListeners]) {
34
+ try {
35
+ await listener(generation);
36
+ }
37
+ catch {
38
+ /* one listener's failure must not stop the others or the subscriptions */
39
+ }
40
+ }
41
+ await Promise.all([...this.subscriptions].map((s) => this.runOne(s, generation, run)));
42
+ }
43
+ /** Tell every subscriber about a status that is not `ready`; their rows are cleared. */
44
+ notify(status, generation) {
45
+ for (const s of [...this.subscriptions]) {
46
+ s.listener({ status, generation, rows: null, error: null });
47
+ }
48
+ }
49
+ async runOne(subscription, generation, run) {
50
+ let envelope;
51
+ try {
52
+ envelope = await run(subscription.statement, subscription.params);
53
+ }
54
+ catch {
55
+ return; // the instance was replaced or failed; the next generation, or `notify`, tells the subscriber
56
+ }
57
+ if (!subscription.active || generation !== this.latest)
58
+ return;
59
+ subscription.listener(envelope.error
60
+ ? { status: "ready", generation, rows: null, error: envelope.error }
61
+ : { status: "ready", generation, rows: envelope.rows, error: null });
62
+ }
63
+ }
64
+ //# sourceMappingURL=subscriptions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subscriptions.js","sourceRoot":"","sources":["../../src/client/subscriptions.ts"],"names":[],"mappings":"AAqBA,MAAM,OAAO,QAAQ;IACF,aAAa,GAAG,IAAI,GAAG,EAAgB,CAAC;IACxC,mBAAmB,GAAG,IAAI,GAAG,EAAgD,CAAC;IAC/F,yEAAyE;IACjE,MAAM,GAAG,CAAC,CAAC;IAEnB;;;OAGG;IACH,SAAS,CACP,SAAiB,EACjB,MAAqB,EACrB,QAAkC,EAClC,OAA+C,EAC/C,GAAW;QAEX,MAAM,YAAY,GAAiB,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;QACjF,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;QACrC,IAAI,OAAO,CAAC,MAAM,KAAK,OAAO,EAAE,CAAC;YAC/B,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC;YACxD,KAAK,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,OAAO,CAAC,UA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EAAE,CAAC;YACxC,CAAC,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;QAC9D,CAAC;IACH,CAAC;IAEO,KAAK,CAAC,MAAM,CAAC,YAA0B,EAAE,UAAkB,EAAE,GAAW;QAC9E,IAAI,QAAkB,CAAC;QACvB,IAAI,CAAC;YACH,QAAQ,GAAG,MAAM,GAAG,CAAC,YAAY,CAAC,SAAS,EAAE,YAAY,CAAC,MAAM,CAAC,CAAC;QACpE,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,CAAC,8FAA8F;QACxG,CAAC;QACD,IAAI,CAAC,YAAY,CAAC,MAAM,IAAI,UAAU,KAAK,IAAI,CAAC,MAAM;YAAE,OAAO;QAC/D,YAAY,CAAC,QAAQ,CACnB,QAAQ,CAAC,KAAK;YACZ,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,CAAC,KAAK,EAAE;YACpE,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CACtE,CAAC;IACJ,CAAC;CACF"}
@@ -0,0 +1,82 @@
1
+ import type { Descriptor, Envelope, GraphDocument, IndexSpec } from "../data/types.js";
2
+ import type { ApplicationOptions, ExportEnvelope, LossReport, StorageStatus } from "../application/types.js";
3
+ import type { Reason } from "../errors.js";
4
+ import type { Events } from "./events.js";
5
+ import type { Status } from "./status.js";
6
+ import type { Unsubscribe, Update } from "./subscriptions.js";
7
+ export type GraphSource =
8
+ /** A descriptor (ADR-003), as data or as a URL; its `data.url` locates the data. Allows a store. */
9
+ {
10
+ descriptor: Descriptor | string;
11
+ }
12
+ /** A data document alone, as data or as a URL. No revision, no store; indexes come from the caller. */
13
+ | {
14
+ document: GraphDocument | string;
15
+ indexes?: IndexSpec[];
16
+ };
17
+ export interface ClientOptions {
18
+ /** URL of the engine binary, handed to the engine's init (FR-007). */
19
+ engineUrl: string | URL;
20
+ /** The graph to load. Exactly one of `graph` and `application` is given. */
21
+ graph?: GraphSource;
22
+ /** Application mode (ADR-009): one named, durable, versioned graph written by the visitor. */
23
+ application?: ApplicationOptions;
24
+ /** Profile. "client-routing" is `persistent`; "multi-page" is `per-page` (FR-028). */
25
+ navigation: "client-routing" | "multi-page";
26
+ /** Use the store (needs a descriptor, FR-023). Default: false for client-routing, true for multi-page. */
27
+ store?: boolean;
28
+ /** Timeout applied to run() when none is given. Default 10000. */
29
+ visitorTimeoutMs?: number;
30
+ /** Target of the issue link in failure wording (FR-034). */
31
+ issueUrl?: string;
32
+ /** Replace the worker constructor (tests, adapters that must place the worker). */
33
+ workerFactory?: () => Worker;
34
+ }
35
+ export interface Diagnostic {
36
+ reason: Reason | "invalid-document" | "invalid-descriptor" | "mismatch" | "store" | "store-unmarked" | "store-newer" | "import-interrupted" | "store-lost" | "store-unreadable" | "unavailable" | "migration-failed";
37
+ failures: number;
38
+ engineError: string | null;
39
+ }
40
+ export interface Run {
41
+ result: Promise<Envelope>;
42
+ stop(): void;
43
+ }
44
+ export interface Client {
45
+ readonly generation: number;
46
+ readonly status: Status;
47
+ /** Present when status is "failed". */
48
+ readonly diagnostic: Diagnostic | null;
49
+ query(statement: string, params?: object | null, opts?: {
50
+ timeoutMs?: number;
51
+ }): Promise<Envelope>;
52
+ run(statement: string, params?: object | null, opts?: {
53
+ timeoutMs?: number;
54
+ }): Run;
55
+ subscribe(statement: string, params: object | null, listener: (update: Update) => void): Unsubscribe;
56
+ onGeneration(listener: (generation: number) => void | Promise<void>): Unsubscribe;
57
+ addScoped(document: GraphDocument, scope: string): Promise<void>;
58
+ dropScope(scope: string): Promise<void>;
59
+ /** Drop every scope this client added (a page leaving). */
60
+ dropAllScopes(): Promise<void>;
61
+ on<E extends keyof Events>(event: E, listener: (payload: Events[E]) => void): Unsubscribe;
62
+ /** What the page can say about whether its data is stored (application mode; otherwise memory-only values). */
63
+ readonly storage: StorageStatus;
64
+ /** Reset the store and seed it again: the only call that discards stored data (application mode). */
65
+ resetApplication(): Promise<void>;
66
+ exportApplication(opts?: {
67
+ allowLoss?: boolean;
68
+ }): Promise<{
69
+ envelope: ExportEnvelope;
70
+ losses: LossReport;
71
+ }>;
72
+ importApplication(envelope: ExportEnvelope): Promise<void>;
73
+ /** Ask the browser for persistent storage, from a user action. Never called by the core itself. */
74
+ requestPersistence(): Promise<boolean>;
75
+ storageEstimate(): Promise<{
76
+ usage: number | null;
77
+ quota: number | null;
78
+ }>;
79
+ retry(): void;
80
+ failureMessage(): string;
81
+ destroy(): void;
82
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/client/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,30 @@
1
+ /** Consecutive attempts that fail to reach `ready` before the status becomes `failed` (ADR-001). */
2
+ export declare const FAILURE_LIMIT = 3;
3
+ /** Retry schedule for a store another holder has locked (ADR-001): first wait, longest wait, total budget. */
4
+ export declare const STORE_RETRY: {
5
+ readonly initialMs: 100;
6
+ readonly maxMs: 500;
7
+ readonly totalMs: 5000;
8
+ };
9
+ /** Rows per loader statement (the engine's own bulk batch size, ADR-0155 in its repository). */
10
+ export declare const BATCH_SIZE = 1000;
11
+ /** Timeout applied to a visitor-supplied statement when none is given. */
12
+ export declare const VISITOR_TIMEOUT_MS = 10000;
13
+ /** Prefix of a store's name; the descriptor `id` follows it (ADR-003). */
14
+ export declare const STORE_PREFIX = "rel-";
15
+ /** Prefix of an application graph's store name; the application's name follows it (ADR-009). */
16
+ export declare const APP_STORE_PREFIX = "app-";
17
+ /** An application's name: 1 to 60 characters, so that `app-<name>` stays within the engine's 64 (ADR-009). */
18
+ export declare const APP_NAME_PATTERN: RegExp;
19
+ /** Wait between attempts at a store another holder has locked, after the bounded retry (ADR-009 2.4). */
20
+ export declare const WAIT_RETRY_MS = 1000;
21
+ /** Directory at the origin-private root that holds the catalog (and, before it, the stored copies of descriptors). */
22
+ export declare const CATALOG_DIR = "relate-web";
23
+ /** The catalog file inside {@link CATALOG_DIR} (ADR-010 2.1). */
24
+ export declare const CATALOG_FILE = "catalog.json";
25
+ /** The Web Lock that orders every read and write of the catalog: exclusive to write, shared to read (ADR-010 2.2). */
26
+ export declare const CATALOG_LOCK = "relate-web:catalog";
27
+ /** The catalog file format this code writes and understands. */
28
+ export declare const CATALOG_FORMAT = 1;
29
+ /** The descriptor `id`: 1 to 48 characters from A-Z a-z 0-9 _ - (so the store name stays within 64). */
30
+ export declare const ID_PATTERN: RegExp;
package/dist/config.js ADDED
@@ -0,0 +1,28 @@
1
+ // Defaults and limits fixed by ADR-001 and ADR-003; see specs/001-core-package/research.md.
2
+ /** Consecutive attempts that fail to reach `ready` before the status becomes `failed` (ADR-001). */
3
+ export const FAILURE_LIMIT = 3;
4
+ /** Retry schedule for a store another holder has locked (ADR-001): first wait, longest wait, total budget. */
5
+ export const STORE_RETRY = { initialMs: 100, maxMs: 500, totalMs: 5000 };
6
+ /** Rows per loader statement (the engine's own bulk batch size, ADR-0155 in its repository). */
7
+ export const BATCH_SIZE = 1000;
8
+ /** Timeout applied to a visitor-supplied statement when none is given. */
9
+ export const VISITOR_TIMEOUT_MS = 10_000;
10
+ /** Prefix of a store's name; the descriptor `id` follows it (ADR-003). */
11
+ export const STORE_PREFIX = "rel-";
12
+ /** Prefix of an application graph's store name; the application's name follows it (ADR-009). */
13
+ export const APP_STORE_PREFIX = "app-";
14
+ /** An application's name: 1 to 60 characters, so that `app-<name>` stays within the engine's 64 (ADR-009). */
15
+ export const APP_NAME_PATTERN = /^[A-Za-z0-9_-]{1,60}$/;
16
+ /** Wait between attempts at a store another holder has locked, after the bounded retry (ADR-009 2.4). */
17
+ export const WAIT_RETRY_MS = 1000;
18
+ /** Directory at the origin-private root that holds the catalog (and, before it, the stored copies of descriptors). */
19
+ export const CATALOG_DIR = "relate-web";
20
+ /** The catalog file inside {@link CATALOG_DIR} (ADR-010 2.1). */
21
+ export const CATALOG_FILE = "catalog.json";
22
+ /** The Web Lock that orders every read and write of the catalog: exclusive to write, shared to read (ADR-010 2.2). */
23
+ export const CATALOG_LOCK = "relate-web:catalog";
24
+ /** The catalog file format this code writes and understands. */
25
+ export const CATALOG_FORMAT = 1;
26
+ /** The descriptor `id`: 1 to 48 characters from A-Z a-z 0-9 _ - (so the store name stays within 64). */
27
+ export const ID_PATTERN = /^[A-Za-z0-9_-]{1,48}$/;
28
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,4FAA4F;AAE5F,oGAAoG;AACpG,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,CAAC;AAE/B,8GAA8G;AAC9G,MAAM,CAAC,MAAM,WAAW,GAAG,EAAE,SAAS,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,IAAI,EAAW,CAAC;AAElF,gGAAgG;AAChG,MAAM,CAAC,MAAM,UAAU,GAAG,IAAI,CAAC;AAE/B,0EAA0E;AAC1E,MAAM,CAAC,MAAM,kBAAkB,GAAG,MAAM,CAAC;AAEzC,0EAA0E;AAC1E,MAAM,CAAC,MAAM,YAAY,GAAG,MAAM,CAAC;AAEnC,gGAAgG;AAChG,MAAM,CAAC,MAAM,gBAAgB,GAAG,MAAM,CAAC;AAEvC,8GAA8G;AAC9G,MAAM,CAAC,MAAM,gBAAgB,GAAG,uBAAuB,CAAC;AAExD,yGAAyG;AACzG,MAAM,CAAC,MAAM,aAAa,GAAG,IAAI,CAAC;AAElC,sHAAsH;AACtH,MAAM,CAAC,MAAM,WAAW,GAAG,YAAY,CAAC;AAExC,iEAAiE;AACjE,MAAM,CAAC,MAAM,YAAY,GAAG,cAAc,CAAC;AAE3C,sHAAsH;AACtH,MAAM,CAAC,MAAM,YAAY,GAAG,oBAAoB,CAAC;AAEjD,gEAAgE;AAChE,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC;AAEhC,wGAAwG;AACxG,MAAM,CAAC,MAAM,UAAU,GAAG,uBAAuB,CAAC"}
@@ -0,0 +1,61 @@
1
+ import { type BrowserName, type Profile } from "./scenarios.js";
2
+ export { scenarios } from "./scenarios.js";
3
+ export type { BrowserName, Profile, Scenario } from "./scenarios.js";
4
+ /** The example site's descriptor and data document (variant a). */
5
+ export declare const exampleDescriptor: {
6
+ version: 1;
7
+ id: string;
8
+ revision: string;
9
+ data: {
10
+ url: string;
11
+ nodes: number;
12
+ links: number;
13
+ };
14
+ indexes?: Array<{
15
+ label: string;
16
+ property: string;
17
+ }>;
18
+ };
19
+ export declare const exampleDocument: {
20
+ version: 1;
21
+ revision?: string;
22
+ nodes: unknown[];
23
+ links: unknown[];
24
+ };
25
+ export interface RunOptions {
26
+ /** Where the example pages are served, for example `http://localhost:5175`. */
27
+ baseUrl: string;
28
+ profile: Profile;
29
+ browser: BrowserName;
30
+ /** Extra query string for every page (used to run a deliberately broken variant of the pages). */
31
+ query?: string;
32
+ /**
33
+ * How to recognize a request that fetched variant a's or variant b's data. Optional: by default the example site's
34
+ * file names (`/graph.json`, `/graph-b.json`) are matched. An adapter whose data URLs are named differently passes its own.
35
+ */
36
+ dataRequests?: {
37
+ a: (url: string) => boolean;
38
+ b: (url: string) => boolean;
39
+ };
40
+ /** Run only these scenarios. */
41
+ only?: string[];
42
+ }
43
+ export interface ScenarioResult {
44
+ id: string;
45
+ title: string;
46
+ spec: string[];
47
+ status: "passed" | "failed" | "skipped";
48
+ /** For a failure: the behavior that is broken. */
49
+ behavior?: string;
50
+ error?: string;
51
+ }
52
+ export interface Report {
53
+ profile: Profile;
54
+ browser: BrowserName;
55
+ results: ScenarioResult[];
56
+ failures: ScenarioResult[];
57
+ passed: boolean;
58
+ }
59
+ export declare function runConformance(options: RunOptions): Promise<Report>;
60
+ /** A report as text, naming each failed scenario's broken behavior. */
61
+ export declare function formatReport(report: Report): string;
@@ -0,0 +1,121 @@
1
+ // The conformance check: runs the framework-neutral scenarios against a site that serves the example pages.
2
+ // An adapter serves the same pages through its framework and calls `runConformance` for each profile and browser.
3
+ // Needs Playwright, an optional peer dependency of the package.
4
+ import { existsSync, readFileSync } from "node:fs";
5
+ import { mkdtempSync, rmSync } from "node:fs";
6
+ import { tmpdir } from "node:os";
7
+ import { join } from "node:path";
8
+ import { chromium, firefox, webkit } from "@playwright/test";
9
+ import { scenarios } from "./scenarios.js";
10
+ export { scenarios } from "./scenarios.js";
11
+ const publicDir = [new URL("./example-site/public/", import.meta.url), new URL("../../conformance/example-site/public/", import.meta.url)].find((u) => existsSync(new URL("descriptor.json", u)));
12
+ const read = (name) => JSON.parse(readFileSync(new URL(name, publicDir), "utf8"));
13
+ /** The example site's descriptor and data document (variant a). */
14
+ export const exampleDescriptor = read("descriptor.json");
15
+ export const exampleDocument = read("graph.json");
16
+ const launchers = { chromium, firefox, webkit };
17
+ /** Empty the origin-private file system so that one scenario's stores do not reach the next (see the test fixtures). */
18
+ async function clearOpfs(context, baseUrl) {
19
+ const page = await context.newPage();
20
+ try {
21
+ await page.goto(`${baseUrl}/blank.html`);
22
+ for (let attempt = 0; attempt < 25; attempt++) {
23
+ const left = await page.evaluate(async () => {
24
+ const root = await navigator.storage.getDirectory();
25
+ const names = [];
26
+ for await (const [name] of root.entries())
27
+ names.push(name);
28
+ for (const name of names)
29
+ await root.removeEntry(name, { recursive: true }).catch(() => undefined);
30
+ let remaining = 0;
31
+ for await (const _ of root.entries())
32
+ remaining++;
33
+ return remaining;
34
+ });
35
+ if (left === 0)
36
+ return;
37
+ await page.waitForTimeout(400);
38
+ }
39
+ }
40
+ finally {
41
+ await page.close();
42
+ }
43
+ }
44
+ async function withContext(options, shared, use) {
45
+ if (options.browser !== "webkit") {
46
+ const context = await shared.browser.newContext();
47
+ try {
48
+ return await use(context);
49
+ }
50
+ finally {
51
+ await context.close();
52
+ }
53
+ }
54
+ // WebKit needs a persistent profile for the origin-private file system.
55
+ const profile = mkdtempSync(join(tmpdir(), "relate-conformance-"));
56
+ const context = await webkit.launchPersistentContext(profile);
57
+ try {
58
+ await clearOpfs(context, options.baseUrl);
59
+ return await use(context);
60
+ }
61
+ finally {
62
+ await Promise.all(context.pages().map((p) => p.close().catch(() => undefined)));
63
+ await clearOpfs(context, options.baseUrl).catch(() => undefined);
64
+ await context.close();
65
+ rmSync(profile, { recursive: true, force: true });
66
+ }
67
+ }
68
+ export async function runConformance(options) {
69
+ const selected = scenarios.filter((s) => !options.only || options.only.includes(s.id));
70
+ const shared = { browser: options.browser === "webkit" ? null : await launchers[options.browser].launch() };
71
+ const results = [];
72
+ try {
73
+ for (const scenario of selected) {
74
+ const base = { id: scenario.id, title: scenario.title, spec: scenario.spec };
75
+ if (!scenario.profiles.includes(options.profile)) {
76
+ results.push({ ...base, status: "skipped" });
77
+ continue;
78
+ }
79
+ try {
80
+ await withContext(options, shared, async (context) => {
81
+ await scenario.run({
82
+ context,
83
+ baseUrl: options.baseUrl,
84
+ profile: options.profile,
85
+ browser: options.browser,
86
+ isDataA: options.dataRequests?.a ?? ((url) => url.includes("/graph.json")),
87
+ isDataB: options.dataRequests?.b ?? ((url) => url.includes("/graph-b.json")),
88
+ async open(path, extra, requests) {
89
+ const page = await context.newPage();
90
+ if (requests)
91
+ page.on("request", (r) => requests.push(r.url()));
92
+ const query = [`navigation=${options.profile}`, extra, options.query].filter(Boolean).join("&");
93
+ await page.goto(`${options.baseUrl}${path}?${query}`);
94
+ return page;
95
+ },
96
+ });
97
+ });
98
+ results.push({ ...base, status: "passed" });
99
+ }
100
+ catch (e) {
101
+ results.push({ ...base, status: "failed", behavior: scenario.behavior, error: e instanceof Error ? e.message : String(e) });
102
+ }
103
+ }
104
+ }
105
+ finally {
106
+ await shared.browser?.close();
107
+ }
108
+ const failures = results.filter((r) => r.status === "failed");
109
+ return { profile: options.profile, browser: options.browser, results, failures, passed: failures.length === 0 };
110
+ }
111
+ /** A report as text, naming each failed scenario's broken behavior. */
112
+ export function formatReport(report) {
113
+ const lines = [`conformance: ${report.browser}, ${report.profile}: ${report.passed ? "passed" : "FAILED"}`];
114
+ for (const r of report.results) {
115
+ lines.push(` ${r.status.padEnd(7)} ${r.id} ${r.title}`);
116
+ if (r.status === "failed")
117
+ lines.push(` broken behavior: ${r.behavior}`, ` ${r.error}`);
118
+ }
119
+ return lines.join("\n");
120
+ }
121
+ //# sourceMappingURL=run.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"run.js","sourceRoot":"","sources":["../../conformance/run.ts"],"names":[],"mappings":"AAAA,4GAA4G;AAC5G,kHAAkH;AAClH,gEAAgE;AAChE,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAqC,MAAM,kBAAkB,CAAC;AAChG,OAAO,EAAE,SAAS,EAAiD,MAAM,gBAAgB,CAAC;AAE1F,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAG3C,MAAM,SAAS,GAAG,CAAC,IAAI,GAAG,CAAC,wBAAwB,EAAE,OAAO,IAAI,CAAC,GAAG,CAAC,EAAE,IAAI,GAAG,CAAC,wCAAwC,EAAE,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC,IAAI,GAAG,CAAC,iBAAiB,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;AAClM,MAAM,IAAI,GAAG,CAAC,IAAY,EAA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AI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
@@ -0,0 +1,25 @@
1
+ import type { BrowserContext, Page } from "@playwright/test";
2
+ export type Profile = "client-routing" | "multi-page";
3
+ export type BrowserName = "chromium" | "firefox" | "webkit";
4
+ export interface ScenarioContext {
5
+ context: BrowserContext;
6
+ baseUrl: string;
7
+ profile: Profile;
8
+ browser: BrowserName;
9
+ /** Whether a request URL fetched variant a's data, and variant b's. The example site's file names by default. */
10
+ isDataA(url: string): boolean;
11
+ isDataB(url: string): boolean;
12
+ /** Open a page of the example site, with the scenario's profile in its query. `requests` collects its request URLs. */
13
+ open(path: string, extra?: string, requests?: string[]): Promise<Page>;
14
+ }
15
+ export interface Scenario {
16
+ id: string;
17
+ title: string;
18
+ /** The requirements and user-story scenarios this one checks. */
19
+ spec: string[];
20
+ /** The behavior that is broken when this scenario fails, in words an adapter author can act on. */
21
+ behavior: string;
22
+ profiles: Profile[];
23
+ run(ctx: ScenarioContext): Promise<void>;
24
+ }
25
+ export declare const scenarios: Scenario[];