@ahmadmoussawi/webdb 0.0.0-stage → 0.1.1

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 (106) hide show
  1. package/README.md +386 -2
  2. package/dist/constants.d.ts +18 -0
  3. package/dist/constants.d.ts.map +1 -0
  4. package/dist/core/index.d.ts +15 -0
  5. package/dist/core/index.d.ts.map +1 -0
  6. package/dist/core/js/buffer_pool.c.d.ts +142 -0
  7. package/dist/core/js/buffer_pool.c.d.ts.map +1 -0
  8. package/dist/core/js/catalog.c.d.ts +186 -0
  9. package/dist/core/js/catalog.c.d.ts.map +1 -0
  10. package/dist/core/js/codecs.c.d.ts +32 -0
  11. package/dist/core/js/codecs.c.d.ts.map +1 -0
  12. package/dist/core/js/index.d.ts +7 -0
  13. package/dist/core/js/index.d.ts.map +1 -0
  14. package/dist/core/js/page.c.d.ts +229 -0
  15. package/dist/core/js/page.c.d.ts.map +1 -0
  16. package/dist/core/js/page_table.c.d.ts +48 -0
  17. package/dist/core/js/page_table.c.d.ts.map +1 -0
  18. package/dist/core/js/vm.c.d.ts +11 -0
  19. package/dist/core/js/vm.c.d.ts.map +1 -0
  20. package/dist/core/js/vm.helpers.c.d.ts +124 -0
  21. package/dist/core/js/vm.helpers.c.d.ts.map +1 -0
  22. package/dist/core/types.d.ts +26 -0
  23. package/dist/core/types.d.ts.map +1 -0
  24. package/dist/core/wasm/embedded_wasm.d.ts +7 -0
  25. package/dist/core/wasm/embedded_wasm.d.ts.map +1 -0
  26. package/dist/core/wasm/wasm_core.d.ts +75 -0
  27. package/dist/core/wasm/wasm_core.d.ts.map +1 -0
  28. package/dist/host/api/index.d.ts +3 -0
  29. package/dist/host/api/index.d.ts.map +1 -0
  30. package/dist/host/api/query_builder.d.ts +216 -0
  31. package/dist/host/api/query_builder.d.ts.map +1 -0
  32. package/dist/host/api/webdb.d.ts +172 -0
  33. package/dist/host/api/webdb.d.ts.map +1 -0
  34. package/dist/host/compiler/compiler.d.ts +151 -0
  35. package/dist/host/compiler/compiler.d.ts.map +1 -0
  36. package/dist/host/compiler/expr_parser.d.ts +87 -0
  37. package/dist/host/compiler/expr_parser.d.ts.map +1 -0
  38. package/dist/host/compiler/index.d.ts +4 -0
  39. package/dist/host/compiler/index.d.ts.map +1 -0
  40. package/dist/host/compiler/planner/cost.d.ts +23 -0
  41. package/dist/host/compiler/planner/cost.d.ts.map +1 -0
  42. package/dist/host/compiler/planner/custom_order.d.ts +16 -0
  43. package/dist/host/compiler/planner/custom_order.d.ts.map +1 -0
  44. package/dist/host/compiler/planner/heuristic.d.ts +11 -0
  45. package/dist/host/compiler/planner/heuristic.d.ts.map +1 -0
  46. package/dist/host/compiler/planner/index.d.ts +34 -0
  47. package/dist/host/compiler/planner/index.d.ts.map +1 -0
  48. package/dist/host/compiler/planner/noop.d.ts +11 -0
  49. package/dist/host/compiler/planner/noop.d.ts.map +1 -0
  50. package/dist/host/compiler/planner/types.d.ts +100 -0
  51. package/dist/host/compiler/planner/types.d.ts.map +1 -0
  52. package/dist/host/compiler/planner/where_optimizer.d.ts +30 -0
  53. package/dist/host/compiler/planner/where_optimizer.d.ts.map +1 -0
  54. package/dist/host/compiler/planner.d.ts +2 -0
  55. package/dist/host/compiler/planner.d.ts.map +1 -0
  56. package/dist/host/driver/buffer_pool_driver.d.ts +94 -0
  57. package/dist/host/driver/buffer_pool_driver.d.ts.map +1 -0
  58. package/dist/host/driver/crash_recovery.d.ts +24 -0
  59. package/dist/host/driver/crash_recovery.d.ts.map +1 -0
  60. package/dist/host/driver/index.d.ts +4 -0
  61. package/dist/host/driver/index.d.ts.map +1 -0
  62. package/dist/host/driver/transaction_coordinator.d.ts +166 -0
  63. package/dist/host/driver/transaction_coordinator.d.ts.map +1 -0
  64. package/dist/host/storage/crc32.d.ts +24 -0
  65. package/dist/host/storage/crc32.d.ts.map +1 -0
  66. package/dist/host/storage/idb.d.ts +27 -0
  67. package/dist/host/storage/idb.d.ts.map +1 -0
  68. package/dist/host/storage/index.d.ts +8 -0
  69. package/dist/host/storage/index.d.ts.map +1 -0
  70. package/dist/host/storage/io.d.ts +60 -0
  71. package/dist/host/storage/io.d.ts.map +1 -0
  72. package/dist/host/storage/memory.d.ts +28 -0
  73. package/dist/host/storage/memory.d.ts.map +1 -0
  74. package/dist/host/storage/opfs.d.ts +31 -0
  75. package/dist/host/storage/opfs.d.ts.map +1 -0
  76. package/dist/host/storage/vfs.d.ts +36 -0
  77. package/dist/host/storage/vfs.d.ts.map +1 -0
  78. package/dist/host/storage/wal_codec.d.ts +56 -0
  79. package/dist/host/storage/wal_codec.d.ts.map +1 -0
  80. package/dist/index.d.ts +9 -0
  81. package/dist/index.d.ts.map +1 -0
  82. package/dist/layouts/index.d.ts +5 -0
  83. package/dist/layouts/index.d.ts.map +1 -0
  84. package/dist/layouts/page_format.d.ts +163 -0
  85. package/dist/layouts/page_format.d.ts.map +1 -0
  86. package/dist/layouts/pool_format.d.ts +126 -0
  87. package/dist/layouts/pool_format.d.ts.map +1 -0
  88. package/dist/layouts/syspage_format.d.ts +499 -0
  89. package/dist/layouts/syspage_format.d.ts.map +1 -0
  90. package/dist/layouts/wal_format.d.ts +197 -0
  91. package/dist/layouts/wal_format.d.ts.map +1 -0
  92. package/dist/shared/c_runtime.d.ts +47 -0
  93. package/dist/shared/c_runtime.d.ts.map +1 -0
  94. package/dist/shared/index.d.ts +4 -0
  95. package/dist/shared/index.d.ts.map +1 -0
  96. package/dist/shared/page_provider.d.ts +12 -0
  97. package/dist/shared/page_provider.d.ts.map +1 -0
  98. package/dist/shared/vm_context.d.ts +73 -0
  99. package/dist/shared/vm_context.d.ts.map +1 -0
  100. package/dist/types/index.d.ts +338 -0
  101. package/dist/types/index.d.ts.map +1 -0
  102. package/dist/webdb.js +13059 -0
  103. package/dist/webdb.js.map +1 -0
  104. package/dist/webdb.umd.cjs +5 -0
  105. package/dist/webdb.umd.cjs.map +1 -0
  106. package/package.json +82 -4
@@ -0,0 +1,499 @@
1
+ /**
2
+ * AUTO-GENERATED AT BUILD TIME FROM src/layouts/schemas/syspage_format.json
3
+ * DO NOT EDIT MANUALLY. Run 'npm run generate:layouts' to rebuild.
4
+ */
5
+ /**
6
+ * ============================================================================
7
+ * CRITICAL WARNING: FROZEN SYSTEM PAGES & CATALOG SPECIFICATION
8
+ * DO NOT modify the order or length of existing fields in Page 1, catalog
9
+ * descriptors, or dedicated column catalog pages!
10
+ * Changing any layout defined here WILL corrupt existing database files,
11
+ * render databases unreadable, and permanently break schema decoding.
12
+ *
13
+ * Any new metadata fields MUST be appended within designated RESERVED areas
14
+ * or versioned via schema migrations.
15
+ * ============================================================================
16
+ */
17
+ /**
18
+ * Maximum length in bytes for table and column names (UTF-8, null-padded).
19
+ */
20
+ export declare const MAX_NAME_LENGTH = 64;
21
+ /**
22
+ * 32-bit Word Byte Layout Grid for SYSPAGE_FILE_HEADER:
23
+ * Byte 0 Byte 1 Byte 2 Byte 3
24
+ * +-----------------+-----------------+-----------------+-----------------+
25
+ * | MAGIC [0..3] |
26
+ * +-----------------------------------------------------------------------+
27
+ * | MAGIC [4..5] | PAGE_SIZE (2B) |
28
+ * +-----------------------------------+-----------------------------------+
29
+ * | FILE_FORMAT_VERSION (2B) | MIN_READ_VERSION (2B) |
30
+ * +-----------------------------------+-----------------------------------+
31
+ * | TOTAL_PAGES (4B) |
32
+ * +-----------------------------------------------------------------------+
33
+ * | FREE_PAGE_HEAD (4B) |
34
+ * +-----------------------------------------------------------------------+
35
+ * | SCHEMA_VERSION (4B) |
36
+ * +-----------------------------------------------------------------------+
37
+ * | CHANGE_COUNTER (4B) |
38
+ * +-----------------------------------------------------------------------+
39
+ * | PAGE_CHECKSUM (4B) |
40
+ * +-----------------------------------------------------------------------+
41
+ * | NEXT_CATALOG_PAGE_ID (4B) |
42
+ * +-----------------------------------------------------------------------+
43
+ * | NEXT_INDEX_CATALOG_PAGE_ID (4B) |
44
+ * +-----------------------------------------------------------------------+
45
+ * | Bytes 40..99 (60B): RESERVED (uint8_t[60]) |
46
+ * +-----------------------------------------------------------------------+
47
+ *
48
+ * Field Details:
49
+ * +--------+------+----------------------------+-------------+------------------------------------------------+
50
+ * | Offset | Size | Field Name | Type | Description |
51
+ * +--------+------+----------------------------+-------------+------------------------------------------------+
52
+ * | 0 | 6B | MAGIC | char[6] | Magic string identifier 'WEBDB\0' |
53
+ * | 6 | 2B | PAGE_SIZE | uint16_t | Page size in bytes (4096, uint16 LE) |
54
+ * | 8 | 2B | FILE_FORMAT_VERSION | uint16_t | File format version (uint16 LE) |
55
+ * | 10 | 2B | MIN_READ_VERSION | uint16_t | Minimum engine read version required (uint1... |
56
+ * | 12 | 4B | TOTAL_PAGES | uint32_t | Total number of pages in database file (uin... |
57
+ * | 16 | 4B | FREE_PAGE_HEAD | uint32_t | Page ID of the first free page in the free ... |
58
+ * | 20 | 4B | SCHEMA_VERSION | uint32_t | User schema version cookie, bumped on DDL (... |
59
+ * | 24 | 4B | CHANGE_COUNTER | uint32_t | Transaction write change counter (uint32 LE) |
60
+ * | 28 | 4B | PAGE_CHECKSUM | uint32_t | CRC32 checksum of Page 1 (uint32 LE) |
61
+ * | 32 | 4B | NEXT_CATALOG_PAGE_ID | uint32_t | Chained catalog page pointer (always 0 in v... |
62
+ * | 36 | 4B | NEXT_INDEX_CATALOG_PAGE_ID | uint32_t | Chained index catalog pointer (always 0 in ... |
63
+ * | 40 | 60B | RESERVED | uint8_t[60] | Reserved space for future file header exten... |
64
+ * +--------+------+----------------------------+-------------+------------------------------------------------+
65
+ * | Total: 100 Bytes |
66
+ * +-----------------------------------------------------------------------------------------------------------+
67
+ */
68
+ export declare const SYSPAGE_FILE_HEADER_FIELDS: readonly [readonly ["MAGIC", 6], readonly ["PAGE_SIZE", 2], readonly ["FILE_FORMAT_VERSION", 2], readonly ["MIN_READ_VERSION", 2], readonly ["TOTAL_PAGES", 4], readonly ["FREE_PAGE_HEAD", 4], readonly ["SCHEMA_VERSION", 4], readonly ["CHANGE_COUNTER", 4], readonly ["PAGE_CHECKSUM", 4], readonly ["NEXT_CATALOG_PAGE_ID", 4], readonly ["NEXT_INDEX_CATALOG_PAGE_ID", 4], readonly ["RESERVED", 60]];
69
+ /**
70
+ * Total size in bytes of the database file header in Page 1 (100 bytes).
71
+ */
72
+ export declare const FILE_HEADER_SIZE = 100;
73
+ /**
74
+ * 0..5: Magic string identifier 'WEBDB\0'
75
+ */
76
+ export declare const HEADER_OFFSET_MAGIC = 0;
77
+ /**
78
+ * 6..7: Page size in bytes (4096, uint16 LE)
79
+ */
80
+ export declare const HEADER_OFFSET_PAGE_SIZE = 6;
81
+ /**
82
+ * 8..9: File format version (uint16 LE)
83
+ */
84
+ export declare const HEADER_OFFSET_FILE_FORMAT_VERSION = 8;
85
+ /**
86
+ * 10..11: Minimum engine read version required (uint16 LE)
87
+ */
88
+ export declare const HEADER_OFFSET_MIN_READ_VERSION = 10;
89
+ /**
90
+ * 12..15: Total number of pages in database file (uint32 LE)
91
+ */
92
+ export declare const HEADER_OFFSET_TOTAL_PAGES = 12;
93
+ /**
94
+ * 16..19: Page ID of the first free page in the free list chain (uint32 LE)
95
+ */
96
+ export declare const HEADER_OFFSET_FREE_PAGE_HEAD = 16;
97
+ /**
98
+ * 20..23: User schema version cookie, bumped on DDL (uint32 LE)
99
+ */
100
+ export declare const HEADER_OFFSET_SCHEMA_VERSION = 20;
101
+ /**
102
+ * 24..27: Transaction write change counter (uint32 LE)
103
+ */
104
+ export declare const HEADER_OFFSET_CHANGE_COUNTER = 24;
105
+ /**
106
+ * 28..31: CRC32 checksum of Page 1 (uint32 LE)
107
+ */
108
+ export declare const HEADER_OFFSET_PAGE_CHECKSUM = 28;
109
+ /**
110
+ * 32..35: Chained catalog page pointer (always 0 in v1, uint32 LE)
111
+ */
112
+ export declare const HEADER_OFFSET_NEXT_CATALOG_PAGE_ID = 32;
113
+ /**
114
+ * 36..39: Chained index catalog pointer (always 0 in v1, uint32 LE)
115
+ */
116
+ export declare const HEADER_OFFSET_NEXT_INDEX_CATALOG_PAGE_ID = 36;
117
+ /**
118
+ * 40..99: Reserved space for future file header extensions (zero-padded)
119
+ */
120
+ export declare const HEADER_OFFSET_RESERVED = 40;
121
+ /**
122
+ * Page 1 Space Partition Map (4 KB Total):
123
+ * +------------+-------+----------------------+--------------------------------------+
124
+ * | Byte Range | Size | Partition Region | Description |
125
+ * +------------+-------+----------------------+--------------------------------------+
126
+ * | 0..99 | 100B | FILE_HEADER | Database file header |
127
+ * | 100..2147 | 2048B | MASTER_TABLE_CATALOG | 16 Table Descriptors (128B each) |
128
+ * | 2148..3171 | 1024B | INDEX_CATALOG | 8 Index Descriptors (128B each) |
129
+ * | 3172..3175 | 4B | NEXT_DESCRIPTOR_PAGE | Chained descriptor page pointer |
130
+ * | 3176..4095 | 920B | SYSPAGE_RESERVED | Reserved space for Page 1 extensions |
131
+ * +------------+-------+----------------------+--------------------------------------+
132
+ * | Total: 4096 Bytes (Full Page 1 Allocation) |
133
+ * +----------------------------------------------------------------------------------+
134
+ */
135
+ /**
136
+ * Maximum number of table descriptors that fit in Page 1 (16).
137
+ */
138
+ export declare const MAX_TABLES_SYSPAGE = 16;
139
+ /**
140
+ * Maximum number of index descriptors that fit in Page 1 (8).
141
+ */
142
+ export declare const MAX_INDEXES_SYSPAGE = 8;
143
+ /**
144
+ * Alias for MAX_TABLES_SYSPAGE.
145
+ */
146
+ export declare const MAX_TABLES_PAGE1 = 16;
147
+ /**
148
+ * Alias for MAX_INDEXES_SYSPAGE.
149
+ */
150
+ export declare const MAX_INDEXES_PAGE1 = 8;
151
+ /**
152
+ * Byte offset where master table descriptors start in Page 1 (byte 100).
153
+ */
154
+ export declare const MASTER_TABLE_OFFSET = 100;
155
+ /**
156
+ * Byte offset where index descriptors start in Page 1 (100 + 16 * 128 = 2148).
157
+ */
158
+ export declare const INDEX_CATALOG_OFFSET = 2148;
159
+ /**
160
+ * Byte offset for chained descriptor page pointer (2148 + 8 * 128 = 3172).
161
+ */
162
+ export declare const NEXT_DESCRIPTOR_CATALOG_PAGE_OFFSET = 3172;
163
+ /**
164
+ * Size in bytes of chained descriptor catalog page pointer (4 bytes).
165
+ */
166
+ export declare const NEXT_DESCRIPTOR_CATALOG_PAGE_SIZE = 4;
167
+ /**
168
+ * Byte offset for Page 1 reserved partition (3172 + 4 = 3176).
169
+ */
170
+ export declare const SYSPAGE_RESERVED_OFFSET = 3176;
171
+ /**
172
+ * Size in bytes of Page 1 reserved partition (4096 - 3176 = 920).
173
+ */
174
+ export declare const SYSPAGE_RESERVED_SIZE = 920;
175
+ /**
176
+ * Maximum column records per catalog page: floor((4096 - 16) / 72) = 56.
177
+ */
178
+ export declare const MAX_COLUMNS_PER_CATALOG_PAGE = 56;
179
+ /**
180
+ * Maximum columns supported per table across all catalog pages (256).
181
+ */
182
+ export declare const MAX_COLUMNS_PER_TABLE = 256;
183
+ /**
184
+ * 32-bit Word Byte Layout Grid for TABLE_DESCRIPTOR:
185
+ * Byte 0 Byte 1 Byte 2 Byte 3
186
+ * +-----------------+-----------------+-----------------+-----------------+
187
+ * | TABLE_ID (2B) | COLUMN_COUNT (2B) |
188
+ * +-----------------------------------+-----------------------------------+
189
+ * | ROOT_PAGE_ID (4B) |
190
+ * +-----------------------------------------------------------------------+
191
+ * | COL_CATALOG_PAGE_ID (4B) |
192
+ * +-----------------------------------------------------------------------+
193
+ * | Bytes 12..75 (64B): NAME (char[64]) |
194
+ * +-----------------------------------------------------------------------+
195
+ * | FLAGS (4B) |
196
+ * +-----------------------------------------------------------------------+
197
+ * | ROW_COUNT_ESTIMATE (4B) |
198
+ * +-----------------------------------------------------------------------+
199
+ * | Bytes 84..91 (8B): AUTO_INC_NEXT (uint64_t) |
200
+ * +-----------------------------------------------------------------------+
201
+ * | Bytes 92..127 (36B): RESERVED (uint8_t[36]) |
202
+ * +-----------------------------------------------------------------------+
203
+ *
204
+ * Field Details:
205
+ * +--------+------+---------------------+-------------+------------------------------------------------+
206
+ * | Offset | Size | Field Name | Type | Description |
207
+ * +--------+------+---------------------+-------------+------------------------------------------------+
208
+ * | 0 | 2B | TABLE_ID | uint16_t | uint16_t table_id (1-based, 0 = inactive slot) |
209
+ * | 2 | 2B | COLUMN_COUNT | uint16_t | uint16_t total columns in table |
210
+ * | 4 | 4B | ROOT_PAGE_ID | uint32_t | uint32_t root data pageId |
211
+ * | 8 | 4B | COL_CATALOG_PAGE_ID | uint32_t | uint32_t first column catalog pageId |
212
+ * | 12 | 64B | NAME | char[64] | 64 bytes UTF-8 fixed string (null-padded) |
213
+ * | 76 | 4B | FLAGS | uint32_t | uint32_t table flags (WAL, system, etc.) |
214
+ * | 80 | 4B | ROW_COUNT_ESTIMATE | uint32_t | uint32_t estimated row count |
215
+ * | 84 | 8B | AUTO_INC_NEXT | uint64_t | uint64_t next auto_increment ID |
216
+ * | 92 | 36B | RESERVED | uint8_t[36] | 36 bytes reserved space (92..127) |
217
+ * +--------+------+---------------------+-------------+------------------------------------------------+
218
+ * | Total: 128 Bytes |
219
+ * +----------------------------------------------------------------------------------------------------+
220
+ */
221
+ export declare const TABLE_DESCRIPTOR_FIELDS: readonly [readonly ["TABLE_ID", 2], readonly ["COLUMN_COUNT", 2], readonly ["ROOT_PAGE_ID", 4], readonly ["COL_CATALOG_PAGE_ID", 4], readonly ["NAME", 64], readonly ["FLAGS", 4], readonly ["ROW_COUNT_ESTIMATE", 4], readonly ["AUTO_INC_NEXT", 8], readonly ["RESERVED", 36]];
222
+ /**
223
+ * Total size in bytes of a single table descriptor record (128 bytes).
224
+ */
225
+ export declare const TABLE_DESCRIPTOR_SIZE = 128;
226
+ /**
227
+ * uint16_t table_id (1-based, 0 = inactive slot)
228
+ */
229
+ export declare const TABLE_DESCRIPTOR_OFFSET_TABLE_ID = 0;
230
+ /**
231
+ * uint16_t total columns in table
232
+ */
233
+ export declare const TABLE_DESCRIPTOR_OFFSET_COLUMN_COUNT = 2;
234
+ /**
235
+ * uint32_t root data pageId
236
+ */
237
+ export declare const TABLE_DESCRIPTOR_OFFSET_ROOT_PAGE_ID = 4;
238
+ /**
239
+ * uint32_t first column catalog pageId
240
+ */
241
+ export declare const TABLE_DESCRIPTOR_OFFSET_COL_CATALOG_PAGE_ID = 8;
242
+ /**
243
+ * 64 bytes UTF-8 fixed string (null-padded)
244
+ */
245
+ export declare const TABLE_DESCRIPTOR_OFFSET_NAME = 12;
246
+ /**
247
+ * uint32_t table flags (WAL, system, etc.)
248
+ */
249
+ export declare const TABLE_DESCRIPTOR_OFFSET_FLAGS = 76;
250
+ /**
251
+ * uint32_t estimated row count
252
+ */
253
+ export declare const TABLE_DESCRIPTOR_OFFSET_ROW_COUNT_ESTIMATE = 80;
254
+ /**
255
+ * uint64_t next auto_increment ID
256
+ */
257
+ export declare const TABLE_DESCRIPTOR_OFFSET_AUTO_INC_NEXT = 84;
258
+ /**
259
+ * 36 bytes reserved space (92..127)
260
+ */
261
+ export declare const TABLE_DESCRIPTOR_OFFSET_RESERVED = 92;
262
+ /**
263
+ * 32-bit Word Byte Layout Grid for INDEX_DESCRIPTOR:
264
+ * Byte 0 Byte 1 Byte 2 Byte 3
265
+ * +-----------------+-----------------+-----------------+-----------------+
266
+ * | INDEX_ID (2B) | TABLE_ID (2B) |
267
+ * +-----------------------------------+-----------------------------------+
268
+ * | ROOT_PAGE_ID (4B) |
269
+ * +-----------------------------------------------------------------------+
270
+ * | COLUMN_COUNT (1B) | FLAGS (1B) | COLUMN_INDICES [0..1] |
271
+ * +-----------------+-----------------+-----------------------------------+
272
+ * | COLUMN_INDICES [2..5] |
273
+ * +-----------------------------------------------------------------------+
274
+ * | COLUMN_INDICES [6..9] |
275
+ * +-----------------------------------------------------------------------+
276
+ * | COLUMN_INDICES [10..13] |
277
+ * +-----------------------------------------------------------------------+
278
+ * | COLUMN_INDICES [14..15] | COL_DIRECTIONS [0..1] |
279
+ * +-----------------------------------+-----------------------------------+
280
+ * | COL_DIRECTIONS [2..5] |
281
+ * +-----------------------------------------------------------------------+
282
+ * | COL_DIRECTIONS [6..7] | NAME [0..1] |
283
+ * +-----------------------------------+-----------------------------------+
284
+ * | NAME [2..5] |
285
+ * +-----------------------------------------------------------------------+
286
+ * | NAME [6..9] |
287
+ * +-----------------------------------------------------------------------+
288
+ * | NAME [10..13] |
289
+ * +-----------------------------------------------------------------------+
290
+ * | NAME [14..17] |
291
+ * +-----------------------------------------------------------------------+
292
+ * | NAME [18..21] |
293
+ * +-----------------------------------------------------------------------+
294
+ * | NAME [22..25] |
295
+ * +-----------------------------------------------------------------------+
296
+ * | NAME [26..29] |
297
+ * +-----------------------------------------------------------------------+
298
+ * | NAME [30..33] |
299
+ * +-----------------------------------------------------------------------+
300
+ * | NAME [34..37] |
301
+ * +-----------------------------------------------------------------------+
302
+ * | NAME [38..41] |
303
+ * +-----------------------------------------------------------------------+
304
+ * | NAME [42..45] |
305
+ * +-----------------------------------------------------------------------+
306
+ * | NAME [46..49] |
307
+ * +-----------------------------------------------------------------------+
308
+ * | NAME [50..53] |
309
+ * +-----------------------------------------------------------------------+
310
+ * | NAME [54..57] |
311
+ * +-----------------------------------------------------------------------+
312
+ * | NAME [58..61] |
313
+ * +-----------------------------------------------------------------------+
314
+ * | NAME [62..63] | RESERVED [0..1] |
315
+ * +-----------------------------------+-----------------------------------+
316
+ * | RESERVED [2..5] |
317
+ * +-----------------------------------------------------------------------+
318
+ * | RESERVED [6..9] |
319
+ * +-----------------------------------------------------------------------+
320
+ * | RESERVED [10..13] |
321
+ * +-----------------------------------------------------------------------+
322
+ * | RESERVED [14..17] |
323
+ * +-----------------------------------------------------------------------+
324
+ * | RESERVED [18..21] |
325
+ * +-----------------------------------------------------------------------+
326
+ * | RESERVED [22..25] |
327
+ * +-----------------------------------------------------------------------+
328
+ * | RESERVED [26..29] |
329
+ * +-----------------------------------------------------------------------+
330
+ *
331
+ * Field Details:
332
+ * +--------+------+----------------+-------------+------------------------------------------------+
333
+ * | Offset | Size | Field Name | Type | Description |
334
+ * +--------+------+----------------+-------------+------------------------------------------------+
335
+ * | 0 | 2B | INDEX_ID | uint16_t | uint16_t index_id (1-based, 0 = inactive slot) |
336
+ * | 2 | 2B | TABLE_ID | uint16_t | uint16_t target table_id |
337
+ * | 4 | 4B | ROOT_PAGE_ID | uint32_t | uint32_t root index pageId |
338
+ * | 8 | 1B | COLUMN_COUNT | uint8_t | uint8_t indexed column count (1..8) |
339
+ * | 9 | 1B | FLAGS | uint8_t | uint8_t index flags (unique, primary, etc.) |
340
+ * | 10 | 16B | COLUMN_INDICES | uint16_t[8] | 8 * uint16_t column indices (16 bytes) |
341
+ * | 26 | 8B | COL_DIRECTIONS | uint8_t[8] | 8 * uint8_t sort directions (8 bytes: 0=ASC... |
342
+ * | 34 | 64B | NAME | char[64] | 64 bytes UTF-8 fixed string (null-padded) |
343
+ * | 98 | 30B | RESERVED | uint8_t[30] | 30 bytes reserved space (98..127) |
344
+ * +--------+------+----------------+-------------+------------------------------------------------+
345
+ * | Total: 128 Bytes |
346
+ * +-----------------------------------------------------------------------------------------------+
347
+ */
348
+ export declare const INDEX_DESCRIPTOR_FIELDS: readonly [readonly ["INDEX_ID", 2], readonly ["TABLE_ID", 2], readonly ["ROOT_PAGE_ID", 4], readonly ["COLUMN_COUNT", 1], readonly ["FLAGS", 1], readonly ["COLUMN_INDICES", 16], readonly ["COL_DIRECTIONS", 8], readonly ["NAME", 64], readonly ["RESERVED", 30]];
349
+ /**
350
+ * Total size in bytes of a single index descriptor record (128 bytes).
351
+ */
352
+ export declare const INDEX_DESCRIPTOR_SIZE = 128;
353
+ /**
354
+ * uint16_t index_id (1-based, 0 = inactive slot)
355
+ */
356
+ export declare const INDEX_DESCRIPTOR_OFFSET_INDEX_ID = 0;
357
+ /**
358
+ * uint16_t target table_id
359
+ */
360
+ export declare const INDEX_DESCRIPTOR_OFFSET_TABLE_ID = 2;
361
+ /**
362
+ * uint32_t root index pageId
363
+ */
364
+ export declare const INDEX_DESCRIPTOR_OFFSET_ROOT_PAGE_ID = 4;
365
+ /**
366
+ * uint8_t indexed column count (1..8)
367
+ */
368
+ export declare const INDEX_DESCRIPTOR_OFFSET_COLUMN_COUNT = 8;
369
+ /**
370
+ * uint8_t index flags (unique, primary, etc.)
371
+ */
372
+ export declare const INDEX_DESCRIPTOR_OFFSET_FLAGS = 9;
373
+ /**
374
+ * 8 * uint16_t column indices (16 bytes)
375
+ */
376
+ export declare const INDEX_DESCRIPTOR_OFFSET_COLUMN_INDICES = 10;
377
+ /**
378
+ * 8 * uint8_t sort directions (8 bytes: 0=ASC, 1=DESC)
379
+ */
380
+ export declare const INDEX_DESCRIPTOR_OFFSET_COL_DIRECTIONS = 26;
381
+ /**
382
+ * 64 bytes UTF-8 fixed string (null-padded)
383
+ */
384
+ export declare const INDEX_DESCRIPTOR_OFFSET_NAME = 34;
385
+ /**
386
+ * 30 bytes reserved space (98..127)
387
+ */
388
+ export declare const INDEX_DESCRIPTOR_OFFSET_RESERVED = 98;
389
+ /**
390
+ * 32-bit Word Byte Layout Grid for CATALOG_PAGE_HEADER:
391
+ * Byte 0 Byte 1 Byte 2 Byte 3
392
+ * +-----------------+-----------------+-----------------+-----------------+
393
+ * | PAGE_TYPE (1B) | FLAGS (1B) | COL_COUNT_IN_PAGE (2B) |
394
+ * +-----------------+-----------------+-----------------------------------+
395
+ * | TABLE_ID (2B) | START_COL_INDEX (2B) |
396
+ * +-----------------------------------+-----------------------------------+
397
+ * | NEXT_COL_CATALOG_PAGE_ID (4B) |
398
+ * +-----------------------------------------------------------------------+
399
+ * | PAGE_CHECKSUM (4B) |
400
+ * +-----------------------------------------------------------------------+
401
+ *
402
+ * Field Details:
403
+ * +--------+------+--------------------------+----------+------------------------------------------------+
404
+ * | Offset | Size | Field Name | Type | Description |
405
+ * +--------+------+--------------------------+----------+------------------------------------------------+
406
+ * | 0 | 1B | PAGE_TYPE | uint8_t | uint8_t 0x0C (PAGE_TYPE_CATALOG_PAGE) |
407
+ * | 1 | 1B | FLAGS | uint8_t | uint8_t reserved / flags |
408
+ * | 2 | 2B | COL_COUNT_IN_PAGE | uint16_t | uint16_t columns stored in this page (0..56) |
409
+ * | 4 | 2B | TABLE_ID | uint16_t | uint16_t table_id this page belongs to |
410
+ * | 6 | 2B | START_COL_INDEX | uint16_t | uint16_t starting global column index |
411
+ * | 8 | 4B | NEXT_COL_CATALOG_PAGE_ID | uint32_t | uint32_t next column catalog pageId (0 = tail) |
412
+ * | 12 | 4B | PAGE_CHECKSUM | uint32_t | uint32_t crc32 checksum |
413
+ * +--------+------+--------------------------+----------+------------------------------------------------+
414
+ * | Total: 16 Bytes |
415
+ * +------------------------------------------------------------------------------------------------------+
416
+ */
417
+ export declare const CATALOG_PAGE_HEADER_FIELDS: readonly [readonly ["PAGE_TYPE", 1], readonly ["FLAGS", 1], readonly ["COL_COUNT_IN_PAGE", 2], readonly ["TABLE_ID", 2], readonly ["START_COL_INDEX", 2], readonly ["NEXT_COL_CATALOG_PAGE_ID", 4], readonly ["PAGE_CHECKSUM", 4]];
418
+ /**
419
+ * Total size in bytes of a dedicated column catalog page header (16 bytes).
420
+ */
421
+ export declare const CATALOG_PAGE_HEADER_SIZE = 16;
422
+ /**
423
+ * uint8_t 0x0C (PAGE_TYPE_CATALOG_PAGE)
424
+ */
425
+ export declare const CATALOG_PAGE_HEADER_OFFSET_PAGE_TYPE = 0;
426
+ /**
427
+ * uint8_t reserved / flags
428
+ */
429
+ export declare const CATALOG_PAGE_HEADER_OFFSET_FLAGS = 1;
430
+ /**
431
+ * uint16_t columns stored in this page (0..56)
432
+ */
433
+ export declare const CATALOG_PAGE_HEADER_OFFSET_COL_COUNT_IN_PAGE = 2;
434
+ /**
435
+ * uint16_t table_id this page belongs to
436
+ */
437
+ export declare const CATALOG_PAGE_HEADER_OFFSET_TABLE_ID = 4;
438
+ /**
439
+ * uint16_t starting global column index
440
+ */
441
+ export declare const CATALOG_PAGE_HEADER_OFFSET_START_COL_INDEX = 6;
442
+ /**
443
+ * uint32_t next column catalog pageId (0 = tail)
444
+ */
445
+ export declare const CATALOG_PAGE_HEADER_OFFSET_NEXT_COL_CATALOG_PAGE_ID = 8;
446
+ /**
447
+ * uint32_t crc32 checksum
448
+ */
449
+ export declare const CATALOG_PAGE_HEADER_OFFSET_PAGE_CHECKSUM = 12;
450
+ /**
451
+ * 32-bit Word Byte Layout Grid for COLUMN_META:
452
+ * Byte 0 Byte 1 Byte 2 Byte 3
453
+ * +-----------------+-----------------+-----------------+-----------------+
454
+ * | TYPE (1B) | FLAGS (1B) | COL_OFFSET (2B) |
455
+ * +-----------------+-----------------+-----------------------------------+
456
+ * | Bytes 4..67 (64B): NAME (char[64]) |
457
+ * +-----------------------------------------------------------------------+
458
+ * | RESERVED (4B) |
459
+ * +-----------------------------------------------------------------------+
460
+ *
461
+ * Field Details:
462
+ * +--------+------+------------+------------+------------------------------------------------+
463
+ * | Offset | Size | Field Name | Type | Description |
464
+ * +--------+------+------------+------------+------------------------------------------------+
465
+ * | 0 | 1B | TYPE | uint8_t | uint8_t DataType enum (1..7) |
466
+ * | 1 | 1B | FLAGS | uint8_t | uint8_t ColumnFlag bitmask (NOT_NULL, PRIMA... |
467
+ * | 2 | 2B | COL_OFFSET | uint16_t | uint16_t fixed-slice offset or var-table index |
468
+ * | 4 | 64B | NAME | char[64] | 64 bytes UTF-8 column name (null-padded) |
469
+ * | 68 | 4B | RESERVED | uint8_t[4] | 4 bytes reserved (68..71) |
470
+ * +--------+------+------------+------------+------------------------------------------------+
471
+ * | Total: 72 Bytes |
472
+ * +------------------------------------------------------------------------------------------+
473
+ */
474
+ export declare const COLUMN_META_FIELDS: readonly [readonly ["TYPE", 1], readonly ["FLAGS", 1], readonly ["COL_OFFSET", 2], readonly ["NAME", 64], readonly ["RESERVED", 4]];
475
+ /**
476
+ * Total size in bytes of a single column metadata record (72 bytes).
477
+ */
478
+ export declare const COLUMN_META_SIZE = 72;
479
+ /**
480
+ * uint8_t DataType enum (1..7)
481
+ */
482
+ export declare const COLUMN_META_OFFSET_TYPE = 0;
483
+ /**
484
+ * uint8_t ColumnFlag bitmask (NOT_NULL, PRIMARY_KEY, etc.)
485
+ */
486
+ export declare const COLUMN_META_OFFSET_FLAGS = 1;
487
+ /**
488
+ * uint16_t fixed-slice offset or var-table index
489
+ */
490
+ export declare const COLUMN_META_OFFSET_COL_OFFSET = 2;
491
+ /**
492
+ * 64 bytes UTF-8 column name (null-padded)
493
+ */
494
+ export declare const COLUMN_META_OFFSET_NAME = 4;
495
+ /**
496
+ * 4 bytes reserved (68..71)
497
+ */
498
+ export declare const COLUMN_META_OFFSET_RESERVED = 68;
499
+ //# sourceMappingURL=syspage_format.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"syspage_format.d.ts","sourceRoot":"","sources":["../../src/layouts/syspage_format.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;GAWG;AAEH;;GAEG;AACH,eAAO,MAAM,eAAe,KAAK,CAAC;AAMlC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AACH,eAAO,MAAM,0BAA0B,6YAa7B,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,gBAAgB,MAAM,CAAC;AAEpC;;GAEG;AACH,eAAO,MAAM,mBAAmB,IAAI,CAAC;AAErC;;GAEG;AACH,eAAO,MAAM,uBAAuB,IAAI,CAAC;AAEzC;;GAEG;AACH,eAAO,MAAM,iCAAiC,IAAI,CAAC;AAEnD;;GAEG;AACH,eAAO,MAAM,8BAA8B,KAAK,CAAC;AAEjD;;GAEG;AACH,eAAO,MAAM,yBAAyB,KAAK,CAAC;AAE5C;;GAEG;AACH,eAAO,MAAM,4BAA4B,KAAK,CAAC;AAE/C;;GAEG;AACH,eAAO,MAAM,4BAA4B,KAAK,CAAC;AAE/C;;GAEG;AACH,eAAO,MAAM,4BAA4B,KAAK,CAAC;AAE/C;;GAEG;AACH,eAAO,MAAM,2BAA2B,KAAK,CAAC;AAE9C;;GAEG;AACH,eAAO,MAAM,kCAAkC,KAAK,CAAC;AAErD;;GAEG;AACH,eAAO,MAAM,wCA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