@konstit/dne 0.0.2 → 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.
- package/README.md +215 -13
- package/data/dne.bin +0 -0
- package/dist/bairro.d.ts +27 -0
- package/dist/bairro.js +9 -0
- package/dist/bairro.js.map +1 -0
- package/dist/binary-db-errors.d.ts +56 -0
- package/dist/binary-db-errors.js +68 -0
- package/dist/binary-db-errors.js.map +1 -0
- package/dist/binary-db-format.d.ts +192 -0
- package/dist/binary-db-format.js +250 -0
- package/dist/binary-db-format.js.map +1 -0
- package/dist/binary-db-reader.d.ts +114 -0
- package/dist/binary-db-reader.js +700 -0
- package/dist/binary-db-reader.js.map +1 -0
- package/dist/cep.d.ts +50 -0
- package/dist/cep.js +184 -0
- package/dist/cep.js.map +1 -0
- package/dist/errors.d.ts +14 -0
- package/dist/errors.js +21 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.js +55 -33
- package/dist/index.js.map +29 -16
- package/dist/library.d.ts +10 -0
- package/dist/library.js +8 -0
- package/dist/library.js.map +1 -0
- package/dist/schema.d.ts +88 -0
- package/dist/schema.js +233 -0
- package/dist/schema.js.map +1 -0
- package/dist/settings.d.ts +34 -0
- package/dist/settings.js +35 -0
- package/dist/settings.js.map +1 -0
- package/dist/sqlite-db-errors.d.ts +40 -0
- package/dist/sqlite-db-errors.js +54 -0
- package/dist/sqlite-db-errors.js.map +1 -0
- package/dist/sqlite-db-reader.d.ts +130 -0
- package/dist/sqlite-db-reader.js +307 -0
- package/dist/sqlite-db-reader.js.map +1 -0
- package/dist/sqlite-db-schema.d.ts +49 -0
- package/dist/sqlite-db-schema.js +115 -0
- package/dist/sqlite-db-schema.js.map +1 -0
- package/dist/types.d.ts +90 -0
- package/dist/types.js +49 -0
- package/dist/types.js.map +1 -0
- package/package.json +17 -4
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Binary format revision accepted by the current reader and emitted by the writer.
|
|
3
|
+
*/
|
|
4
|
+
export declare const BINARY_DATABASE_VERSION = 1;
|
|
5
|
+
/**
|
|
6
|
+
* Fixed file-header size in bytes, including the section directory and reserved space.
|
|
7
|
+
*/
|
|
8
|
+
export declare const BINARY_DATABASE_HEADER_SIZE = 256;
|
|
9
|
+
/** Neighborhood section header: row count and widths of the original DNE identifiers. */
|
|
10
|
+
export declare const BINARY_BAIRRO_HEADER_SIZE = 16;
|
|
11
|
+
/**
|
|
12
|
+
* Eight-byte signature identifying a DNE binary database, independent of its version.
|
|
13
|
+
*/
|
|
14
|
+
export declare const BINARY_DATABASE_MAGIC: Uint8Array<ArrayBuffer>;
|
|
15
|
+
/**
|
|
16
|
+
* Largest integer representable by an unsigned four-byte field.
|
|
17
|
+
*/
|
|
18
|
+
export declare const MAX_UINT32 = 4294967295;
|
|
19
|
+
/**
|
|
20
|
+
* Number of possible five-digit CEP prefixes.
|
|
21
|
+
*/
|
|
22
|
+
export declare const CEP_PREFIX_COUNT = 100000;
|
|
23
|
+
/**
|
|
24
|
+
* Number of CEP prefix offsets, including the final row-count sentinel.
|
|
25
|
+
*/
|
|
26
|
+
export declare const CEP_PREFIX_OFFSETS_COUNT: number;
|
|
27
|
+
/**
|
|
28
|
+
* Number of bits used to store each three-digit CEP suffix.
|
|
29
|
+
*/
|
|
30
|
+
export declare const CEP_SUFFIX_BITS = 10;
|
|
31
|
+
/**
|
|
32
|
+
* Size in bytes of a front-coded string dictionary header.
|
|
33
|
+
*/
|
|
34
|
+
export declare const DICTIONARY_HEADER_SIZE = 32;
|
|
35
|
+
/**
|
|
36
|
+
* Base-two logarithm of the number of strings in one dictionary block.
|
|
37
|
+
*/
|
|
38
|
+
export declare const DICTIONARY_BLOCK_SHIFT = 3;
|
|
39
|
+
/**
|
|
40
|
+
* Number of strings decoded from a shared front-coding block.
|
|
41
|
+
*/
|
|
42
|
+
export declare const DICTIONARY_BLOCK_SIZE: number;
|
|
43
|
+
/**
|
|
44
|
+
* Base-two logarithm of the row count covered by one sparse-rank block.
|
|
45
|
+
*/
|
|
46
|
+
export declare const SPARSE_RANK_SHIFT = 8;
|
|
47
|
+
/**
|
|
48
|
+
* Number of rows covered by a sparse-rank index entry.
|
|
49
|
+
*/
|
|
50
|
+
export declare const SPARSE_RANK_ROWS: number;
|
|
51
|
+
/**
|
|
52
|
+
* Absolute byte offset of the section directory within the file header.
|
|
53
|
+
*/
|
|
54
|
+
export declare const SECTION_TABLE_OFFSET = 32;
|
|
55
|
+
/**
|
|
56
|
+
* Canonical section order used by the binary header directory and file writer.
|
|
57
|
+
*/
|
|
58
|
+
export declare const BINARY_SECTION_NAMES: readonly ["metadata", "cepPrefixOffsets", "cepSuffixes", "logradouroIds", "complementoBitmap", "complementoRanks", "complementoIds", "bairroIds", "municipalityIds", "nomeBitmap", "nomeRanks", "nomeIds", "municipalities", "logradouroDictionary", "complementoDictionary", "bairroDictionary", "municipioDictionary", "ufDictionary", "nomeDictionary", "localidadeFlags", "bairros", "bairroFaixaOffsets", "bairroFaixas", "bairroAbreviadoDictionary", "localidadeNomeBitmap", "localidadeNomeRanks", "localidadeNomeIds"];
|
|
59
|
+
/**
|
|
60
|
+
* Name of one section in the current binary file format.
|
|
61
|
+
*/
|
|
62
|
+
export type BinarySectionName = (typeof BINARY_SECTION_NAMES)[number];
|
|
63
|
+
/**
|
|
64
|
+
* Supported byte widths for a packed unsigned integer.
|
|
65
|
+
*/
|
|
66
|
+
export type ByteWidth = 1 | 2 | 3 | 4;
|
|
67
|
+
/**
|
|
68
|
+
* Byte range occupied by a section in the binary database.
|
|
69
|
+
*/
|
|
70
|
+
export type BinaryRegion = {
|
|
71
|
+
/**
|
|
72
|
+
* Section length in bytes, excluding alignment padding.
|
|
73
|
+
*/
|
|
74
|
+
length: number;
|
|
75
|
+
/**
|
|
76
|
+
* Absolute byte offset from the beginning of the file.
|
|
77
|
+
*/
|
|
78
|
+
offset: number;
|
|
79
|
+
};
|
|
80
|
+
/**
|
|
81
|
+
* Decoded binary header, with section ranges expressed as absolute byte offsets.
|
|
82
|
+
*/
|
|
83
|
+
export type BinaryHeader = {
|
|
84
|
+
/**
|
|
85
|
+
* Byte width of each row offset in the CEP prefix directory.
|
|
86
|
+
*/
|
|
87
|
+
cepPrefixOffsetWidth: ByteWidth;
|
|
88
|
+
/**
|
|
89
|
+
* Total file length in bytes, including final alignment padding.
|
|
90
|
+
*/
|
|
91
|
+
fileSize: number;
|
|
92
|
+
/**
|
|
93
|
+
* Number of records in the municipality table.
|
|
94
|
+
*/
|
|
95
|
+
municipalityCount: number;
|
|
96
|
+
/**
|
|
97
|
+
* Byte width of municipality IDs in the row-oriented column.
|
|
98
|
+
*/
|
|
99
|
+
municipalityIdWidth: ByteWidth;
|
|
100
|
+
/**
|
|
101
|
+
* Number of CEP records across all row-oriented columns.
|
|
102
|
+
*/
|
|
103
|
+
rowCount: number;
|
|
104
|
+
/**
|
|
105
|
+
* Location and size of each required section.
|
|
106
|
+
*/
|
|
107
|
+
sections: Record<BinarySectionName, BinaryRegion>;
|
|
108
|
+
};
|
|
109
|
+
/**
|
|
110
|
+
* Rounds a nonnegative byte offset up to the next eight-byte boundary.
|
|
111
|
+
* @param value - Byte offset or length to align.
|
|
112
|
+
* @returns An aligned offset greater than or equal to the input.
|
|
113
|
+
*/
|
|
114
|
+
export declare function alignBinaryOffset(value: number): number;
|
|
115
|
+
/**
|
|
116
|
+
* Computes storage for one presence bit per row.
|
|
117
|
+
* @param rowCount - Nonnegative number of rows.
|
|
118
|
+
* @returns The minimum whole-byte length of the bitmap.
|
|
119
|
+
*/
|
|
120
|
+
export declare function bitmapByteLength(rowCount: number): number;
|
|
121
|
+
/**
|
|
122
|
+
* Computes storage for a column of fixed-width bit-packed values.
|
|
123
|
+
* @param count - Nonnegative number of values.
|
|
124
|
+
* @param bits - Positive bit width of each value.
|
|
125
|
+
* @returns The minimum whole-byte length of the packed column.
|
|
126
|
+
*/
|
|
127
|
+
export declare function packedBitLength(count: number, bits: number): number;
|
|
128
|
+
/**
|
|
129
|
+
* Builds the lookup table used to count set bits in each possible byte.
|
|
130
|
+
* @returns A new 256-entry array whose entry i is the population count of i.
|
|
131
|
+
*/
|
|
132
|
+
export declare function createPopcountTable(): Uint8Array<ArrayBuffer>;
|
|
133
|
+
/**
|
|
134
|
+
* Chooses the smallest supported byte width for a nonnegative unsigned integer.
|
|
135
|
+
* @param maxValue - Maximum value to store; callers must ensure it fits in four bytes.
|
|
136
|
+
* @returns A width from one through four bytes.
|
|
137
|
+
*/
|
|
138
|
+
export declare function integerByteWidth(maxValue: number): ByteWidth;
|
|
139
|
+
/**
|
|
140
|
+
* Validates a byte-width value decoded from a binary header.
|
|
141
|
+
* @param value - Encoded width.
|
|
142
|
+
* @param name - Field name included in diagnostics.
|
|
143
|
+
* @returns The validated width.
|
|
144
|
+
* @throws {Error} If the width is not 1, 2, 3, or 4.
|
|
145
|
+
*/
|
|
146
|
+
export declare function readByteWidth(value: number, name: string): ByteWidth;
|
|
147
|
+
/**
|
|
148
|
+
* Returns the largest unsigned integer representable by a supported width.
|
|
149
|
+
* @param width - Storage width in bytes.
|
|
150
|
+
* @returns The inclusive maximum value for that width.
|
|
151
|
+
*/
|
|
152
|
+
export declare function maxPackedInteger(width: ByteWidth): number;
|
|
153
|
+
/**
|
|
154
|
+
* Validates an integer before writing it to a packed column.
|
|
155
|
+
* @param value - Candidate unsigned integer.
|
|
156
|
+
* @param width - Available storage in bytes.
|
|
157
|
+
* @param name - Field name included in diagnostics.
|
|
158
|
+
* @throws {Error} If the value is negative, unsafe, fractional, or too large for the width.
|
|
159
|
+
*/
|
|
160
|
+
export declare function assertPackedInteger(value: number, width: ByteWidth, name: string): void;
|
|
161
|
+
/**
|
|
162
|
+
* Reads one little-endian unsigned integer from a data view.
|
|
163
|
+
* @param data - View over the binary bytes.
|
|
164
|
+
* @param offset - Byte offset relative to the view.
|
|
165
|
+
* @param width - Number of bytes to read.
|
|
166
|
+
* @returns The decoded unsigned integer.
|
|
167
|
+
* @throws {RangeError} If the requested bytes lie outside the view.
|
|
168
|
+
*/
|
|
169
|
+
export declare function readPackedInteger(data: DataView, offset: number, width: ByteWidth): number;
|
|
170
|
+
/**
|
|
171
|
+
* Writes a little-endian unsigned integer to a caller-owned byte array.
|
|
172
|
+
* @param target - Destination with room for the complete value.
|
|
173
|
+
* @param offset - Starting byte offset within the destination.
|
|
174
|
+
* @param value - Unsigned integer to encode.
|
|
175
|
+
* @param width - Storage width in bytes.
|
|
176
|
+
* @throws {Error} If the value does not fit the requested width. The caller must validate destination bounds.
|
|
177
|
+
*/
|
|
178
|
+
export declare function writePackedInteger(target: Uint8Array, offset: number, value: number, width: ByteWidth): void;
|
|
179
|
+
/**
|
|
180
|
+
* Compares a byte sequence to the complete binary file signature.
|
|
181
|
+
* @param bytes - Candidate signature; its length must exactly match the magic length.
|
|
182
|
+
* @returns True only for an exact signature match.
|
|
183
|
+
*/
|
|
184
|
+
export declare function hasBinaryMagic(bytes: Uint8Array): boolean;
|
|
185
|
+
/**
|
|
186
|
+
* Writes a ten-bit CEP suffix into a packed column.
|
|
187
|
+
* @param target - Destination bytes sized for the full packed column.
|
|
188
|
+
* @param index - Zero-based value index within the column.
|
|
189
|
+
* @param value - Unsigned integer smaller than 1024.
|
|
190
|
+
* @throws {Error} If the value exceeds the ten-bit range.
|
|
191
|
+
*/
|
|
192
|
+
export declare function writePacked10(target: Uint8Array, index: number, value: number): void;
|
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Binary format revision accepted by the current reader and emitted by the writer.
|
|
3
|
+
*/
|
|
4
|
+
export const BINARY_DATABASE_VERSION = 1;
|
|
5
|
+
/**
|
|
6
|
+
* Fixed file-header size in bytes, including the section directory and reserved space.
|
|
7
|
+
*/
|
|
8
|
+
export const BINARY_DATABASE_HEADER_SIZE = 256;
|
|
9
|
+
/** Neighborhood section header: row count and widths of the original DNE identifiers. */
|
|
10
|
+
export const BINARY_BAIRRO_HEADER_SIZE = 16;
|
|
11
|
+
/**
|
|
12
|
+
* Eight-byte signature identifying a DNE binary database, independent of its version.
|
|
13
|
+
*/
|
|
14
|
+
export const BINARY_DATABASE_MAGIC = Uint8Array.from([68, 78, 69, 66, 73, 78, 0, 0]); // DNEBIN\0\0
|
|
15
|
+
/**
|
|
16
|
+
* Largest integer representable by an unsigned four-byte field.
|
|
17
|
+
*/
|
|
18
|
+
export const MAX_UINT32 = 0xffff_ffff;
|
|
19
|
+
/**
|
|
20
|
+
* Number of possible five-digit CEP prefixes.
|
|
21
|
+
*/
|
|
22
|
+
export const CEP_PREFIX_COUNT = 100_000;
|
|
23
|
+
/**
|
|
24
|
+
* Number of CEP prefix offsets, including the final row-count sentinel.
|
|
25
|
+
*/
|
|
26
|
+
export const CEP_PREFIX_OFFSETS_COUNT = CEP_PREFIX_COUNT + 1;
|
|
27
|
+
/**
|
|
28
|
+
* Number of bits used to store each three-digit CEP suffix.
|
|
29
|
+
*/
|
|
30
|
+
export const CEP_SUFFIX_BITS = 10;
|
|
31
|
+
/**
|
|
32
|
+
* Size in bytes of a front-coded string dictionary header.
|
|
33
|
+
*/
|
|
34
|
+
export const DICTIONARY_HEADER_SIZE = 32;
|
|
35
|
+
/**
|
|
36
|
+
* Base-two logarithm of the number of strings in one dictionary block.
|
|
37
|
+
*/
|
|
38
|
+
export const DICTIONARY_BLOCK_SHIFT = 3;
|
|
39
|
+
/**
|
|
40
|
+
* Number of strings decoded from a shared front-coding block.
|
|
41
|
+
*/
|
|
42
|
+
export const DICTIONARY_BLOCK_SIZE = 1 << DICTIONARY_BLOCK_SHIFT;
|
|
43
|
+
/**
|
|
44
|
+
* Base-two logarithm of the row count covered by one sparse-rank block.
|
|
45
|
+
*/
|
|
46
|
+
export const SPARSE_RANK_SHIFT = 8;
|
|
47
|
+
/**
|
|
48
|
+
* Number of rows covered by a sparse-rank index entry.
|
|
49
|
+
*/
|
|
50
|
+
export const SPARSE_RANK_ROWS = 1 << SPARSE_RANK_SHIFT;
|
|
51
|
+
/**
|
|
52
|
+
* Absolute byte offset of the section directory within the file header.
|
|
53
|
+
*/
|
|
54
|
+
export const SECTION_TABLE_OFFSET = 32;
|
|
55
|
+
/**
|
|
56
|
+
* Canonical section order used by the binary header directory and file writer.
|
|
57
|
+
*/
|
|
58
|
+
export const BINARY_SECTION_NAMES = [
|
|
59
|
+
'metadata',
|
|
60
|
+
'cepPrefixOffsets',
|
|
61
|
+
'cepSuffixes',
|
|
62
|
+
'logradouroIds',
|
|
63
|
+
'complementoBitmap',
|
|
64
|
+
'complementoRanks',
|
|
65
|
+
'complementoIds',
|
|
66
|
+
'bairroIds',
|
|
67
|
+
'municipalityIds',
|
|
68
|
+
'nomeBitmap',
|
|
69
|
+
'nomeRanks',
|
|
70
|
+
'nomeIds',
|
|
71
|
+
'municipalities',
|
|
72
|
+
'logradouroDictionary',
|
|
73
|
+
'complementoDictionary',
|
|
74
|
+
'bairroDictionary',
|
|
75
|
+
'municipioDictionary',
|
|
76
|
+
'ufDictionary',
|
|
77
|
+
'nomeDictionary',
|
|
78
|
+
'localidadeFlags',
|
|
79
|
+
'bairros',
|
|
80
|
+
'bairroFaixaOffsets',
|
|
81
|
+
'bairroFaixas',
|
|
82
|
+
'bairroAbreviadoDictionary',
|
|
83
|
+
'localidadeNomeBitmap',
|
|
84
|
+
'localidadeNomeRanks',
|
|
85
|
+
'localidadeNomeIds',
|
|
86
|
+
];
|
|
87
|
+
/**
|
|
88
|
+
* Rounds a nonnegative byte offset up to the next eight-byte boundary.
|
|
89
|
+
* @param value - Byte offset or length to align.
|
|
90
|
+
* @returns An aligned offset greater than or equal to the input.
|
|
91
|
+
*/
|
|
92
|
+
export function alignBinaryOffset(value) {
|
|
93
|
+
return Math.ceil(value / 8) * 8;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Computes storage for one presence bit per row.
|
|
97
|
+
* @param rowCount - Nonnegative number of rows.
|
|
98
|
+
* @returns The minimum whole-byte length of the bitmap.
|
|
99
|
+
*/
|
|
100
|
+
export function bitmapByteLength(rowCount) {
|
|
101
|
+
return Math.ceil(rowCount / 8);
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Computes storage for a column of fixed-width bit-packed values.
|
|
105
|
+
* @param count - Nonnegative number of values.
|
|
106
|
+
* @param bits - Positive bit width of each value.
|
|
107
|
+
* @returns The minimum whole-byte length of the packed column.
|
|
108
|
+
*/
|
|
109
|
+
export function packedBitLength(count, bits) {
|
|
110
|
+
return Math.ceil(count * bits / 8);
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Builds the lookup table used to count set bits in each possible byte.
|
|
114
|
+
* @returns A new 256-entry array whose entry i is the population count of i.
|
|
115
|
+
*/
|
|
116
|
+
export function createPopcountTable() {
|
|
117
|
+
const table = new Uint8Array(256);
|
|
118
|
+
for (let value = 1; value < table.length; value++) {
|
|
119
|
+
table[value] = (table[value >>> 1] ?? 0) + (value & 1);
|
|
120
|
+
}
|
|
121
|
+
return table;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Chooses the smallest supported byte width for a nonnegative unsigned integer.
|
|
125
|
+
* @param maxValue - Maximum value to store; callers must ensure it fits in four bytes.
|
|
126
|
+
* @returns A width from one through four bytes.
|
|
127
|
+
*/
|
|
128
|
+
export function integerByteWidth(maxValue) {
|
|
129
|
+
if (maxValue <= 0xff) {
|
|
130
|
+
return 1;
|
|
131
|
+
}
|
|
132
|
+
if (maxValue <= 0xffff) {
|
|
133
|
+
return 2;
|
|
134
|
+
}
|
|
135
|
+
if (maxValue <= 0xffffff) {
|
|
136
|
+
return 3;
|
|
137
|
+
}
|
|
138
|
+
return 4;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Validates a byte-width value decoded from a binary header.
|
|
142
|
+
* @param value - Encoded width.
|
|
143
|
+
* @param name - Field name included in diagnostics.
|
|
144
|
+
* @returns The validated width.
|
|
145
|
+
* @throws {Error} If the width is not 1, 2, 3, or 4.
|
|
146
|
+
*/
|
|
147
|
+
export function readByteWidth(value, name) {
|
|
148
|
+
if (value !== 1 && value !== 2 && value !== 3 && value !== 4) {
|
|
149
|
+
throw new Error(`Unsupported binary ${name} width: ${value}`);
|
|
150
|
+
}
|
|
151
|
+
return value;
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Returns the largest unsigned integer representable by a supported width.
|
|
155
|
+
* @param width - Storage width in bytes.
|
|
156
|
+
* @returns The inclusive maximum value for that width.
|
|
157
|
+
*/
|
|
158
|
+
export function maxPackedInteger(width) {
|
|
159
|
+
return width === 4 ? MAX_UINT32 : (2 ** (width * 8)) - 1;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Validates an integer before writing it to a packed column.
|
|
163
|
+
* @param value - Candidate unsigned integer.
|
|
164
|
+
* @param width - Available storage in bytes.
|
|
165
|
+
* @param name - Field name included in diagnostics.
|
|
166
|
+
* @throws {Error} If the value is negative, unsafe, fractional, or too large for the width.
|
|
167
|
+
*/
|
|
168
|
+
export function assertPackedInteger(value, width, name) {
|
|
169
|
+
if (!Number.isSafeInteger(value) || value < 0 || value > maxPackedInteger(width)) {
|
|
170
|
+
throw new Error(`Binary ${name} exceeds the ${width}-byte unsigned integer limit: ${value}`);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Reads one little-endian unsigned integer from a data view.
|
|
175
|
+
* @param data - View over the binary bytes.
|
|
176
|
+
* @param offset - Byte offset relative to the view.
|
|
177
|
+
* @param width - Number of bytes to read.
|
|
178
|
+
* @returns The decoded unsigned integer.
|
|
179
|
+
* @throws {RangeError} If the requested bytes lie outside the view.
|
|
180
|
+
*/
|
|
181
|
+
export function readPackedInteger(data, offset, width) {
|
|
182
|
+
switch (width) {
|
|
183
|
+
case 1:
|
|
184
|
+
return data.getUint8(offset);
|
|
185
|
+
case 2:
|
|
186
|
+
return data.getUint16(offset, true);
|
|
187
|
+
case 3:
|
|
188
|
+
return data.getUint8(offset)
|
|
189
|
+
| (data.getUint8(offset + 1) << 8)
|
|
190
|
+
| (data.getUint8(offset + 2) << 16);
|
|
191
|
+
case 4:
|
|
192
|
+
return data.getUint32(offset, true);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* Writes a little-endian unsigned integer to a caller-owned byte array.
|
|
197
|
+
* @param target - Destination with room for the complete value.
|
|
198
|
+
* @param offset - Starting byte offset within the destination.
|
|
199
|
+
* @param value - Unsigned integer to encode.
|
|
200
|
+
* @param width - Storage width in bytes.
|
|
201
|
+
* @throws {Error} If the value does not fit the requested width. The caller must validate destination bounds.
|
|
202
|
+
*/
|
|
203
|
+
export function writePackedInteger(target, offset, value, width) {
|
|
204
|
+
assertPackedInteger(value, width, 'column value');
|
|
205
|
+
target[offset] = value & 0xff;
|
|
206
|
+
if (width > 1) {
|
|
207
|
+
target[offset + 1] = (value >>> 8) & 0xff;
|
|
208
|
+
}
|
|
209
|
+
if (width > 2) {
|
|
210
|
+
target[offset + 2] = (value >>> 16) & 0xff;
|
|
211
|
+
}
|
|
212
|
+
if (width > 3) {
|
|
213
|
+
target[offset + 3] = (value >>> 24) & 0xff;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Compares a byte sequence to the complete binary file signature.
|
|
218
|
+
* @param bytes - Candidate signature; its length must exactly match the magic length.
|
|
219
|
+
* @returns True only for an exact signature match.
|
|
220
|
+
*/
|
|
221
|
+
export function hasBinaryMagic(bytes) {
|
|
222
|
+
if (bytes.byteLength !== BINARY_DATABASE_MAGIC.length) {
|
|
223
|
+
return false;
|
|
224
|
+
}
|
|
225
|
+
return BINARY_DATABASE_MAGIC.every((value, index) => bytes[index] === value);
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* Writes a ten-bit CEP suffix into a packed column.
|
|
229
|
+
* @param target - Destination bytes sized for the full packed column.
|
|
230
|
+
* @param index - Zero-based value index within the column.
|
|
231
|
+
* @param value - Unsigned integer smaller than 1024.
|
|
232
|
+
* @throws {Error} If the value exceeds the ten-bit range.
|
|
233
|
+
*/
|
|
234
|
+
export function writePacked10(target, index, value) {
|
|
235
|
+
if (value < 0 || value >= 1 << CEP_SUFFIX_BITS) {
|
|
236
|
+
throw new Error(`CEP suffix exceeds ${CEP_SUFFIX_BITS} bits: ${value}`);
|
|
237
|
+
}
|
|
238
|
+
const bitOffset = index * CEP_SUFFIX_BITS;
|
|
239
|
+
const byteIndex = bitOffset >>> 3;
|
|
240
|
+
const shift = bitOffset & 7;
|
|
241
|
+
const shifted = value << shift;
|
|
242
|
+
target[byteIndex] = (target[byteIndex] ?? 0) | (shifted & 0xff);
|
|
243
|
+
if (byteIndex + 1 < target.byteLength) {
|
|
244
|
+
target[byteIndex + 1] = (target[byteIndex + 1] ?? 0) | ((shifted >>> 8) & 0xff);
|
|
245
|
+
}
|
|
246
|
+
if (byteIndex + 2 < target.byteLength) {
|
|
247
|
+
target[byteIndex + 2] = (target[byteIndex + 2] ?? 0) | ((shifted >>> 16) & 0xff);
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
//# sourceMappingURL=binary-db-format.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"binary-db-format.js","sourceRoot":"","sources":["../src/binary-db-format.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC;AACzC;;GAEG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG,GAAG,CAAC;AAE/C,yFAAyF;AACzF,MAAM,CAAC,MAAM,yBAAyB,GAAG,EAAE,CAAC;AAE5C;;GAEG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,aAAa;AACnG;;GAEG;AACH,MAAM,CAAC,MAAM,UA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S,KAAK,CAAC,CAAC;IAClC,MAAM,KAAK,GAAG,SAAS,GAAG,CAAC,CAAC;IAC5B,MAAM,OAAO,GAAG,KAAK,IAAI,KAAK,CAAC;IAC/B,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,OAAO,GAAG,IAAI,CAAC,CAAC;IAChE,IAAI,SAAS,GAAG,CAAC,GAAG,MAAM,CAAC,UAAU,EAAE,CAAC;QACtC,MAAM,CAAC,SAAS,GAAG,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,SAAS,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,OAAO,KAAK,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;IAClF,CAAC;IACD,IAAI,SAAS,GAAG,CAAC,GAAG,MAAM,CAAC,UAAU,EAAE,CAAC;QACtC,MAAM,CAAC,SAAS,GAAG,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,SAAS,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,OAAO,KAAK,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC;IACnF,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { type DneBairro, type DneFaixaCep } from './bairro.ts';
|
|
2
|
+
import { type DneRow, type LoadMetadata } from './types.ts';
|
|
3
|
+
/** Error classes and discriminants used by this module's public operations. */
|
|
4
|
+
export { DneBinaryDatabaseClosedError, DneBinaryDatabaseError, type DneBinaryDatabaseErrorCode, DneBinaryDatabaseFormatError, DneBinaryDatabaseIOError, DneBinaryDatabaseVersionError, } from './binary-db-errors.ts';
|
|
5
|
+
/** Header size and format version accepted by this reader. */
|
|
6
|
+
export { BINARY_DATABASE_HEADER_SIZE, BINARY_DATABASE_VERSION } from './binary-db-format.ts';
|
|
7
|
+
/** Neighborhood records and inclusive CEP intervals returned by this reader. */
|
|
8
|
+
export type { DneBairro, DneFaixaCep } from './bairro.ts';
|
|
9
|
+
/**
|
|
10
|
+
* Checks a file's magic bytes without validating its version or contents.
|
|
11
|
+
* @param path - Path to the candidate database file.
|
|
12
|
+
* @returns `false` for a missing file or nonmatching signature; `true` for the DNE binary signature.
|
|
13
|
+
* @throws {DneBinaryDatabaseIOError} If the file cannot be inspected or read.
|
|
14
|
+
*/
|
|
15
|
+
export declare function isBinaryDatabase(path: string): Promise<boolean>;
|
|
16
|
+
/**
|
|
17
|
+
* Provides synchronous, read-only CEP lookups over a memory-mapped DNE binary database.
|
|
18
|
+
*
|
|
19
|
+
* Construction validates the file layout; individual records are decoded and checked on demand.
|
|
20
|
+
* Keep the underlying file immutable while the reader is open. Call `close()` when finished.
|
|
21
|
+
* All operational errors extend {@link DneBinaryDatabaseError}; invalid or absent CEPs return `undefined`.
|
|
22
|
+
*/
|
|
23
|
+
export declare class DneBinaryDatabaseReader {
|
|
24
|
+
private bairroCache;
|
|
25
|
+
private data;
|
|
26
|
+
private decodeScratch;
|
|
27
|
+
private dictionaries;
|
|
28
|
+
private bairros;
|
|
29
|
+
private header;
|
|
30
|
+
private mapped;
|
|
31
|
+
private metadataValue;
|
|
32
|
+
private municipalityCache;
|
|
33
|
+
/**
|
|
34
|
+
* Opens and validates a binary database using Bun's memory-mapping API.
|
|
35
|
+
* @param databasePath - Optional path to an existing binary database. Defaults to `data/dne.bin` inside this package.
|
|
36
|
+
* @throws {DneBinaryDatabaseIOError} If the file cannot be mapped.
|
|
37
|
+
* @throws {DneBinaryDatabaseVersionError} If the declared format version is unsupported.
|
|
38
|
+
* @throws {DneBinaryDatabaseFormatError} If the header, layout, dictionaries, or metadata are invalid.
|
|
39
|
+
*/
|
|
40
|
+
constructor(databasePath?: string);
|
|
41
|
+
/**
|
|
42
|
+
* Releases this reader's references to the mapping and decoded caches.
|
|
43
|
+
* Repeated calls are safe. Bun controls when the mapping is reclaimed; this method does not
|
|
44
|
+
* guarantee immediate unmapping. Metadata and row count remain available after closing.
|
|
45
|
+
*/
|
|
46
|
+
close(): void;
|
|
47
|
+
/**
|
|
48
|
+
* Returns the load metadata parsed when the reader was constructed.
|
|
49
|
+
* @returns The cached metadata object, which callers should treat as read-only. Available after `close()`.
|
|
50
|
+
*/
|
|
51
|
+
metadata(): LoadMetadata;
|
|
52
|
+
/**
|
|
53
|
+
* Looks up a CEP and decodes its address, including the originating locality indicators.
|
|
54
|
+
* @param cep - Eight ASCII digits or the form `NNNNN-NNN`; surrounding whitespace is not accepted.
|
|
55
|
+
* @returns An address with an eight-digit CEP, or `undefined` when the input is invalid or absent from the database.
|
|
56
|
+
* @throws {DneBinaryDatabaseClosedError} If called after `close()`, including for invalid CEP input.
|
|
57
|
+
* @throws {DneBinaryDatabaseFormatError} If the lookup encounters invalid indexes or record data.
|
|
58
|
+
*/
|
|
59
|
+
queryCep(cep: string): DneRow | undefined;
|
|
60
|
+
/**
|
|
61
|
+
* Reads a neighborhood by its original DNE identifier, independent of duplicate names.
|
|
62
|
+
* @param neighborhoodId - Positive `BAI_NU` identifier.
|
|
63
|
+
* @returns The neighborhood, or undefined for an invalid or unknown identifier.
|
|
64
|
+
* @throws {DneBinaryDatabaseClosedError} If the reader is closed, including for invalid input.
|
|
65
|
+
* @throws {DneBinaryDatabaseFormatError} If an index, record, or string cannot be decoded.
|
|
66
|
+
*/
|
|
67
|
+
queryNeighborhood(neighborhoodId: number): DneBairro | undefined;
|
|
68
|
+
/**
|
|
69
|
+
* Resolves the actual neighborhood of a CEP, preserving the distinction from districts and villages.
|
|
70
|
+
* @param cep - Eight ASCII digits or `NNNNN-NNN`.
|
|
71
|
+
* @returns The neighborhood, or undefined for an invalid, unknown, or neighborhood-free CEP.
|
|
72
|
+
* @throws {DneBinaryDatabaseClosedError} If the reader is closed, including for invalid input.
|
|
73
|
+
* @throws {DneBinaryDatabaseFormatError} If the CEP or neighborhood data is invalid.
|
|
74
|
+
*/
|
|
75
|
+
queryNeighborhoodByCep(cep: string): DneBairro | undefined;
|
|
76
|
+
/**
|
|
77
|
+
* Reads a neighborhood's original inclusive CEP intervals without merging gaps.
|
|
78
|
+
* @param neighborhoodId - Positive `BAI_NU` identifier.
|
|
79
|
+
* @returns Intervals sorted by lower and upper bounds, or an empty array for an invalid, unknown, or rangeless neighborhood.
|
|
80
|
+
* @throws {DneBinaryDatabaseClosedError} If the reader is closed, including for invalid input.
|
|
81
|
+
* @throws {DneBinaryDatabaseFormatError} If the interval directory or bounds are invalid.
|
|
82
|
+
*/
|
|
83
|
+
queryNeighborhoodCepRanges(neighborhoodId: number): DneFaixaCep[];
|
|
84
|
+
/**
|
|
85
|
+
* Returns the number of CEP records declared by the validated header.
|
|
86
|
+
* @returns The row count recorded at construction; available after `close()`.
|
|
87
|
+
*/
|
|
88
|
+
rowCount(): number;
|
|
89
|
+
private readSafely;
|
|
90
|
+
private findCepIndex;
|
|
91
|
+
private findNeighborhoodIndex;
|
|
92
|
+
private readNeighborhoodIndex;
|
|
93
|
+
private readNeighborhood;
|
|
94
|
+
private readRow;
|
|
95
|
+
private readMunicipality;
|
|
96
|
+
private readSparseId;
|
|
97
|
+
private readDictionaryString;
|
|
98
|
+
private readCachedDictionaryString;
|
|
99
|
+
private readRequiredDictionaryString;
|
|
100
|
+
private readPacked10;
|
|
101
|
+
private readPackedInteger;
|
|
102
|
+
private readUint32;
|
|
103
|
+
private requireData;
|
|
104
|
+
private requireMapped;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Opens a binary database, reads its load metadata, and closes the temporary reader.
|
|
108
|
+
* @param path - Path to an existing binary database file.
|
|
109
|
+
* @returns Metadata parsed from the file at open time.
|
|
110
|
+
* @throws {DneBinaryDatabaseIOError} If the file cannot be mapped.
|
|
111
|
+
* @throws {DneBinaryDatabaseVersionError} If the binary version is unsupported.
|
|
112
|
+
* @throws {DneBinaryDatabaseFormatError} If the file layout or metadata are invalid.
|
|
113
|
+
*/
|
|
114
|
+
export declare function readBinaryDatabaseMetadata(path: string): Promise<LoadMetadata>;
|