@gitsheets/core-napi 0.4.0 → 0.5.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/binding.cjs +3 -0
- package/index.d.ts +53 -5
- package/index.js +4 -1
- package/package.json +8 -8
package/binding.cjs
CHANGED
|
@@ -149,6 +149,9 @@ module.exports = {
|
|
|
149
149
|
// the filter (equality / nested / `$pred` engine snippets) runs in the core.
|
|
150
150
|
recordQuery: wrap(addon.recordQuery),
|
|
151
151
|
recordQueryCandidates: wrap(addon.recordQueryCandidates),
|
|
152
|
+
treeReadBlob: wrap(addon.treeReadBlob),
|
|
153
|
+
treeEntryHash: wrap(addon.treeEntryHash),
|
|
154
|
+
blobRead: wrap(addon.blobRead),
|
|
152
155
|
templateFieldNames: wrap(addon.templateFieldNames),
|
|
153
156
|
// Secondary indexing (lazy, in-memory). A unique conflict surfaces as a typed
|
|
154
157
|
// IndexError(index_unique_conflict).
|
package/index.d.ts
CHANGED
|
@@ -235,15 +235,47 @@ export declare function substrateReset(): void
|
|
|
235
235
|
/**
|
|
236
236
|
* Query records under `base` in the tree `treeRef`, returning each matched
|
|
237
237
|
* `{ path, record }` in sorted path order. The template prunes the walk; the
|
|
238
|
-
* filter (equality / nested / `$pred` snippets
|
|
239
|
-
*
|
|
238
|
+
* filter (equality / nested / `$pred` snippets / `{ $gt, $gte, $lt, $lte }` ranges)
|
|
239
|
+
* is applied to each candidate; a range on a date-bucket path field prunes
|
|
240
|
+
* the walk to the bounded span of partitions. Batch-first: the whole query
|
|
241
|
+
* crosses the FFI once.
|
|
242
|
+
*
|
|
243
|
+
* Format-aware: pass `bodyField` (and optionally `titleField`) for a
|
|
244
|
+
* markdown/mdx sheet (the kind follows `extension`: `.mdx` → mdx, else
|
|
245
|
+
* markdown) and the core decodes each candidate through the frontmatter
|
|
246
|
+
* codec — `withBody: false` is the lazy-body switch (default `true`). Without
|
|
247
|
+
* `bodyField` records are canonical TOML. The binding never fetches record
|
|
248
|
+
* bytes itself (spec: `rust-core.md` "Query traversal + filtering").
|
|
249
|
+
*/
|
|
250
|
+
export declare function recordQuery(gitDir: string, treeRef: string, base: string, template: string, filter: object, extension?: string | undefined | null, bodyField?: string | undefined | null, titleField?: string | undefined | null, withBody?: boolean | undefined | null): Array<JsRecordEntry>
|
|
251
|
+
/**
|
|
252
|
+
* A blob read by `treeRef:path` — the bytes plus the blob's object id, or
|
|
253
|
+
* `null` when nothing (or a subtree) lives at `path`. Backs sheet-config
|
|
254
|
+
* loading and lazy-body hydration without a `git cat-file` subprocess
|
|
255
|
+
* (spec: `rust-core.md` "Blob reads").
|
|
240
256
|
*/
|
|
241
|
-
export declare function
|
|
257
|
+
export declare function treeReadBlob(gitDir: string, treeRef: string, path: string): JsBlobEntry | null
|
|
258
|
+
/**
|
|
259
|
+
* The object id of the blob at `treeRef:path`, or `null` when absent or not
|
|
260
|
+
* a blob. The hash-only lookup (attachment handles, cache keys).
|
|
261
|
+
*/
|
|
262
|
+
export declare function treeEntryHash(gitDir: string, treeRef: string, path: string): string | null
|
|
263
|
+
/**
|
|
264
|
+
* A blob's bytes by object id, or `null` when no object has that id. Backs
|
|
265
|
+
* attachment content reads and diff-side record reads.
|
|
266
|
+
*/
|
|
267
|
+
export declare function blobRead(gitDir: string, hash: string): Buffer | null
|
|
268
|
+
/** A blob read by `treeRef:path`: its object id and bytes. */
|
|
269
|
+
export interface JsBlobEntry {
|
|
270
|
+
hash: string
|
|
271
|
+
content: Buffer
|
|
272
|
+
}
|
|
242
273
|
/**
|
|
243
274
|
* The pruning candidate set alone (no content filter applied) — the direct
|
|
244
275
|
* parity target for the host `Template.queryTree`. `query` is a (partial)
|
|
245
|
-
* record of the path-template input fields
|
|
246
|
-
*
|
|
276
|
+
* record of the path-template input fields; a date-bucket field may carry a
|
|
277
|
+
* `{ $gte, $lt, … }` range object, which bounds the walk. Returns candidate
|
|
278
|
+
* record paths (relative to `base`, no extension) in sorted order.
|
|
247
279
|
*/
|
|
248
280
|
export declare function recordQueryCandidates(gitDir: string, treeRef: string, base: string, template: string, query: JsValue, extension?: string | undefined | null): Array<string>
|
|
249
281
|
/**
|
|
@@ -510,6 +542,22 @@ export declare class CoreTransaction {
|
|
|
510
542
|
* Read-only — does not mark the transaction mutated.
|
|
511
543
|
*/
|
|
512
544
|
list(name: string, withBody: boolean): Array<JsRecordEntry>
|
|
545
|
+
/**
|
|
546
|
+
* Query the sheet's records in the transaction's private tree — pruned by
|
|
547
|
+
* the path template exactly like a committed-ref query, decoded through
|
|
548
|
+
* the format codec, `withBody` the lazy-body switch (spec:
|
|
549
|
+
* `api/transaction.md` "Read isolation"). The filter takes the same forms
|
|
550
|
+
* as `recordQuery` (equality / nested / `$pred` / ranges). Read-only —
|
|
551
|
+
* does not mark the transaction mutated.
|
|
552
|
+
*/
|
|
553
|
+
query(name: string, filter: object, withBody: boolean): Array<JsRecordEntry>
|
|
554
|
+
/**
|
|
555
|
+
* Read the one record at `recordPath` (relative to the sheet's base, no
|
|
556
|
+
* extension) in the transaction's private tree, decoded through the format
|
|
557
|
+
* codec — the tx-bound `Sheet.get`. `null` when absent; `withBody` is the
|
|
558
|
+
* lazy-body switch. Read-only.
|
|
559
|
+
*/
|
|
560
|
+
readRecord(name: string, recordPath: string, withBody: boolean): JsValue | null
|
|
513
561
|
/** The parent commit hash captured at open (null on a fresh repo). */
|
|
514
562
|
parentCommitHash(): string | null
|
|
515
563
|
/**
|
package/index.js
CHANGED
|
@@ -310,7 +310,7 @@ if (!nativeBinding) {
|
|
|
310
310
|
throw new Error(`Failed to load native binding`)
|
|
311
311
|
}
|
|
312
312
|
|
|
313
|
-
const { roundtrip, parseRecords, serializeRecords, renderPathsBatch, validateBatch, canonicalContractHash, validateContractName, contractPath, checkContractDocument, contractLoad, verifySheetContract, runComparator, collatorSort, CompiledDefinition, recordRead, recordWrite, recordDelete, recordList, writeBlob, substrateStats, substrateReset, recordQuery, recordQueryCandidates, templateFieldNames, recordIndexUnique, recordIndexMulti, createPatch, applyMergePatch, diffRecords, simulateCoreError, CoreTransaction, coreDiscoverSheets, coreCheckValidators, markdownSerialize, markdownNormalizeBody, markdownParse, markdownParseHeaderOnly, markdownExtractH1, markdownRewriteH1 } = nativeBinding
|
|
313
|
+
const { roundtrip, parseRecords, serializeRecords, renderPathsBatch, validateBatch, canonicalContractHash, validateContractName, contractPath, checkContractDocument, contractLoad, verifySheetContract, runComparator, collatorSort, CompiledDefinition, recordRead, recordWrite, recordDelete, recordList, writeBlob, substrateStats, substrateReset, recordQuery, treeReadBlob, treeEntryHash, blobRead, recordQueryCandidates, templateFieldNames, recordIndexUnique, recordIndexMulti, createPatch, applyMergePatch, diffRecords, simulateCoreError, CoreTransaction, coreDiscoverSheets, coreCheckValidators, markdownSerialize, markdownNormalizeBody, markdownParse, markdownParseHeaderOnly, markdownExtractH1, markdownRewriteH1 } = nativeBinding
|
|
314
314
|
|
|
315
315
|
module.exports.roundtrip = roundtrip
|
|
316
316
|
module.exports.parseRecords = parseRecords
|
|
@@ -334,6 +334,9 @@ module.exports.writeBlob = writeBlob
|
|
|
334
334
|
module.exports.substrateStats = substrateStats
|
|
335
335
|
module.exports.substrateReset = substrateReset
|
|
336
336
|
module.exports.recordQuery = recordQuery
|
|
337
|
+
module.exports.treeReadBlob = treeReadBlob
|
|
338
|
+
module.exports.treeEntryHash = treeEntryHash
|
|
339
|
+
module.exports.blobRead = blobRead
|
|
337
340
|
module.exports.recordQueryCandidates = recordQueryCandidates
|
|
338
341
|
module.exports.templateFieldNames = templateFieldNames
|
|
339
342
|
module.exports.recordIndexUnique = recordIndexUnique
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gitsheets/core-napi",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "Node.js native binding for gitsheets-core — the FFI marshalling boundary.",
|
|
5
5
|
"main": "binding.cjs",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -33,12 +33,12 @@
|
|
|
33
33
|
"index.d.ts"
|
|
34
34
|
],
|
|
35
35
|
"optionalDependencies": {
|
|
36
|
-
"@gitsheets/core-napi-linux-x64-gnu": "0.
|
|
37
|
-
"@gitsheets/core-napi-linux-arm64-gnu": "0.
|
|
38
|
-
"@gitsheets/core-napi-linux-x64-musl": "0.
|
|
39
|
-
"@gitsheets/core-napi-darwin-arm64": "0.
|
|
40
|
-
"@gitsheets/core-napi-darwin-x64": "0.
|
|
41
|
-
"@gitsheets/core-napi-win32-x64-msvc": "0.
|
|
36
|
+
"@gitsheets/core-napi-linux-x64-gnu": "0.5.0",
|
|
37
|
+
"@gitsheets/core-napi-linux-arm64-gnu": "0.5.0",
|
|
38
|
+
"@gitsheets/core-napi-linux-x64-musl": "0.5.0",
|
|
39
|
+
"@gitsheets/core-napi-darwin-arm64": "0.5.0",
|
|
40
|
+
"@gitsheets/core-napi-darwin-x64": "0.5.0",
|
|
41
|
+
"@gitsheets/core-napi-win32-x64-msvc": "0.5.0"
|
|
42
42
|
},
|
|
43
43
|
"scripts": {
|
|
44
44
|
"artifacts": "napi artifacts",
|
|
@@ -54,6 +54,6 @@
|
|
|
54
54
|
"ajv": "^8.20.0",
|
|
55
55
|
"ajv-formats": "^3.0.1",
|
|
56
56
|
"rfc6902": "^5.2.0",
|
|
57
|
-
"smol-toml": "^1.
|
|
57
|
+
"smol-toml": "^1.8.0"
|
|
58
58
|
}
|
|
59
59
|
}
|