@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.
- package/LICENSE +21 -0
- package/README.md +216 -43
- package/dist/graph-format.d.ts +1 -0
- package/dist/graph-format.d.ts.map +1 -0
- package/dist/graph-format.js +15798 -0
- package/dist/graph-format.js.map +1 -0
- package/dist/src/builder/arena.d.ts +85 -0
- package/dist/src/builder/arena.d.ts.map +1 -0
- package/dist/src/builder/arena.js +154 -0
- package/dist/src/builder/arena.js.map +1 -0
- package/dist/src/builder/compact.d.ts +515 -0
- package/dist/src/builder/compact.d.ts.map +1 -0
- package/dist/src/builder/compact.js +1553 -0
- package/dist/src/builder/compact.js.map +1 -0
- package/dist/src/builder/counting-sort.d.ts +96 -0
- package/dist/src/builder/counting-sort.d.ts.map +1 -0
- package/dist/src/builder/counting-sort.js +430 -0
- package/dist/src/builder/counting-sort.js.map +1 -0
- package/dist/src/builder/freeze.d.ts +72 -0
- package/dist/src/builder/freeze.d.ts.map +1 -0
- package/dist/src/builder/freeze.js +548 -0
- package/dist/src/builder/freeze.js.map +1 -0
- package/dist/src/builder/graph-builder.d.ts +602 -0
- package/dist/src/builder/graph-builder.d.ts.map +1 -0
- package/dist/src/builder/graph-builder.js +1940 -0
- package/dist/src/builder/graph-builder.js.map +1 -0
- package/dist/src/builder/options.d.ts +16 -0
- package/dist/src/builder/options.d.ts.map +1 -0
- package/dist/src/builder/options.js +21 -0
- package/dist/src/builder/options.js.map +1 -0
- package/dist/src/columns/bitmap.d.ts +96 -0
- package/dist/src/columns/bitmap.d.ts.map +1 -0
- package/dist/src/columns/bitmap.js +184 -0
- package/dist/src/columns/bitmap.js.map +1 -0
- package/dist/src/columns/column.d.ts +220 -0
- package/dist/src/columns/column.d.ts.map +1 -0
- package/dist/src/columns/column.js +2109 -0
- package/dist/src/columns/column.js.map +1 -0
- package/dist/src/columns/dictionary.d.ts +60 -0
- package/dist/src/columns/dictionary.d.ts.map +1 -0
- package/dist/src/columns/dictionary.js +102 -0
- package/dist/src/columns/dictionary.js.map +1 -0
- package/dist/src/columns/growable.d.ts +198 -0
- package/dist/src/columns/growable.d.ts.map +1 -0
- package/dist/src/columns/growable.js +296 -0
- package/dist/src/columns/growable.js.map +1 -0
- package/dist/src/columns/infer.d.ts +121 -0
- package/dist/src/columns/infer.d.ts.map +1 -0
- package/dist/src/columns/infer.js +268 -0
- package/dist/src/columns/infer.js.map +1 -0
- package/dist/src/columns/remap.d.ts +143 -0
- package/dist/src/columns/remap.d.ts.map +1 -0
- package/dist/src/columns/remap.js +588 -0
- package/dist/src/columns/remap.js.map +1 -0
- package/dist/src/columns/table.d.ts +184 -0
- package/dist/src/columns/table.d.ts.map +1 -0
- package/dist/src/columns/table.js +485 -0
- package/dist/src/columns/table.js.map +1 -0
- package/dist/src/constants.d.ts +34 -0
- package/dist/src/constants.d.ts.map +1 -0
- package/dist/src/constants.js +79 -0
- package/dist/src/constants.js.map +1 -0
- package/dist/src/errors.d.ts +76 -0
- package/dist/src/errors.d.ts.map +1 -0
- package/dist/src/errors.js +32 -0
- package/dist/src/errors.js.map +1 -0
- package/dist/src/ids/edge-id-index.d.ts +77 -0
- package/dist/src/ids/edge-id-index.d.ts.map +1 -0
- package/dist/src/ids/edge-id-index.js +155 -0
- package/dist/src/ids/edge-id-index.js.map +1 -0
- package/dist/src/ids/node-id-map.d.ts +280 -0
- package/dist/src/ids/node-id-map.d.ts.map +1 -0
- package/dist/src/ids/node-id-map.js +1139 -0
- package/dist/src/ids/node-id-map.js.map +1 -0
- package/dist/src/ids/string-store.d.ts +219 -0
- package/dist/src/ids/string-store.d.ts.map +1 -0
- package/dist/src/ids/string-store.js +526 -0
- package/dist/src/ids/string-store.js.map +1 -0
- package/dist/src/index.d.ts +30 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +29 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/populate/from-csr.d.ts +61 -0
- package/dist/src/populate/from-csr.d.ts.map +1 -0
- package/dist/src/populate/from-csr.js +706 -0
- package/dist/src/populate/from-csr.js.map +1 -0
- package/dist/src/populate/from-edge-arrays.d.ts +51 -0
- package/dist/src/populate/from-edge-arrays.d.ts.map +1 -0
- package/dist/src/populate/from-edge-arrays.js +217 -0
- package/dist/src/populate/from-edge-arrays.js.map +1 -0
- package/dist/src/populate/from-records.d.ts +51 -0
- package/dist/src/populate/from-records.d.ts.map +1 -0
- package/dist/src/populate/from-records.js +447 -0
- package/dist/src/populate/from-records.js.map +1 -0
- package/dist/src/snapshot/derived.d.ts +211 -0
- package/dist/src/snapshot/derived.d.ts.map +1 -0
- package/dist/src/snapshot/derived.js +1254 -0
- package/dist/src/snapshot/derived.js.map +1 -0
- package/dist/src/snapshot/graph-meta.d.ts +23 -0
- package/dist/src/snapshot/graph-meta.d.ts.map +1 -0
- package/dist/src/snapshot/graph-meta.js +159 -0
- package/dist/src/snapshot/graph-meta.js.map +1 -0
- package/dist/src/snapshot/graph-snapshot.d.ts +509 -0
- package/dist/src/snapshot/graph-snapshot.d.ts.map +1 -0
- package/dist/src/snapshot/graph-snapshot.js +1247 -0
- package/dist/src/snapshot/graph-snapshot.js.map +1 -0
- package/dist/src/snapshot/hash.d.ts +90 -0
- package/dist/src/snapshot/hash.d.ts.map +1 -0
- package/dist/src/snapshot/hash.js +228 -0
- package/dist/src/snapshot/hash.js.map +1 -0
- package/dist/src/snapshot/queries.d.ts +74 -0
- package/dist/src/snapshot/queries.d.ts.map +1 -0
- package/dist/src/snapshot/queries.js +131 -0
- package/dist/src/snapshot/queries.js.map +1 -0
- package/dist/src/snapshot/validate.d.ts +192 -0
- package/dist/src/snapshot/validate.d.ts.map +1 -0
- package/dist/src/snapshot/validate.js +990 -0
- package/dist/src/snapshot/validate.js.map +1 -0
- package/dist/src/snapshot/views.d.ts +274 -0
- package/dist/src/snapshot/views.d.ts.map +1 -0
- package/dist/src/snapshot/views.js +856 -0
- package/dist/src/snapshot/views.js.map +1 -0
- package/dist/src/types/builder.d.ts +456 -0
- package/dist/src/types/builder.d.ts.map +1 -0
- package/dist/src/types/builder.js +11 -0
- package/dist/src/types/builder.js.map +1 -0
- package/dist/src/types/columns.d.ts +615 -0
- package/dist/src/types/columns.d.ts.map +1 -0
- package/dist/src/types/columns.js +14 -0
- package/dist/src/types/columns.js.map +1 -0
- package/dist/src/types/index.d.ts +14 -0
- package/dist/src/types/index.d.ts.map +1 -0
- package/dist/src/types/index.js +11 -0
- package/dist/src/types/index.js.map +1 -0
- package/dist/src/types/internal.d.ts +172 -0
- package/dist/src/types/internal.d.ts.map +1 -0
- package/dist/src/types/internal.js +13 -0
- package/dist/src/types/internal.js.map +1 -0
- package/dist/src/types/snapshot.d.ts +801 -0
- package/dist/src/types/snapshot.d.ts.map +1 -0
- package/dist/src/types/snapshot.js +14 -0
- package/dist/src/types/snapshot.js.map +1 -0
- package/dist/src/types/wire.d.ts +196 -0
- package/dist/src/types/wire.d.ts.map +1 -0
- package/dist/src/types/wire.js +8 -0
- package/dist/src/types/wire.js.map +1 -0
- package/dist/src/util/mask.d.ts +55 -0
- package/dist/src/util/mask.d.ts.map +1 -0
- package/dist/src/util/mask.js +71 -0
- package/dist/src/util/mask.js.map +1 -0
- package/dist/src/util/options.d.ts +22 -0
- package/dist/src/util/options.d.ts.map +1 -0
- package/dist/src/util/options.js +49 -0
- package/dist/src/util/options.js.map +1 -0
- package/dist/src/util/shared-buffers.d.ts +42 -0
- package/dist/src/util/shared-buffers.d.ts.map +1 -0
- package/dist/src/util/shared-buffers.js +52 -0
- package/dist/src/util/shared-buffers.js.map +1 -0
- package/dist/src/util/typed-array.d.ts +205 -0
- package/dist/src/util/typed-array.d.ts.map +1 -0
- package/dist/src/util/typed-array.js +289 -0
- package/dist/src/util/typed-array.js.map +1 -0
- package/dist/src/wire/bytes.d.ts +69 -0
- package/dist/src/wire/bytes.d.ts.map +1 -0
- package/dist/src/wire/bytes.js +361 -0
- package/dist/src/wire/bytes.js.map +1 -0
- package/dist/src/wire/carried-views.d.ts +111 -0
- package/dist/src/wire/carried-views.d.ts.map +1 -0
- package/dist/src/wire/carried-views.js +286 -0
- package/dist/src/wire/carried-views.js.map +1 -0
- package/dist/src/wire/from-wire.d.ts +144 -0
- package/dist/src/wire/from-wire.d.ts.map +1 -0
- package/dist/src/wire/from-wire.js +1425 -0
- package/dist/src/wire/from-wire.js.map +1 -0
- package/dist/src/wire/to-wire.d.ts +171 -0
- package/dist/src/wire/to-wire.d.ts.map +1 -0
- package/dist/src/wire/to-wire.js +652 -0
- package/dist/src/wire/to-wire.js.map +1 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -0
- package/package.json +72 -7
- package/src/builder/arena.ts +192 -0
- package/src/builder/compact.ts +1811 -0
- package/src/builder/counting-sort.ts +506 -0
- package/src/builder/freeze.ts +689 -0
- package/src/builder/graph-builder.ts +2264 -0
- package/src/builder/options.ts +29 -0
- package/src/columns/bitmap.ts +196 -0
- package/src/columns/column.ts +2574 -0
- package/src/columns/dictionary.ts +114 -0
- package/src/columns/growable.ts +350 -0
- package/src/columns/infer.ts +285 -0
- package/src/columns/remap.ts +663 -0
- package/src/columns/table.ts +568 -0
- package/src/constants.ts +89 -0
- package/src/errors.ts +115 -0
- package/src/ids/edge-id-index.ts +179 -0
- package/src/ids/node-id-map.ts +1340 -0
- package/src/ids/string-store.ts +589 -0
- package/src/index.ts +139 -0
- package/src/lib-resizable-array-buffer.d.ts +34 -0
- package/src/populate/from-csr.ts +802 -0
- package/src/populate/from-edge-arrays.ts +257 -0
- package/src/populate/from-records.ts +536 -0
- package/src/snapshot/derived.ts +1486 -0
- package/src/snapshot/graph-meta.ts +167 -0
- package/src/snapshot/graph-snapshot.ts +1503 -0
- package/src/snapshot/hash.ts +241 -0
- package/src/snapshot/queries.ts +136 -0
- package/src/snapshot/validate.ts +1108 -0
- package/src/snapshot/views.ts +943 -0
- package/src/types/builder.ts +480 -0
- package/src/types/columns.ts +727 -0
- package/src/types/index.ts +14 -0
- package/src/types/internal.ts +195 -0
- package/src/types/snapshot.ts +886 -0
- package/src/types/wire.ts +207 -0
- package/src/util/mask.ts +89 -0
- package/src/util/options.ts +57 -0
- package/src/util/shared-buffers.ts +56 -0
- package/src/util/typed-array.ts +371 -0
- package/src/wire/bytes.ts +440 -0
- package/src/wire/carried-views.ts +327 -0
- package/src/wire/from-wire.ts +1690 -0
- package/src/wire/to-wire.ts +755 -0
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Column implementations for every dtype of design section 5.1, the column factory that wraps raw
|
|
3
|
+
* storage (MutableColumnParts) into a Column, the declaration resolver (ColumnDecl -> ColumnMeta,
|
|
4
|
+
* design sections 5.3 and 5.5), the constructors the table uses for typed arrays, JS arrays and
|
|
5
|
+
* empty declared columns. Bitmap and padding arithmetic comes from bitmap.ts and util/typed-array.ts.
|
|
6
|
+
*
|
|
7
|
+
* Storage follows Apache Arrow's layout without the dependency: a typed values buffer, an optional
|
|
8
|
+
* validity bitmap (u32 words, LSB-first, ceil(rows / 32) words -- the one bitmap layout of the
|
|
9
|
+
* package, decision C13), an optional dictionary, offsets or child, and per-column metadata. No
|
|
10
|
+
* per-row objects exist anywhere. Column contents are frozen by contract unless meta.mutable is true
|
|
11
|
+
* (design section 5.8); the mutable gating throws E_COLUMN_IMMUTABLE.
|
|
12
|
+
*/
|
|
13
|
+
import { type Column, type ColumnDeclPatch, type ColumnDomain, type ColumnMeta, type Dtype, type F32, type GpuEligibility, type I32, type TypedArrayData, type U8, type U32 } from "../types/index.js";
|
|
14
|
+
import { type MutableColumnParts } from "../types/internal.js";
|
|
15
|
+
import { DictionaryBuilder } from "./dictionary.js";
|
|
16
|
+
type NumericDtype = "f32" | "f64" | "i32" | "u32" | "u8";
|
|
17
|
+
/**
|
|
18
|
+
* Allocate a u8 store from which a zero-copy padded u32 view is constructible (design section 5.7):
|
|
19
|
+
* the backing buffer is a multiple of 4 bytes even when the length is not.
|
|
20
|
+
* @param length - the number of bytes
|
|
21
|
+
* @returns a fresh Uint8Array over a padded buffer
|
|
22
|
+
*/
|
|
23
|
+
export declare function allocU8(length: number): U8;
|
|
24
|
+
/**
|
|
25
|
+
* GPU eligibility of a dtype (design section 10.4).
|
|
26
|
+
* @param dtype - the column dtype
|
|
27
|
+
* @returns "direct" for u32 / i32 / f32 / dict, "packed" for u8 / bool, "convert" for f64, "none" otherwise
|
|
28
|
+
*/
|
|
29
|
+
export declare function gpuEligibility(dtype: Dtype): GpuEligibility;
|
|
30
|
+
/**
|
|
31
|
+
* Whether a value is a plain object (prototype Object.prototype or null), the only object shape JSON
|
|
32
|
+
* carries.
|
|
33
|
+
* @param value - the value to test
|
|
34
|
+
* @returns true for a plain object
|
|
35
|
+
*/
|
|
36
|
+
export declare function isPlainObject(value: unknown): value is Record<string, unknown>;
|
|
37
|
+
/**
|
|
38
|
+
* Reject a metadata value that JSON cannot carry (design section 5.9): only null, booleans, numbers
|
|
39
|
+
* (non-finite and -0 included; the wire tags them), well-formed strings, arrays and plain objects of
|
|
40
|
+
* such values are accepted. E_COLUMN_TYPE with details.field otherwise.
|
|
41
|
+
* @param value - the value to check
|
|
42
|
+
* @param field - the metadata field name for the error details
|
|
43
|
+
* @param depth - the nesting depth of `value` (E_COLUMN_TYPE beyond MAX_JSON_DEPTH)
|
|
44
|
+
*/
|
|
45
|
+
export declare function assertJsonValue(value: unknown, field: string, depth?: number): void;
|
|
46
|
+
/**
|
|
47
|
+
* Whether a number is exactly representable in a numeric dtype: any number for f32 / f64, an integer
|
|
48
|
+
* in range for i32 / u32 / u8.
|
|
49
|
+
* @param dtype - the numeric dtype
|
|
50
|
+
* @param value - the number
|
|
51
|
+
* @returns true when the dtype stores the value without change
|
|
52
|
+
*/
|
|
53
|
+
export declare function representableNumber(dtype: NumericDtype, value: number): boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Resolve a column declaration into the complete metadata of design section 5.5: every field
|
|
56
|
+
* present, null for none, defaults applied, every rule checked (components, list child, refersTo,
|
|
57
|
+
* JSON-ness of default / options / extra, fill typing). E_COLUMN_TYPE with details.field on every
|
|
58
|
+
* violation.
|
|
59
|
+
* @param name - the column name (overrides decl.name)
|
|
60
|
+
* @param domain - the table the column belongs to
|
|
61
|
+
* @param decl - the declaration; dtype is required
|
|
62
|
+
* @returns the resolved metadata, frozen
|
|
63
|
+
*/
|
|
64
|
+
export declare function resolveColumnMeta(name: string, domain: ColumnDomain, decl: ColumnDeclPatch): ColumnMeta;
|
|
65
|
+
/**
|
|
66
|
+
* The declaration that reproduces a column's metadata, for patching an existing column's meta
|
|
67
|
+
* (rename, move between tables, set() with a decl patch).
|
|
68
|
+
* @param meta - the metadata to convert
|
|
69
|
+
* @returns an equivalent declaration patch
|
|
70
|
+
*/
|
|
71
|
+
export declare function metaToDecl(meta: ColumnMeta): ColumnDeclPatch;
|
|
72
|
+
/**
|
|
73
|
+
* Whether a value is an array-like of exactly `length` numbers (a multi-component cell).
|
|
74
|
+
* @param value - the value
|
|
75
|
+
* @param length - the required length
|
|
76
|
+
* @returns true for a numeric vector of that length
|
|
77
|
+
*/
|
|
78
|
+
export declare function isArrayLikeNumbers(value: unknown, length: number): value is ArrayLike<number>;
|
|
79
|
+
/**
|
|
80
|
+
* Whether a value is a Column built by this package's factory (the structural Column type also
|
|
81
|
+
* admits a foreign object with the right members, which the table refuses with E_COLUMN_TYPE).
|
|
82
|
+
* @param value - the candidate
|
|
83
|
+
* @returns true for an instance of a column implementation
|
|
84
|
+
*/
|
|
85
|
+
export declare function isPackageColumn(value: unknown): value is Column;
|
|
86
|
+
/**
|
|
87
|
+
* Whether a column's storage was transferred away (design section 9.1): derived from the array
|
|
88
|
+
* state. Every accessor of such a column throws E_DETACHED; the wire module and the checksum
|
|
89
|
+
* comparison ask first.
|
|
90
|
+
* @param column - any column
|
|
91
|
+
* @returns true when detached
|
|
92
|
+
*/
|
|
93
|
+
export declare function isColumnDetached(column: Column): boolean;
|
|
94
|
+
/**
|
|
95
|
+
* Wrap raw column storage into a Column of the dtype named by parts.meta (the column factory of
|
|
96
|
+
* design section 5.7). Checks the slot use and the length rules of invariant I12 (E_COLUMN_LENGTH /
|
|
97
|
+
* E_COLUMN_TYPE / E_COLUMN_ALIGNMENT), recomputes nullCount from the validity bitmap, and adopts
|
|
98
|
+
* every buffer by reference.
|
|
99
|
+
* @param parts - the storage slots; every slot the dtype does not use must be null
|
|
100
|
+
* @returns the column
|
|
101
|
+
*/
|
|
102
|
+
export declare function createColumn(parts: MutableColumnParts): Column;
|
|
103
|
+
/**
|
|
104
|
+
* The raw storage of a column, sharing every buffer by reference (the inverse of createColumn): used
|
|
105
|
+
* to re-wrap a column under new metadata and by the remap helpers.
|
|
106
|
+
* @param column - the column to unwrap
|
|
107
|
+
* @returns its storage slots
|
|
108
|
+
*/
|
|
109
|
+
export declare function partsOf(column: Column): MutableColumnParts;
|
|
110
|
+
/**
|
|
111
|
+
* The distinct backing buffers of a column's materialised typed storage (data or codes, validity,
|
|
112
|
+
* a materialised Utf8 store, a list's offsets and child), for the owner count of design section
|
|
113
|
+
* 9.1: a table claims them when it attaches the column, so a buffer viewed from two tables (a
|
|
114
|
+
* zero-copy slice, a same-realm wire receiver) is recognised as shared. A string store that has not
|
|
115
|
+
* been materialised is not encoded by asking.
|
|
116
|
+
* @param column - the column
|
|
117
|
+
* @returns the buffers, each once
|
|
118
|
+
*/
|
|
119
|
+
export declare function columnBuffers(column: Column): ArrayBuffer[];
|
|
120
|
+
/**
|
|
121
|
+
* The same storage under different metadata (a rename, a move to another table, a declaration
|
|
122
|
+
* patch); the buffers are shared, the Column object is new. The dtype, components and list child
|
|
123
|
+
* shape must be unchanged (E_COLUMN_TYPE otherwise); the fill is kept because the unset rows
|
|
124
|
+
* physically hold it; a nullable -> non-nullable change requires no unset rows.
|
|
125
|
+
* @param column - the column to re-wrap
|
|
126
|
+
* @param meta - the new metadata
|
|
127
|
+
* @returns a new column sharing the storage
|
|
128
|
+
*/
|
|
129
|
+
export declare function rewrapColumn(column: Column, meta: ColumnMeta): Column;
|
|
130
|
+
/**
|
|
131
|
+
* Release the cached f32 copy a `gpuView()` of an f64 column keeps (design section 7.2:
|
|
132
|
+
* `dropCaches()` releases every cached gpuView copy). A no-op for every other dtype.
|
|
133
|
+
* @param column - the column
|
|
134
|
+
*/
|
|
135
|
+
export declare function dropGpuViewCache(column: Column): void;
|
|
136
|
+
/**
|
|
137
|
+
* The array a GPU binds for a column (design section 10.4): its own data for u32 / i32 / f32, the
|
|
138
|
+
* padded view for u8, the packed words for bool, the codes for dict, and a cached f32 copy for f64
|
|
139
|
+
* (dropped by markDirty() and by GraphSnapshot.dropCaches()).
|
|
140
|
+
* @param column - the column
|
|
141
|
+
* @returns the bindable array; E_GPU_INELIGIBLE for string / list / json
|
|
142
|
+
*/
|
|
143
|
+
export declare function gpuViewOf(column: Column): U32 | I32 | F32;
|
|
144
|
+
/**
|
|
145
|
+
* The initial dictionary of a dict column: the declared options in order, then the fill when it is
|
|
146
|
+
* a string not among them (so the fill code names a member).
|
|
147
|
+
* @param meta - the column metadata
|
|
148
|
+
* @returns the seeded dictionary builder
|
|
149
|
+
*/
|
|
150
|
+
export declare function seedDictionary(meta: ColumnMeta): DictionaryBuilder;
|
|
151
|
+
/**
|
|
152
|
+
* A MutableColumnParts record with every storage slot null, for producers that fill one slot.
|
|
153
|
+
* @param meta - the column metadata
|
|
154
|
+
* @param length - the row count
|
|
155
|
+
* @param validity - the validity bitmap, or null
|
|
156
|
+
* @returns the parts
|
|
157
|
+
*/
|
|
158
|
+
export declare function emptyParts(meta: ColumnMeta, length: number, validity: U32 | null): MutableColumnParts;
|
|
159
|
+
/**
|
|
160
|
+
* A column of `length` rows with no value set: every row unset (when nullable) and the data holding
|
|
161
|
+
* the fill (design section 5.3). This is what a declared column looks like before any value is
|
|
162
|
+
* written, and what remap uses for rows no source row maps to.
|
|
163
|
+
* @param domain - the table the column belongs to
|
|
164
|
+
* @param length - the number of rows
|
|
165
|
+
* @param decl - the declaration; dtype required
|
|
166
|
+
* @returns the empty column
|
|
167
|
+
*/
|
|
168
|
+
export declare function createEmptyColumn(domain: ColumnDomain, length: number, decl: ColumnDeclPatch): Column;
|
|
169
|
+
/**
|
|
170
|
+
* A column from a JS array of values under resolved metadata (one entry per row; undefined, and null
|
|
171
|
+
* except for json, is an unset row). Values are coerced per design section 5.1 (a boolean into a
|
|
172
|
+
* number column becomes 1 / 0, a number or boolean into a string column its canonical text) and
|
|
173
|
+
* rejected with E_COLUMN_TYPE otherwise.
|
|
174
|
+
* @param meta - the resolved metadata
|
|
175
|
+
* @param values - the entries, `length` of them
|
|
176
|
+
* @returns the column
|
|
177
|
+
*/
|
|
178
|
+
export declare function columnOfValues(meta: ColumnMeta, values: readonly unknown[]): Column;
|
|
179
|
+
/**
|
|
180
|
+
* Allocate a numeric buffer of a dtype (a padded store for u8).
|
|
181
|
+
* @param dtype - the numeric dtype
|
|
182
|
+
* @param length - the element count
|
|
183
|
+
* @returns the zeroed array
|
|
184
|
+
*/
|
|
185
|
+
export declare function allocNumeric(dtype: NumericDtype, length: number): TypedArrayData;
|
|
186
|
+
/**
|
|
187
|
+
* A column from a JS array of values with a declaration patch (the set() path for string / list /
|
|
188
|
+
* json and for inferred dtypes). The dtype is inferred when the patch has none; nullable defaults to
|
|
189
|
+
* true.
|
|
190
|
+
* @param domain - the table the column belongs to
|
|
191
|
+
* @param length - the table's row count; E_COLUMN_LENGTH when values.length differs
|
|
192
|
+
* @param name - the column name
|
|
193
|
+
* @param values - the entries, one per row
|
|
194
|
+
* @param decl - the declaration patch
|
|
195
|
+
* @returns the column
|
|
196
|
+
*/
|
|
197
|
+
export declare function columnFromValues(domain: ColumnDomain, length: number, name: string, values: readonly unknown[], decl: ColumnDeclPatch): Column;
|
|
198
|
+
/**
|
|
199
|
+
* The dtype a typed array class implies when the caller gave none.
|
|
200
|
+
* @param data - the array
|
|
201
|
+
* @returns f32 / f64 / i32 / u32 / u8
|
|
202
|
+
*/
|
|
203
|
+
export declare function dtypeOfArray(data: TypedArrayData): NumericDtype;
|
|
204
|
+
/**
|
|
205
|
+
* A column adopting a typed array by reference (design section 5.7): the dtype comes from the array
|
|
206
|
+
* class unless the patch names one (bool and dict over a Uint32Array); the length must be rowCount *
|
|
207
|
+
* components (bool: ceil(rowCount / 32)) or E_COLUMN_LENGTH; a u8 array from which no padded u32 view
|
|
208
|
+
* is constructible is copied, or refused with E_COLUMN_ALIGNMENT under adopt "strict". nullable
|
|
209
|
+
* defaults to false (every row is set).
|
|
210
|
+
* @param domain - the table the column belongs to
|
|
211
|
+
* @param length - the table's row count
|
|
212
|
+
* @param name - the column name
|
|
213
|
+
* @param data - the typed array
|
|
214
|
+
* @param decl - the declaration patch
|
|
215
|
+
* @param adopt - "copy" (default) or "strict"
|
|
216
|
+
* @returns the column (`column.data !== data` only when a u8 array was copied)
|
|
217
|
+
*/
|
|
218
|
+
export declare function columnFromTypedArray(domain: ColumnDomain, length: number, name: string, data: TypedArrayData, decl: ColumnDeclPatch, adopt?: "copy" | "strict"): Column;
|
|
219
|
+
export {};
|
|
220
|
+
//# sourceMappingURL=column.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"column.d.ts","sourceRoot":"","sources":["../../../src/columns/column.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAKH,OAAO,EAEH,KAAK,MAAM,EACX,KAAK,eAAe,EACpB,KAAK,YAAY,EACjB,KAAK,UAAU,EAKf,KAAK,KAAK,EAEV,KAAK,GAAG,EAIR,KAAK,cAAc,EACnB,KAAK,GAAG,EAMR,KAAK,cAAc,EACnB,KAAK,EAAE,EAEP,KAAK,GAAG,EAEX,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAI/D,OAAO,EAAwC,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAK1F,KAAK,YAAY,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,IAA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