@graphty/graph-format 0.0.0 → 0.2.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 (224) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +216 -43
  3. package/dist/graph-format.d.ts +1 -0
  4. package/dist/graph-format.d.ts.map +1 -0
  5. package/dist/graph-format.js +15798 -0
  6. package/dist/graph-format.js.map +1 -0
  7. package/dist/src/builder/arena.d.ts +85 -0
  8. package/dist/src/builder/arena.d.ts.map +1 -0
  9. package/dist/src/builder/arena.js +154 -0
  10. package/dist/src/builder/arena.js.map +1 -0
  11. package/dist/src/builder/compact.d.ts +515 -0
  12. package/dist/src/builder/compact.d.ts.map +1 -0
  13. package/dist/src/builder/compact.js +1553 -0
  14. package/dist/src/builder/compact.js.map +1 -0
  15. package/dist/src/builder/counting-sort.d.ts +96 -0
  16. package/dist/src/builder/counting-sort.d.ts.map +1 -0
  17. package/dist/src/builder/counting-sort.js +430 -0
  18. package/dist/src/builder/counting-sort.js.map +1 -0
  19. package/dist/src/builder/freeze.d.ts +72 -0
  20. package/dist/src/builder/freeze.d.ts.map +1 -0
  21. package/dist/src/builder/freeze.js +548 -0
  22. package/dist/src/builder/freeze.js.map +1 -0
  23. package/dist/src/builder/graph-builder.d.ts +602 -0
  24. package/dist/src/builder/graph-builder.d.ts.map +1 -0
  25. package/dist/src/builder/graph-builder.js +1940 -0
  26. package/dist/src/builder/graph-builder.js.map +1 -0
  27. package/dist/src/builder/options.d.ts +16 -0
  28. package/dist/src/builder/options.d.ts.map +1 -0
  29. package/dist/src/builder/options.js +21 -0
  30. package/dist/src/builder/options.js.map +1 -0
  31. package/dist/src/columns/bitmap.d.ts +96 -0
  32. package/dist/src/columns/bitmap.d.ts.map +1 -0
  33. package/dist/src/columns/bitmap.js +184 -0
  34. package/dist/src/columns/bitmap.js.map +1 -0
  35. package/dist/src/columns/column.d.ts +220 -0
  36. package/dist/src/columns/column.d.ts.map +1 -0
  37. package/dist/src/columns/column.js +2109 -0
  38. package/dist/src/columns/column.js.map +1 -0
  39. package/dist/src/columns/dictionary.d.ts +60 -0
  40. package/dist/src/columns/dictionary.d.ts.map +1 -0
  41. package/dist/src/columns/dictionary.js +102 -0
  42. package/dist/src/columns/dictionary.js.map +1 -0
  43. package/dist/src/columns/growable.d.ts +198 -0
  44. package/dist/src/columns/growable.d.ts.map +1 -0
  45. package/dist/src/columns/growable.js +296 -0
  46. package/dist/src/columns/growable.js.map +1 -0
  47. package/dist/src/columns/infer.d.ts +121 -0
  48. package/dist/src/columns/infer.d.ts.map +1 -0
  49. package/dist/src/columns/infer.js +268 -0
  50. package/dist/src/columns/infer.js.map +1 -0
  51. package/dist/src/columns/remap.d.ts +143 -0
  52. package/dist/src/columns/remap.d.ts.map +1 -0
  53. package/dist/src/columns/remap.js +588 -0
  54. package/dist/src/columns/remap.js.map +1 -0
  55. package/dist/src/columns/table.d.ts +184 -0
  56. package/dist/src/columns/table.d.ts.map +1 -0
  57. package/dist/src/columns/table.js +485 -0
  58. package/dist/src/columns/table.js.map +1 -0
  59. package/dist/src/constants.d.ts +34 -0
  60. package/dist/src/constants.d.ts.map +1 -0
  61. package/dist/src/constants.js +79 -0
  62. package/dist/src/constants.js.map +1 -0
  63. package/dist/src/errors.d.ts +76 -0
  64. package/dist/src/errors.d.ts.map +1 -0
  65. package/dist/src/errors.js +32 -0
  66. package/dist/src/errors.js.map +1 -0
  67. package/dist/src/ids/edge-id-index.d.ts +77 -0
  68. package/dist/src/ids/edge-id-index.d.ts.map +1 -0
  69. package/dist/src/ids/edge-id-index.js +155 -0
  70. package/dist/src/ids/edge-id-index.js.map +1 -0
  71. package/dist/src/ids/node-id-map.d.ts +280 -0
  72. package/dist/src/ids/node-id-map.d.ts.map +1 -0
  73. package/dist/src/ids/node-id-map.js +1139 -0
  74. package/dist/src/ids/node-id-map.js.map +1 -0
  75. package/dist/src/ids/string-store.d.ts +219 -0
  76. package/dist/src/ids/string-store.d.ts.map +1 -0
  77. package/dist/src/ids/string-store.js +526 -0
  78. package/dist/src/ids/string-store.js.map +1 -0
  79. package/dist/src/index.d.ts +30 -0
  80. package/dist/src/index.d.ts.map +1 -0
  81. package/dist/src/index.js +29 -0
  82. package/dist/src/index.js.map +1 -0
  83. package/dist/src/populate/from-csr.d.ts +61 -0
  84. package/dist/src/populate/from-csr.d.ts.map +1 -0
  85. package/dist/src/populate/from-csr.js +706 -0
  86. package/dist/src/populate/from-csr.js.map +1 -0
  87. package/dist/src/populate/from-edge-arrays.d.ts +51 -0
  88. package/dist/src/populate/from-edge-arrays.d.ts.map +1 -0
  89. package/dist/src/populate/from-edge-arrays.js +217 -0
  90. package/dist/src/populate/from-edge-arrays.js.map +1 -0
  91. package/dist/src/populate/from-records.d.ts +51 -0
  92. package/dist/src/populate/from-records.d.ts.map +1 -0
  93. package/dist/src/populate/from-records.js +447 -0
  94. package/dist/src/populate/from-records.js.map +1 -0
  95. package/dist/src/snapshot/derived.d.ts +211 -0
  96. package/dist/src/snapshot/derived.d.ts.map +1 -0
  97. package/dist/src/snapshot/derived.js +1254 -0
  98. package/dist/src/snapshot/derived.js.map +1 -0
  99. package/dist/src/snapshot/graph-meta.d.ts +23 -0
  100. package/dist/src/snapshot/graph-meta.d.ts.map +1 -0
  101. package/dist/src/snapshot/graph-meta.js +159 -0
  102. package/dist/src/snapshot/graph-meta.js.map +1 -0
  103. package/dist/src/snapshot/graph-snapshot.d.ts +509 -0
  104. package/dist/src/snapshot/graph-snapshot.d.ts.map +1 -0
  105. package/dist/src/snapshot/graph-snapshot.js +1247 -0
  106. package/dist/src/snapshot/graph-snapshot.js.map +1 -0
  107. package/dist/src/snapshot/hash.d.ts +90 -0
  108. package/dist/src/snapshot/hash.d.ts.map +1 -0
  109. package/dist/src/snapshot/hash.js +228 -0
  110. package/dist/src/snapshot/hash.js.map +1 -0
  111. package/dist/src/snapshot/queries.d.ts +74 -0
  112. package/dist/src/snapshot/queries.d.ts.map +1 -0
  113. package/dist/src/snapshot/queries.js +131 -0
  114. package/dist/src/snapshot/queries.js.map +1 -0
  115. package/dist/src/snapshot/validate.d.ts +192 -0
  116. package/dist/src/snapshot/validate.d.ts.map +1 -0
  117. package/dist/src/snapshot/validate.js +990 -0
  118. package/dist/src/snapshot/validate.js.map +1 -0
  119. package/dist/src/snapshot/views.d.ts +274 -0
  120. package/dist/src/snapshot/views.d.ts.map +1 -0
  121. package/dist/src/snapshot/views.js +856 -0
  122. package/dist/src/snapshot/views.js.map +1 -0
  123. package/dist/src/types/builder.d.ts +456 -0
  124. package/dist/src/types/builder.d.ts.map +1 -0
  125. package/dist/src/types/builder.js +11 -0
  126. package/dist/src/types/builder.js.map +1 -0
  127. package/dist/src/types/columns.d.ts +615 -0
  128. package/dist/src/types/columns.d.ts.map +1 -0
  129. package/dist/src/types/columns.js +14 -0
  130. package/dist/src/types/columns.js.map +1 -0
  131. package/dist/src/types/index.d.ts +14 -0
  132. package/dist/src/types/index.d.ts.map +1 -0
  133. package/dist/src/types/index.js +11 -0
  134. package/dist/src/types/index.js.map +1 -0
  135. package/dist/src/types/internal.d.ts +172 -0
  136. package/dist/src/types/internal.d.ts.map +1 -0
  137. package/dist/src/types/internal.js +13 -0
  138. package/dist/src/types/internal.js.map +1 -0
  139. package/dist/src/types/snapshot.d.ts +801 -0
  140. package/dist/src/types/snapshot.d.ts.map +1 -0
  141. package/dist/src/types/snapshot.js +14 -0
  142. package/dist/src/types/snapshot.js.map +1 -0
  143. package/dist/src/types/wire.d.ts +196 -0
  144. package/dist/src/types/wire.d.ts.map +1 -0
  145. package/dist/src/types/wire.js +8 -0
  146. package/dist/src/types/wire.js.map +1 -0
  147. package/dist/src/util/mask.d.ts +55 -0
  148. package/dist/src/util/mask.d.ts.map +1 -0
  149. package/dist/src/util/mask.js +71 -0
  150. package/dist/src/util/mask.js.map +1 -0
  151. package/dist/src/util/options.d.ts +22 -0
  152. package/dist/src/util/options.d.ts.map +1 -0
  153. package/dist/src/util/options.js +49 -0
  154. package/dist/src/util/options.js.map +1 -0
  155. package/dist/src/util/shared-buffers.d.ts +42 -0
  156. package/dist/src/util/shared-buffers.d.ts.map +1 -0
  157. package/dist/src/util/shared-buffers.js +52 -0
  158. package/dist/src/util/shared-buffers.js.map +1 -0
  159. package/dist/src/util/typed-array.d.ts +205 -0
  160. package/dist/src/util/typed-array.d.ts.map +1 -0
  161. package/dist/src/util/typed-array.js +289 -0
  162. package/dist/src/util/typed-array.js.map +1 -0
  163. package/dist/src/wire/bytes.d.ts +69 -0
  164. package/dist/src/wire/bytes.d.ts.map +1 -0
  165. package/dist/src/wire/bytes.js +361 -0
  166. package/dist/src/wire/bytes.js.map +1 -0
  167. package/dist/src/wire/carried-views.d.ts +111 -0
  168. package/dist/src/wire/carried-views.d.ts.map +1 -0
  169. package/dist/src/wire/carried-views.js +286 -0
  170. package/dist/src/wire/carried-views.js.map +1 -0
  171. package/dist/src/wire/from-wire.d.ts +144 -0
  172. package/dist/src/wire/from-wire.d.ts.map +1 -0
  173. package/dist/src/wire/from-wire.js +1425 -0
  174. package/dist/src/wire/from-wire.js.map +1 -0
  175. package/dist/src/wire/to-wire.d.ts +171 -0
  176. package/dist/src/wire/to-wire.d.ts.map +1 -0
  177. package/dist/src/wire/to-wire.js +652 -0
  178. package/dist/src/wire/to-wire.js.map +1 -0
  179. package/dist/tsconfig.build.tsbuildinfo +1 -0
  180. package/package.json +72 -7
  181. package/src/builder/arena.ts +192 -0
  182. package/src/builder/compact.ts +1811 -0
  183. package/src/builder/counting-sort.ts +506 -0
  184. package/src/builder/freeze.ts +689 -0
  185. package/src/builder/graph-builder.ts +2264 -0
  186. package/src/builder/options.ts +29 -0
  187. package/src/columns/bitmap.ts +196 -0
  188. package/src/columns/column.ts +2574 -0
  189. package/src/columns/dictionary.ts +114 -0
  190. package/src/columns/growable.ts +350 -0
  191. package/src/columns/infer.ts +285 -0
  192. package/src/columns/remap.ts +663 -0
  193. package/src/columns/table.ts +568 -0
  194. package/src/constants.ts +89 -0
  195. package/src/errors.ts +115 -0
  196. package/src/ids/edge-id-index.ts +179 -0
  197. package/src/ids/node-id-map.ts +1340 -0
  198. package/src/ids/string-store.ts +589 -0
  199. package/src/index.ts +139 -0
  200. package/src/lib-resizable-array-buffer.d.ts +34 -0
  201. package/src/populate/from-csr.ts +802 -0
  202. package/src/populate/from-edge-arrays.ts +257 -0
  203. package/src/populate/from-records.ts +536 -0
  204. package/src/snapshot/derived.ts +1486 -0
  205. package/src/snapshot/graph-meta.ts +167 -0
  206. package/src/snapshot/graph-snapshot.ts +1503 -0
  207. package/src/snapshot/hash.ts +241 -0
  208. package/src/snapshot/queries.ts +136 -0
  209. package/src/snapshot/validate.ts +1108 -0
  210. package/src/snapshot/views.ts +943 -0
  211. package/src/types/builder.ts +480 -0
  212. package/src/types/columns.ts +727 -0
  213. package/src/types/index.ts +14 -0
  214. package/src/types/internal.ts +195 -0
  215. package/src/types/snapshot.ts +886 -0
  216. package/src/types/wire.ts +207 -0
  217. package/src/util/mask.ts +89 -0
  218. package/src/util/options.ts +57 -0
  219. package/src/util/shared-buffers.ts +56 -0
  220. package/src/util/typed-array.ts +371 -0
  221. package/src/wire/bytes.ts +440 -0
  222. package/src/wire/carried-views.ts +327 -0
  223. package/src/wire/from-wire.ts +1690 -0
  224. package/src/wire/to-wire.ts +755 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"snapshot.d.ts","sourceRoot":"","sources":["../../../src/types/snapshot.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EACH,KAAK,cAAc,EACnB,KAAK,UAAU,EACf,KAAK,WAAW,EAChB,KAAK,aAAa,EAClB,KAAK,MAAM,EACX,KAAK,QAAQ,EACb,KAAK,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M,GAAG,SAAS,CAAC;IACzC,4DAA4D;IAC5D,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IAChD,sEAAsE;IACtE,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS,UAAU,EAAE,GAAG,SAAS,CAAC;IACjF,8DAA8D;IAC9D,QAAQ,CAAC,GAAG,CAAC,EAAE,UAAU,GAAG,SAAS,CAAC;CACzC"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * The frozen snapshot and its side structures (design sections 3, 4, 7, 8.1, 9, 10 and 12.2): the id
3
+ * map, the flags, the arena layout, the views, the derived graphs, the GraphSnapshot contract itself
4
+ * and the inputs of the snapshot factories.
5
+ *
6
+ * GraphSnapshotContract and NodeIdMapContract are the instance contracts of the GraphSnapshot and
7
+ * NodeIdMap classes implemented in src/snapshot/graph-snapshot.ts and src/ids/node-id-map.ts (design
8
+ * section 12.1 makes them classes so the JSDoc-on-method lint applies). The public names
9
+ * GraphSnapshot and NodeIdMap are the classes themselves, re-exported type-only from here so every
10
+ * type on this surface (DerivedGraph.snapshot, SnapshotParts.ids, ...) names the class the barrel
11
+ * exports. The imports are type-only, so the import graph stays free of runtime cycles.
12
+ */
13
+ export {};
14
+ //# sourceMappingURL=snapshot.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"snapshot.js","sourceRoot":"","sources":["../../../src/types/snapshot.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG"}
@@ -0,0 +1,196 @@
1
+ /**
2
+ * The wire form of a snapshot (design sections 9.1, 9.2 and 12.2): a JSON-serialisable manifest
3
+ * plus a list of ArrayBuffers. The same object is what postMessage, structuredClone, IndexedDB and
4
+ * the GSNP byte container carry; `buffers` is literally the postMessage transfer list. Absent
5
+ * members are null, never optional (design section 12.1).
6
+ */
7
+ import { type ColumnMeta, type GraphMeta, type ValidationLevel } from "./columns.js";
8
+ import { type NodeIdMapKind, type SnapshotFlags, type ViewName } from "./snapshot.js";
9
+ /** Element type of a wire buffer reference: the five typed-array dtypes plus "utf8" for byte stores. */
10
+ export type WireDtype = "u32" | "i32" | "f32" | "f64" | "u8" | "utf8";
11
+ /**
12
+ * One typed array inside WireSnapshot.buffers (design section 9.1). Validation at level "structure"
13
+ * checks byteOffset % elementSize === 0, byteLength === length * elementSize and that the range lies
14
+ * inside the buffer (E_BAD_SERIALIZATION with details.ref otherwise).
15
+ */
16
+ export interface WireBufferRef {
17
+ /** Index into WireSnapshot.buffers (always 0 inside a byte container). */
18
+ readonly buffer: number;
19
+ /** Byte offset inside the buffer (relative to the buffer region inside a container). */
20
+ readonly byteOffset: number;
21
+ /** Byte length of the array. */
22
+ readonly byteLength: number;
23
+ /** Element type. */
24
+ readonly dtype: WireDtype;
25
+ /** Element count. */
26
+ readonly length: number;
27
+ }
28
+ /**
29
+ * An Arrow Utf8 store on the wire: u32 offsets plus UTF-8 bytes (string ids, string columns, dictionaries, JSON text).
30
+ */
31
+ export interface WireUtf8 {
32
+ /** rows + 1 offsets. */
33
+ readonly offsets: WireBufferRef;
34
+ /** The concatenated UTF-8 bytes. */
35
+ readonly utf8: WireBufferRef;
36
+ }
37
+ /**
38
+ * One column on the wire (design section 9.1): the resolved metadata plus the buffers its dtype
39
+ * uses, each null when not applicable. meta.default, options and extra are JSON values with the
40
+ * tagged encoding of design section 5.9 for non-finite numbers.
41
+ */
42
+ export interface WireColumn {
43
+ /** Resolved metadata. */
44
+ readonly meta: ColumnMeta;
45
+ /** Values (numeric dtypes), packed words (bool) or codes (dict); null for string / list / json. */
46
+ readonly data: WireBufferRef | null;
47
+ /** Validity bitmap words; null when every row is set. */
48
+ readonly validity: WireBufferRef | null;
49
+ /** Number of unset rows (recomputed from the bitmap by validation). */
50
+ readonly nullCount: number;
51
+ /** dict only: the dictionary strings. */
52
+ readonly dictionary: WireUtf8 | null;
53
+ /** string only: the Utf8 store. */
54
+ readonly strings: WireUtf8 | null;
55
+ /** list only: rows + 1 offsets into the child. */
56
+ readonly offsets: WireBufferRef | null;
57
+ /** list only: the child column. */
58
+ readonly child: WireColumn | null;
59
+ /** json only: the JSON text of every row as a Utf8 store. */
60
+ readonly jsonText: WireUtf8 | null;
61
+ }
62
+ /** The arena region inside one wire buffer, so a receiver keeps the one-writeBuffer path (design section 9.1). */
63
+ export interface WireArena {
64
+ /** Index into WireSnapshot.buffers. */
65
+ readonly buffer: number;
66
+ /** Start of the arena inside the buffer. */
67
+ readonly byteOffset: number;
68
+ /** Total padded length of the arena. */
69
+ readonly byteLength: number;
70
+ /** Hot prefix length (design section 10.3). */
71
+ readonly hotByteLength: number;
72
+ }
73
+ /**
74
+ * The id map on the wire (design section 4.5), one shape for every kind: the members a kind does not
75
+ * use are null. The reverse Map is never serialised; a receiver rebuilds it lazily.
76
+ */
77
+ export interface WireIdMap {
78
+ /** The storage kind. */
79
+ readonly kind: NodeIdMapKind;
80
+ /** Number of ids. */
81
+ readonly size: number;
82
+ /** identity only: id === index + offset; 0 otherwise. */
83
+ readonly offset: number;
84
+ /** dense: u32 ids per index; numeric: f64 ids per index. */
85
+ readonly values: WireBufferRef | null;
86
+ /** mixed: u8 tag per index (0 number, 1 string). */
87
+ readonly tags: WireBufferRef | null;
88
+ /** mixed: f64 per index (0 where string). */
89
+ readonly numbers: WireBufferRef | null;
90
+ /** string / mixed: u32 offsets of the Utf8 store. */
91
+ readonly offsets: WireBufferRef | null;
92
+ /** string / mixed: the UTF-8 bytes. */
93
+ readonly utf8: WireBufferRef | null;
94
+ }
95
+ /**
96
+ * The JSON-serialisable manifest of a wire snapshot (design section 9.1). Readers refuse a
97
+ * formatVersion or wire major they do not know (E_UNSUPPORTED_VERSION), ignore unknown manifest
98
+ * fields of a newer minor, refuse an unknown column dtype unless unknownColumns is "skip", refuse an
99
+ * unknown id-map kind, and ignore unknown view entries.
100
+ */
101
+ export interface WireManifest {
102
+ /** Discriminator. */
103
+ readonly format: "graphty-snapshot";
104
+ /** Wire [major, minor]. */
105
+ readonly wire: readonly [major: number, minor: number];
106
+ /** The producing package version (masked when golden fixtures are compared). */
107
+ readonly producer: string;
108
+ /** The data-model major. */
109
+ readonly formatVersion: 1;
110
+ /** Whether the graph is directed. */
111
+ readonly directed: boolean;
112
+ /** The four counts. */
113
+ readonly counts: {
114
+ readonly nodes: number;
115
+ readonly edges: number;
116
+ readonly arcs: number;
117
+ readonly selfLoops: number;
118
+ };
119
+ /** The flags (invariant I9). */
120
+ readonly flags: SnapshotFlags;
121
+ /**
122
+ * The core arrays; null for an identity permutation (always, whether or not a getter materialised it), an absent
123
+ * weights array or a zero-length array.
124
+ */
125
+ readonly core: {
126
+ readonly rowPtr: WireBufferRef;
127
+ readonly colIdx: WireBufferRef | null;
128
+ readonly weights: WireBufferRef | null;
129
+ readonly arcToEdge: WireBufferRef | null;
130
+ readonly edgeToArc: WireBufferRef | null;
131
+ };
132
+ /** The arena region when the core lives in one buffer; null otherwise. */
133
+ readonly arena: WireArena | null;
134
+ /** The id map. */
135
+ readonly ids: WireIdMap;
136
+ /** Node columns in declaration order. */
137
+ readonly nodeColumns: readonly WireColumn[];
138
+ /** Edge columns in declaration order. */
139
+ readonly edgeColumns: readonly WireColumn[];
140
+ /** Graph columns in declaration order. */
141
+ readonly graphColumns: readonly WireColumn[];
142
+ /** Extension tables with their own row counts (design section 5.10). */
143
+ readonly extensions: readonly {
144
+ readonly name: string;
145
+ readonly rowCount: number;
146
+ readonly columns: readonly WireColumn[];
147
+ }[];
148
+ /** Graph metadata. */
149
+ readonly meta: GraphMeta;
150
+ /** Cached views included on request: view name -> member name -> buffer; null unless includeViews named some. */
151
+ readonly views: Readonly<Record<string, Readonly<Record<string, WireBufferRef>>>> | null;
152
+ /** Buffer indices that were copied rather than transferred (shared storage, design section 9.1). */
153
+ readonly copied: readonly number[];
154
+ /** The snapshot label. */
155
+ readonly label: string | null;
156
+ }
157
+ /**
158
+ * The plain-object, transferable, versioned representation of a snapshot: the only cloneable shape (design section
159
+ * 9.1).
160
+ */
161
+ export interface WireSnapshot {
162
+ /** The manifest. */
163
+ readonly manifest: WireManifest;
164
+ /** The buffers the manifest's references index; the postMessage transfer list when produced with transfer: true. */
165
+ readonly buffers: readonly ArrayBuffer[];
166
+ }
167
+ /** Options of toWire() (design section 9.1). */
168
+ export interface ToWireOptions {
169
+ /**
170
+ * Put only exclusively owned buffers into `buffers` as transferables and copy every shared one (listed in
171
+ * manifest.copied); default false (nothing is transferable).
172
+ */
173
+ readonly transfer?: boolean | undefined;
174
+ /** Cached views to carry; the receiver recomputes the rest. Scalar views are ignored. */
175
+ readonly includeViews?: readonly ViewName[] | undefined;
176
+ /** Whether attribute columns are carried; default true. */
177
+ readonly includeColumns?: boolean | undefined;
178
+ }
179
+ /** Options of toBytes() and toByteChunks() (design section 9.2). */
180
+ export interface ToBytesOptions {
181
+ /** Cached views to carry. */
182
+ readonly includeViews?: readonly ViewName[] | undefined;
183
+ }
184
+ /** Options of fromWire(), fromBytes() and fromByteChunks() (design sections 9.1 and 9.2). */
185
+ export interface FromWireOptions {
186
+ /** Validation level; default "structure" for fromWire, "full" for fromBytes. */
187
+ readonly validate?: ValidationLevel | undefined;
188
+ /** Copy the buffers instead of adopting them; default false. */
189
+ readonly copy?: boolean | undefined;
190
+ /**
191
+ * What to do with a column whose dtype the reader does not know; default "error" (E_UNSUPPORTED); "skip" drops it
192
+ * and records the name in meta.extra["graphty.skippedColumns"].
193
+ */
194
+ readonly unknownColumns?: "error" | "skip" | undefined;
195
+ }
196
+ //# sourceMappingURL=wire.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wire.d.ts","sourceRoot":"","sources":["../../../src/types/wire.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,SAAS,EAAE,KAAK,eAAe,EAAE,MAAM,cAAc,CAAC;AACrF,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,aAAa,EAAE,KAAK,QAAQ,EAAE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M,GAAG,SAAS,CAAC;CAC1D"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * The wire form of a snapshot (design sections 9.1, 9.2 and 12.2): a JSON-serialisable manifest
3
+ * plus a list of ArrayBuffers. The same object is what postMessage, structuredClone, IndexedDB and
4
+ * the GSNP byte container carry; `buffers` is literally the postMessage transfer list. Absent
5
+ * members are null, never optional (design section 12.1).
6
+ */
7
+ export {};
8
+ //# sourceMappingURL=wire.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wire.js","sourceRoot":"","sources":["../../../src/types/wire.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
@@ -0,0 +1,55 @@
1
+ /**
2
+ * The public packed-mask helpers of design section 7.4 (makeMask, maskTest, maskSet, maskCount,
3
+ * maskToIndices) plus the E_MASK_LENGTH check that filterEdges() and inducedSubgraph({ mask }) apply
4
+ * to a caller's mask. A NodeMask / EdgeMask is the same layout as a validity bitmap and a bool column
5
+ * (decision C13): ceil(length / 32) Uint32Array words, LSB-first, bit i set means index i is included.
6
+ * Masks are not part of the snapshot contract; no kernel is required to honour one.
7
+ */
8
+ import { type U32 } from "../types/index.js";
9
+ /**
10
+ * Allocate a packed mask over `length` indices: ceil(length / 32) words, every bit clear, or every bit
11
+ * below `length` set when `fill` is true (design section 7.4).
12
+ * @param length - the number of indices the mask covers (nodeCount, edgeCount or arcCount)
13
+ * @param fill - the initial value of every bit; defaults to false
14
+ * @returns the mask words
15
+ */
16
+ export declare function makeMask(length: number, fill?: boolean): U32;
17
+ /**
18
+ * Whether index i is in the mask.
19
+ * @param mask - the mask words
20
+ * @param i - the index, below the mask's length
21
+ * @returns true when bit i is set
22
+ */
23
+ export declare function maskTest(mask: U32, i: number): boolean;
24
+ /**
25
+ * Include or exclude index i.
26
+ * @param mask - the mask words
27
+ * @param i - the index, below the mask's length
28
+ * @param value - true to include, false to exclude
29
+ */
30
+ export declare function maskSet(mask: U32, i: number, value: boolean): void;
31
+ /**
32
+ * The number of included indices below `length` (the loop guard of an algorithm-owned alive mask,
33
+ * design section 7.4).
34
+ * @param mask - the mask words, at least ceil(length / 32) of them
35
+ * @param length - the number of indices the mask covers
36
+ * @returns the number of set bits in [0, length)
37
+ */
38
+ export declare function maskCount(mask: U32, length: number): number;
39
+ /**
40
+ * The included indices below `length` in ascending order, as a fresh U32.
41
+ * @param mask - the mask words, at least ceil(length / 32) of them
42
+ * @param length - the number of indices the mask covers
43
+ * @returns the set bit indices
44
+ */
45
+ export declare function maskToIndices(mask: U32, length: number): U32;
46
+ /**
47
+ * Check that a caller-supplied mask has enough words for `length` indices; filterEdges() and
48
+ * inducedSubgraph({ mask }) call it before reading the mask (design section 11.2). Throws
49
+ * E_MASK_LENGTH when mask.length < ceil(length / 32).
50
+ * @param mask - the mask words
51
+ * @param length - the number of indices the mask must cover
52
+ * @param what - what the mask is over, for the message ("edges", "nodes")
53
+ */
54
+ export declare function checkMaskLength(mask: U32, length: number, what: string): void;
55
+ //# sourceMappingURL=mask.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mask.d.ts","sourceRoot":"","sources":["../../../src/util/mask.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAWH,OAAO,EAAE,KAAK,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAE7C;;;;;;GAMG;AACH,wBAAgB,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,GAAG,CAE5D;AAED;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,GAAG,EAAE,CAAC,EAAE,MAAM,GAAG,OAAO,CAEtD;AAED;;;;;GAKG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,GAAG,EAAE,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI,CAElE;AAED;;;;;;GAMG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAE3D;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,GAAG,GAAG,CAE5D;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAS7E"}
@@ -0,0 +1,71 @@
1
+ /**
2
+ * The public packed-mask helpers of design section 7.4 (makeMask, maskTest, maskSet, maskCount,
3
+ * maskToIndices) plus the E_MASK_LENGTH check that filterEdges() and inducedSubgraph({ mask }) apply
4
+ * to a caller's mask. A NodeMask / EdgeMask is the same layout as a validity bitmap and a bool column
5
+ * (decision C13): ceil(length / 32) Uint32Array words, LSB-first, bit i set means index i is included.
6
+ * Masks are not part of the snapshot contract; no kernel is required to honour one.
7
+ */
8
+ import { bitmapCount, bitmapGet, bitmapToIndices, bitmapWordCount, bitmapWrite, makeBitmap, } from "../columns/bitmap.js";
9
+ import { GraphFormatError } from "../errors.js";
10
+ /**
11
+ * Allocate a packed mask over `length` indices: ceil(length / 32) words, every bit clear, or every bit
12
+ * below `length` set when `fill` is true (design section 7.4).
13
+ * @param length - the number of indices the mask covers (nodeCount, edgeCount or arcCount)
14
+ * @param fill - the initial value of every bit; defaults to false
15
+ * @returns the mask words
16
+ */
17
+ export function makeMask(length, fill) {
18
+ return makeBitmap(length, fill === true);
19
+ }
20
+ /**
21
+ * Whether index i is in the mask.
22
+ * @param mask - the mask words
23
+ * @param i - the index, below the mask's length
24
+ * @returns true when bit i is set
25
+ */
26
+ export function maskTest(mask, i) {
27
+ return bitmapGet(mask, i);
28
+ }
29
+ /**
30
+ * Include or exclude index i.
31
+ * @param mask - the mask words
32
+ * @param i - the index, below the mask's length
33
+ * @param value - true to include, false to exclude
34
+ */
35
+ export function maskSet(mask, i, value) {
36
+ bitmapWrite(mask, i, value);
37
+ }
38
+ /**
39
+ * The number of included indices below `length` (the loop guard of an algorithm-owned alive mask,
40
+ * design section 7.4).
41
+ * @param mask - the mask words, at least ceil(length / 32) of them
42
+ * @param length - the number of indices the mask covers
43
+ * @returns the number of set bits in [0, length)
44
+ */
45
+ export function maskCount(mask, length) {
46
+ return bitmapCount(mask, length);
47
+ }
48
+ /**
49
+ * The included indices below `length` in ascending order, as a fresh U32.
50
+ * @param mask - the mask words, at least ceil(length / 32) of them
51
+ * @param length - the number of indices the mask covers
52
+ * @returns the set bit indices
53
+ */
54
+ export function maskToIndices(mask, length) {
55
+ return bitmapToIndices(mask, length);
56
+ }
57
+ /**
58
+ * Check that a caller-supplied mask has enough words for `length` indices; filterEdges() and
59
+ * inducedSubgraph({ mask }) call it before reading the mask (design section 11.2). Throws
60
+ * E_MASK_LENGTH when mask.length < ceil(length / 32).
61
+ * @param mask - the mask words
62
+ * @param length - the number of indices the mask must cover
63
+ * @param what - what the mask is over, for the message ("edges", "nodes")
64
+ */
65
+ export function checkMaskLength(mask, length, what) {
66
+ const required = bitmapWordCount(length);
67
+ if (mask.length < required) {
68
+ throw new GraphFormatError("E_MASK_LENGTH", `mask over ${what} has ${mask.length} words; ${required} needed for ${length} ${what}`, { found: mask.length, required, length });
69
+ }
70
+ }
71
+ //# sourceMappingURL=mask.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mask.js","sourceRoot":"","sources":["../../../src/util/mask.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACH,WAAW,EACX,SAAS,EACT,eAAe,EACf,eAAe,EACf,WAAW,EACX,UAAU,GACb,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAGhD;;;;;;GAMG;AACH,MAAM,UAAU,QAAQ,CAAC,MAAc,EAAE,IAAc;IACnD,OAAO,UAAU,CAAC,MAAM,EAAE,IAAI,KAAK,IAAI,CAAC,CAAC;AAC7C,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,QAAQ,CAAC,IAAS,EAAE,CAAS;IACzC,OAAO,SAAS,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;AAC9B,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,OAAO,CAAC,IAAS,EAAE,CAAS,EAAE,KAAc;IACxD,WAAW,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC;AAChC,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,SAAS,CAAC,IAAS,EAAE,MAAc;IAC/C,OAAO,WAAW,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;AACrC,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,aAAa,CAAC,IAAS,EAAE,MAAc;IACnD,OAAO,eAAe,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;AACzC,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,eAAe,CAAC,IAAS,EAAE,MAAc,EAAE,IAAY;IACnE,MAAM,QAAQ,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC;IACzC,IAAI,IAAI,CAAC,MAAM,GAAG,QAAQ,EAAE,CAAC;QACzB,MAAM,IAAI,gBAAgB,CACtB,eAAe,EACf,aAAa,IAAI,QAAQ,IAAI,CAAC,MAAM,WAAW,QAAQ,eAAe,MAAM,IAAI,IAAI,EAAE,EACtF,EAAE,KAAK,EAAE,IAAI,CAAC,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,CAC3C,CAAC;IACN,CAAC;AACL,CAAC"}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Enum-valued option checking (design section 11.1): a value outside its documented set is refused
3
+ * with E_UNSUPPORTED (`details.field`, `details.found`, `details.reason` "unsupported option") at
4
+ * the call, never taken as a default. Every public entry point that reads an enum option -- the
5
+ * builder constructor and freeze overrides, the derived graphs, `degreeOrder`, `validate`,
6
+ * `set`, `indicesOf`, `fromRecords`, `foldArcs` -- goes through here, so typed callers see no change
7
+ * and an untyped caller's typo is an error rather than a silently different result.
8
+ */
9
+ /**
10
+ * Check that an option value is one of the allowed literals (undefined is accepted and returned so
11
+ * the caller applies its default).
12
+ * @param field - the option name for the error
13
+ * @param value - the value
14
+ * @param allowed - the documented literals
15
+ * @returns the value, narrowed
16
+ */
17
+ export declare function assertOneOf<T extends string>(field: string, value: unknown, allowed: readonly T[]): T | undefined;
18
+ /** The WeightReducer literals (design section 7.3). */
19
+ export declare const WEIGHT_REDUCERS: readonly ["first", "last", "sum", "min", "max"];
20
+ /** The ColumnReducer literals (design section 7.3). */
21
+ export declare const COLUMN_REDUCERS: readonly ["first", "last", "sum", "min", "max", "mean", "count", "drop"];
22
+ //# sourceMappingURL=options.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../../src/util/options.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,CAAC,SAAS,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,CAAC,EAAE,GAAG,CAAC,GAAG,SAAS,CAgBjH;AAiBD,uDAAuD;AACvD,eAAO,MAAM,eAAe,iDAAkD,CAAC;AAE/E,uDAAuD;AACvD,eAAO,MAAM,eAAe,0EAAyD,CAAC"}
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Enum-valued option checking (design section 11.1): a value outside its documented set is refused
3
+ * with E_UNSUPPORTED (`details.field`, `details.found`, `details.reason` "unsupported option") at
4
+ * the call, never taken as a default. Every public entry point that reads an enum option -- the
5
+ * builder constructor and freeze overrides, the derived graphs, `degreeOrder`, `validate`,
6
+ * `set`, `indicesOf`, `fromRecords`, `foldArcs` -- goes through here, so typed callers see no change
7
+ * and an untyped caller's typo is an error rather than a silently different result.
8
+ */
9
+ import { GraphFormatError } from "../errors.js";
10
+ /**
11
+ * Check that an option value is one of the allowed literals (undefined is accepted and returned so
12
+ * the caller applies its default).
13
+ * @param field - the option name for the error
14
+ * @param value - the value
15
+ * @param allowed - the documented literals
16
+ * @returns the value, narrowed
17
+ */
18
+ export function assertOneOf(field, value, allowed) {
19
+ if (value === undefined) {
20
+ return undefined;
21
+ }
22
+ if (typeof value !== "string" || !allowed.includes(value)) {
23
+ throw new GraphFormatError("E_UNSUPPORTED", `option ${field} has an unsupported value ${describeOption(value)}`, {
24
+ field,
25
+ found: value,
26
+ reason: "unsupported option",
27
+ });
28
+ }
29
+ return value;
30
+ }
31
+ /**
32
+ * A plain-ASCII rendering of an option value for an error message.
33
+ * @param value - the value
34
+ * @returns the rendering
35
+ */
36
+ function describeOption(value) {
37
+ if (typeof value === "string") {
38
+ return JSON.stringify(value.length > 40 ? `${value.slice(0, 37)}...` : value);
39
+ }
40
+ if (typeof value === "number" || typeof value === "boolean" || value === null) {
41
+ return String(value);
42
+ }
43
+ return `a ${typeof value}`;
44
+ }
45
+ /** The WeightReducer literals (design section 7.3). */
46
+ export const WEIGHT_REDUCERS = ["first", "last", "sum", "min", "max"];
47
+ /** The ColumnReducer literals (design section 7.3). */
48
+ export const COLUMN_REDUCERS = [...WEIGHT_REDUCERS, "mean", "count", "drop"];
49
+ //# sourceMappingURL=options.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"options.js","sourceRoot":"","sources":["../../../src/util/options.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEhD;;;;;;;GAOG;AACH,MAAM,UAAU,WAAW,CAAmB,KAAa,EAAE,KAAc,EAAE,OAAqB;IAC9F,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACtB,OAAO,SAAS,CAAC;IACrB,CAAC;IACD,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAE,OAA6B,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;QAC/E,MAAM,IAAI,gBAAgB,CACtB,eAAe,EACf,UAAU,KAAK,6BAA6B,cAAc,CAAC,KAAK,CAAC,EAAE,EACnE;YACI,KAAK;YACL,KAAK,EAAE,KAAK;YACZ,MAAM,EAAE,oBAAoB;SAC/B,CACJ,CAAC;IACN,CAAC;IACD,OAAO,KAAU,CAAC;AACtB,CAAC;AAED;;;;GAIG;AACH,SAAS,cAAc,CAAC,KAAc;IAClC,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC5B,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;IAClF,CAAC;IACD,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;QAC5E,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;IACzB,CAAC;IACD,OAAO,KAAK,OAAO,KAAK,EAAE,CAAC;AAC/B,CAAC;AAED,uDAAuD;AACvD,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAU,CAAC;AAE/E,uDAAuD;AACvD,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,GAAG,eAAe,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,CAAU,CAAC"}
@@ -0,0 +1,42 @@
1
+ /**
2
+ * The conservative owner count of design section 9.1. The format shares storage deliberately:
3
+ * `withColumns()` shares the core, same-node-space derived graphs share the node table and the id
4
+ * map, `clone()` and `set(name, column)` share Column objects between tables, `transpose()` adopts
5
+ * the cached reverse arrays as its core. Every holder of a buffer, column, table or id map claims it
6
+ * once (the snapshot and table constructors do so); a target claimed by more than one holder is
7
+ * SHARED, and `toWire({ transfer: true })` / `transferables()` copy its buffers instead of
8
+ * transferring them, so no sibling snapshot is ever silently emptied. The count is never decremented
9
+ * (conservative: a holder that is garbage-collected still counts, which only ever causes a copy).
10
+ *
11
+ * Holders are tracked at three granularities because a shared holder materialises buffers lazily
12
+ * (the Utf8 store of a string column or a string id map, the Float64Array of a numeric id map): a
13
+ * buffer, a Column (or a NodeIdMap) and an AttributeTable. The wire module treats a buffer as shared
14
+ * when the buffer itself, the column that holds it or the table that holds the column is shared.
15
+ * This module is a leaf (it imports nothing) so every module may use it without a cycle.
16
+ */
17
+ /**
18
+ * Record one holder of a buffer, column, table or id map. Called by every constructor that keeps a
19
+ * reference to storage it did not allocate itself; the second claim of the same target marks it
20
+ * shared.
21
+ * @param target - the buffer, Column, AttributeTable or NodeIdMap now held
22
+ */
23
+ export declare function claimHolder(target: object): void;
24
+ /**
25
+ * Record that a target has gained another holder (design section 9.1), so it is treated as shared
26
+ * from now on whatever its previous count.
27
+ * @param target - the buffer, Column, AttributeTable or NodeIdMap that is now held by more than one holder
28
+ */
29
+ export declare function noteShared(target: object): void;
30
+ /**
31
+ * The number of holders recorded for a target.
32
+ * @param target - the buffer, Column, AttributeTable or NodeIdMap
33
+ * @returns the count, 0 when never claimed
34
+ */
35
+ export declare function holderCount(target: object): number;
36
+ /**
37
+ * Whether a target has been recorded as held by more than one holder.
38
+ * @param target - the buffer, Column, AttributeTable or NodeIdMap
39
+ * @returns true when at least two holders were recorded
40
+ */
41
+ export declare function isShared(target: object): boolean;
42
+ //# sourceMappingURL=shared-buffers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shared-buffers.d.ts","sourceRoot":"","sources":["../../../src/util/shared-buffers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAKH;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAEhD;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAE/C;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAElD;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAEhD"}
@@ -0,0 +1,52 @@
1
+ /**
2
+ * The conservative owner count of design section 9.1. The format shares storage deliberately:
3
+ * `withColumns()` shares the core, same-node-space derived graphs share the node table and the id
4
+ * map, `clone()` and `set(name, column)` share Column objects between tables, `transpose()` adopts
5
+ * the cached reverse arrays as its core. Every holder of a buffer, column, table or id map claims it
6
+ * once (the snapshot and table constructors do so); a target claimed by more than one holder is
7
+ * SHARED, and `toWire({ transfer: true })` / `transferables()` copy its buffers instead of
8
+ * transferring them, so no sibling snapshot is ever silently emptied. The count is never decremented
9
+ * (conservative: a holder that is garbage-collected still counts, which only ever causes a copy).
10
+ *
11
+ * Holders are tracked at three granularities because a shared holder materialises buffers lazily
12
+ * (the Utf8 store of a string column or a string id map, the Float64Array of a numeric id map): a
13
+ * buffer, a Column (or a NodeIdMap) and an AttributeTable. The wire module treats a buffer as shared
14
+ * when the buffer itself, the column that holds it or the table that holds the column is shared.
15
+ * This module is a leaf (it imports nothing) so every module may use it without a cycle.
16
+ */
17
+ /** Target (ArrayBuffer, Column, AttributeTable or NodeIdMap) -> number of holders recorded. */
18
+ const HOLDERS = new WeakMap();
19
+ /**
20
+ * Record one holder of a buffer, column, table or id map. Called by every constructor that keeps a
21
+ * reference to storage it did not allocate itself; the second claim of the same target marks it
22
+ * shared.
23
+ * @param target - the buffer, Column, AttributeTable or NodeIdMap now held
24
+ */
25
+ export function claimHolder(target) {
26
+ HOLDERS.set(target, (HOLDERS.get(target) ?? 0) + 1);
27
+ }
28
+ /**
29
+ * Record that a target has gained another holder (design section 9.1), so it is treated as shared
30
+ * from now on whatever its previous count.
31
+ * @param target - the buffer, Column, AttributeTable or NodeIdMap that is now held by more than one holder
32
+ */
33
+ export function noteShared(target) {
34
+ HOLDERS.set(target, Math.max(HOLDERS.get(target) ?? 0, 1) + 1);
35
+ }
36
+ /**
37
+ * The number of holders recorded for a target.
38
+ * @param target - the buffer, Column, AttributeTable or NodeIdMap
39
+ * @returns the count, 0 when never claimed
40
+ */
41
+ export function holderCount(target) {
42
+ return HOLDERS.get(target) ?? 0;
43
+ }
44
+ /**
45
+ * Whether a target has been recorded as held by more than one holder.
46
+ * @param target - the buffer, Column, AttributeTable or NodeIdMap
47
+ * @returns true when at least two holders were recorded
48
+ */
49
+ export function isShared(target) {
50
+ return (HOLDERS.get(target) ?? 0) > 1;
51
+ }
52
+ //# sourceMappingURL=shared-buffers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shared-buffers.js","sourceRoot":"","sources":["../../../src/util/shared-buffers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,+FAA+F;AAC/F,MAAM,OAAO,GAAG,IAAI,OAAO,EAAkB,CAAC;AAE9C;;;;;GAKG;AACH,MAAM,UAAU,WAAW,CAAC,MAAc;IACtC,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;AACxD,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,UAAU,CAAC,MAAc;IACrC,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;AACnE,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,WAAW,CAAC,MAAc;IACtC,OAAO,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AACpC,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,QAAQ,CAAC,MAAc;IACnC,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;AAC1C,CAAC"}