gitx.do 0.1.0 → 0.1.2
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 +40 -353
- package/dist/do/logger.d.ts +50 -0
- package/dist/do/logger.d.ts.map +1 -0
- package/dist/do/logger.js +122 -0
- package/dist/do/logger.js.map +1 -0
- package/dist/{durable-object → do}/schema.d.ts +3 -3
- package/dist/do/schema.d.ts.map +1 -0
- package/dist/{durable-object → do}/schema.js +4 -3
- package/dist/do/schema.js.map +1 -0
- package/dist/do/types.d.ts +267 -0
- package/dist/do/types.d.ts.map +1 -0
- package/dist/do/types.js +62 -0
- package/dist/do/types.js.map +1 -0
- package/dist/index.d.ts +15 -415
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +31 -483
- package/dist/index.js.map +1 -1
- package/package.json +13 -21
- package/dist/cli/commands/add.d.ts +0 -174
- package/dist/cli/commands/add.d.ts.map +0 -1
- package/dist/cli/commands/add.js +0 -131
- package/dist/cli/commands/add.js.map +0 -1
- package/dist/cli/commands/blame.d.ts +0 -259
- package/dist/cli/commands/blame.d.ts.map +0 -1
- package/dist/cli/commands/blame.js +0 -609
- package/dist/cli/commands/blame.js.map +0 -1
- package/dist/cli/commands/branch.d.ts +0 -249
- package/dist/cli/commands/branch.d.ts.map +0 -1
- package/dist/cli/commands/branch.js +0 -693
- package/dist/cli/commands/branch.js.map +0 -1
- package/dist/cli/commands/commit.d.ts +0 -182
- package/dist/cli/commands/commit.d.ts.map +0 -1
- package/dist/cli/commands/commit.js +0 -437
- package/dist/cli/commands/commit.js.map +0 -1
- package/dist/cli/commands/diff.d.ts +0 -464
- package/dist/cli/commands/diff.d.ts.map +0 -1
- package/dist/cli/commands/diff.js +0 -958
- package/dist/cli/commands/diff.js.map +0 -1
- package/dist/cli/commands/log.d.ts +0 -239
- package/dist/cli/commands/log.d.ts.map +0 -1
- package/dist/cli/commands/log.js +0 -535
- package/dist/cli/commands/log.js.map +0 -1
- package/dist/cli/commands/merge.d.ts +0 -106
- package/dist/cli/commands/merge.d.ts.map +0 -1
- package/dist/cli/commands/merge.js +0 -55
- package/dist/cli/commands/merge.js.map +0 -1
- package/dist/cli/commands/review.d.ts +0 -457
- package/dist/cli/commands/review.d.ts.map +0 -1
- package/dist/cli/commands/review.js +0 -533
- package/dist/cli/commands/review.js.map +0 -1
- package/dist/cli/commands/status.d.ts +0 -269
- package/dist/cli/commands/status.d.ts.map +0 -1
- package/dist/cli/commands/status.js +0 -493
- package/dist/cli/commands/status.js.map +0 -1
- package/dist/cli/commands/web.d.ts +0 -199
- package/dist/cli/commands/web.d.ts.map +0 -1
- package/dist/cli/commands/web.js +0 -696
- package/dist/cli/commands/web.js.map +0 -1
- package/dist/cli/fs-adapter.d.ts +0 -656
- package/dist/cli/fs-adapter.d.ts.map +0 -1
- package/dist/cli/fs-adapter.js +0 -1179
- package/dist/cli/fs-adapter.js.map +0 -1
- package/dist/cli/fsx-cli-adapter.d.ts +0 -359
- package/dist/cli/fsx-cli-adapter.d.ts.map +0 -1
- package/dist/cli/fsx-cli-adapter.js +0 -619
- package/dist/cli/fsx-cli-adapter.js.map +0 -1
- package/dist/cli/index.d.ts +0 -387
- package/dist/cli/index.d.ts.map +0 -1
- package/dist/cli/index.js +0 -523
- package/dist/cli/index.js.map +0 -1
- package/dist/cli/ui/components/DiffView.d.ts +0 -7
- package/dist/cli/ui/components/DiffView.d.ts.map +0 -1
- package/dist/cli/ui/components/DiffView.js +0 -11
- package/dist/cli/ui/components/DiffView.js.map +0 -1
- package/dist/cli/ui/components/ErrorDisplay.d.ts +0 -6
- package/dist/cli/ui/components/ErrorDisplay.d.ts.map +0 -1
- package/dist/cli/ui/components/ErrorDisplay.js +0 -11
- package/dist/cli/ui/components/ErrorDisplay.js.map +0 -1
- package/dist/cli/ui/components/FuzzySearch.d.ts +0 -9
- package/dist/cli/ui/components/FuzzySearch.d.ts.map +0 -1
- package/dist/cli/ui/components/FuzzySearch.js +0 -12
- package/dist/cli/ui/components/FuzzySearch.js.map +0 -1
- package/dist/cli/ui/components/LoadingSpinner.d.ts +0 -6
- package/dist/cli/ui/components/LoadingSpinner.d.ts.map +0 -1
- package/dist/cli/ui/components/LoadingSpinner.js +0 -10
- package/dist/cli/ui/components/LoadingSpinner.js.map +0 -1
- package/dist/cli/ui/components/NavigationList.d.ts +0 -9
- package/dist/cli/ui/components/NavigationList.d.ts.map +0 -1
- package/dist/cli/ui/components/NavigationList.js +0 -11
- package/dist/cli/ui/components/NavigationList.js.map +0 -1
- package/dist/cli/ui/components/ScrollableContent.d.ts +0 -8
- package/dist/cli/ui/components/ScrollableContent.d.ts.map +0 -1
- package/dist/cli/ui/components/ScrollableContent.js +0 -11
- package/dist/cli/ui/components/ScrollableContent.js.map +0 -1
- package/dist/cli/ui/components/index.d.ts +0 -7
- package/dist/cli/ui/components/index.d.ts.map +0 -1
- package/dist/cli/ui/components/index.js +0 -9
- package/dist/cli/ui/components/index.js.map +0 -1
- package/dist/cli/ui/terminal-ui.d.ts +0 -52
- package/dist/cli/ui/terminal-ui.d.ts.map +0 -1
- package/dist/cli/ui/terminal-ui.js +0 -121
- package/dist/cli/ui/terminal-ui.js.map +0 -1
- package/dist/do/BashModule.d.ts +0 -871
- package/dist/do/BashModule.d.ts.map +0 -1
- package/dist/do/BashModule.js +0 -1143
- package/dist/do/BashModule.js.map +0 -1
- package/dist/do/FsModule.d.ts +0 -601
- package/dist/do/FsModule.d.ts.map +0 -1
- package/dist/do/FsModule.js +0 -1120
- package/dist/do/FsModule.js.map +0 -1
- package/dist/do/GitModule.d.ts +0 -635
- package/dist/do/GitModule.d.ts.map +0 -1
- package/dist/do/GitModule.js +0 -781
- package/dist/do/GitModule.js.map +0 -1
- package/dist/do/GitRepoDO.d.ts +0 -281
- package/dist/do/GitRepoDO.d.ts.map +0 -1
- package/dist/do/GitRepoDO.js +0 -479
- package/dist/do/GitRepoDO.js.map +0 -1
- package/dist/do/bash-ast.d.ts +0 -246
- package/dist/do/bash-ast.d.ts.map +0 -1
- package/dist/do/bash-ast.js +0 -888
- package/dist/do/bash-ast.js.map +0 -1
- package/dist/do/container-executor.d.ts +0 -491
- package/dist/do/container-executor.d.ts.map +0 -1
- package/dist/do/container-executor.js +0 -730
- package/dist/do/container-executor.js.map +0 -1
- package/dist/do/index.d.ts +0 -53
- package/dist/do/index.d.ts.map +0 -1
- package/dist/do/index.js +0 -91
- package/dist/do/index.js.map +0 -1
- package/dist/do/tiered-storage.d.ts +0 -403
- package/dist/do/tiered-storage.d.ts.map +0 -1
- package/dist/do/tiered-storage.js +0 -689
- package/dist/do/tiered-storage.js.map +0 -1
- package/dist/do/withBash.d.ts +0 -231
- package/dist/do/withBash.d.ts.map +0 -1
- package/dist/do/withBash.js +0 -244
- package/dist/do/withBash.js.map +0 -1
- package/dist/do/withFs.d.ts +0 -237
- package/dist/do/withFs.d.ts.map +0 -1
- package/dist/do/withFs.js +0 -387
- package/dist/do/withFs.js.map +0 -1
- package/dist/do/withGit.d.ts +0 -180
- package/dist/do/withGit.d.ts.map +0 -1
- package/dist/do/withGit.js +0 -271
- package/dist/do/withGit.js.map +0 -1
- package/dist/durable-object/object-store.d.ts +0 -633
- package/dist/durable-object/object-store.d.ts.map +0 -1
- package/dist/durable-object/object-store.js +0 -1161
- package/dist/durable-object/object-store.js.map +0 -1
- package/dist/durable-object/schema.d.ts.map +0 -1
- package/dist/durable-object/schema.js.map +0 -1
- package/dist/durable-object/wal.d.ts +0 -416
- package/dist/durable-object/wal.d.ts.map +0 -1
- package/dist/durable-object/wal.js +0 -445
- package/dist/durable-object/wal.js.map +0 -1
- package/dist/mcp/adapter.d.ts +0 -772
- package/dist/mcp/adapter.d.ts.map +0 -1
- package/dist/mcp/adapter.js +0 -895
- package/dist/mcp/adapter.js.map +0 -1
- package/dist/mcp/sandbox/miniflare-evaluator.d.ts +0 -22
- package/dist/mcp/sandbox/miniflare-evaluator.d.ts.map +0 -1
- package/dist/mcp/sandbox/miniflare-evaluator.js +0 -140
- package/dist/mcp/sandbox/miniflare-evaluator.js.map +0 -1
- package/dist/mcp/sandbox/object-store-proxy.d.ts +0 -32
- package/dist/mcp/sandbox/object-store-proxy.d.ts.map +0 -1
- package/dist/mcp/sandbox/object-store-proxy.js +0 -30
- package/dist/mcp/sandbox/object-store-proxy.js.map +0 -1
- package/dist/mcp/sandbox/template.d.ts +0 -17
- package/dist/mcp/sandbox/template.d.ts.map +0 -1
- package/dist/mcp/sandbox/template.js +0 -71
- package/dist/mcp/sandbox/template.js.map +0 -1
- package/dist/mcp/sandbox.d.ts +0 -764
- package/dist/mcp/sandbox.d.ts.map +0 -1
- package/dist/mcp/sandbox.js +0 -1362
- package/dist/mcp/sandbox.js.map +0 -1
- package/dist/mcp/sdk-adapter.d.ts +0 -835
- package/dist/mcp/sdk-adapter.d.ts.map +0 -1
- package/dist/mcp/sdk-adapter.js +0 -974
- package/dist/mcp/sdk-adapter.js.map +0 -1
- package/dist/mcp/tools/do.d.ts +0 -32
- package/dist/mcp/tools/do.d.ts.map +0 -1
- package/dist/mcp/tools/do.js +0 -115
- package/dist/mcp/tools/do.js.map +0 -1
- package/dist/mcp/tools.d.ts +0 -548
- package/dist/mcp/tools.d.ts.map +0 -1
- package/dist/mcp/tools.js +0 -1934
- package/dist/mcp/tools.js.map +0 -1
- package/dist/ops/blame.d.ts +0 -551
- package/dist/ops/blame.d.ts.map +0 -1
- package/dist/ops/blame.js +0 -1037
- package/dist/ops/blame.js.map +0 -1
- package/dist/ops/branch.d.ts +0 -766
- package/dist/ops/branch.d.ts.map +0 -1
- package/dist/ops/branch.js +0 -950
- package/dist/ops/branch.js.map +0 -1
- package/dist/ops/commit-traversal.d.ts +0 -349
- package/dist/ops/commit-traversal.d.ts.map +0 -1
- package/dist/ops/commit-traversal.js +0 -821
- package/dist/ops/commit-traversal.js.map +0 -1
- package/dist/ops/commit.d.ts +0 -555
- package/dist/ops/commit.d.ts.map +0 -1
- package/dist/ops/commit.js +0 -826
- package/dist/ops/commit.js.map +0 -1
- package/dist/ops/merge-base.d.ts +0 -397
- package/dist/ops/merge-base.d.ts.map +0 -1
- package/dist/ops/merge-base.js +0 -691
- package/dist/ops/merge-base.js.map +0 -1
- package/dist/ops/merge.d.ts +0 -855
- package/dist/ops/merge.d.ts.map +0 -1
- package/dist/ops/merge.js +0 -1551
- package/dist/ops/merge.js.map +0 -1
- package/dist/ops/tag.d.ts +0 -247
- package/dist/ops/tag.d.ts.map +0 -1
- package/dist/ops/tag.js +0 -649
- package/dist/ops/tag.js.map +0 -1
- package/dist/ops/tree-builder.d.ts +0 -178
- package/dist/ops/tree-builder.d.ts.map +0 -1
- package/dist/ops/tree-builder.js +0 -271
- package/dist/ops/tree-builder.js.map +0 -1
- package/dist/ops/tree-diff.d.ts +0 -291
- package/dist/ops/tree-diff.d.ts.map +0 -1
- package/dist/ops/tree-diff.js +0 -705
- package/dist/ops/tree-diff.js.map +0 -1
- package/dist/pack/delta.d.ts +0 -248
- package/dist/pack/delta.d.ts.map +0 -1
- package/dist/pack/delta.js +0 -736
- package/dist/pack/delta.js.map +0 -1
- package/dist/pack/format.d.ts +0 -446
- package/dist/pack/format.d.ts.map +0 -1
- package/dist/pack/format.js +0 -572
- package/dist/pack/format.js.map +0 -1
- package/dist/pack/full-generation.d.ts +0 -612
- package/dist/pack/full-generation.d.ts.map +0 -1
- package/dist/pack/full-generation.js +0 -1378
- package/dist/pack/full-generation.js.map +0 -1
- package/dist/pack/generation.d.ts +0 -441
- package/dist/pack/generation.d.ts.map +0 -1
- package/dist/pack/generation.js +0 -707
- package/dist/pack/generation.js.map +0 -1
- package/dist/pack/index.d.ts +0 -502
- package/dist/pack/index.d.ts.map +0 -1
- package/dist/pack/index.js +0 -833
- package/dist/pack/index.js.map +0 -1
- package/dist/refs/branch.d.ts +0 -668
- package/dist/refs/branch.d.ts.map +0 -1
- package/dist/refs/branch.js +0 -897
- package/dist/refs/branch.js.map +0 -1
- package/dist/refs/storage.d.ts +0 -833
- package/dist/refs/storage.d.ts.map +0 -1
- package/dist/refs/storage.js +0 -1023
- package/dist/refs/storage.js.map +0 -1
- package/dist/refs/tag.d.ts +0 -860
- package/dist/refs/tag.d.ts.map +0 -1
- package/dist/refs/tag.js +0 -996
- package/dist/refs/tag.js.map +0 -1
- package/dist/storage/backend.d.ts +0 -425
- package/dist/storage/backend.d.ts.map +0 -1
- package/dist/storage/backend.js +0 -41
- package/dist/storage/backend.js.map +0 -1
- package/dist/storage/fsx-adapter.d.ts +0 -204
- package/dist/storage/fsx-adapter.d.ts.map +0 -1
- package/dist/storage/fsx-adapter.js +0 -470
- package/dist/storage/fsx-adapter.js.map +0 -1
- package/dist/storage/lru-cache.d.ts +0 -691
- package/dist/storage/lru-cache.d.ts.map +0 -1
- package/dist/storage/lru-cache.js +0 -813
- package/dist/storage/lru-cache.js.map +0 -1
- package/dist/storage/object-index.d.ts +0 -585
- package/dist/storage/object-index.d.ts.map +0 -1
- package/dist/storage/object-index.js +0 -532
- package/dist/storage/object-index.js.map +0 -1
- package/dist/storage/r2-pack.d.ts +0 -1257
- package/dist/storage/r2-pack.d.ts.map +0 -1
- package/dist/storage/r2-pack.js +0 -1770
- package/dist/storage/r2-pack.js.map +0 -1
- package/dist/tiered/cdc-pipeline.d.ts +0 -1888
- package/dist/tiered/cdc-pipeline.d.ts.map +0 -1
- package/dist/tiered/cdc-pipeline.js +0 -1880
- package/dist/tiered/cdc-pipeline.js.map +0 -1
- package/dist/tiered/migration.d.ts +0 -1104
- package/dist/tiered/migration.d.ts.map +0 -1
- package/dist/tiered/migration.js +0 -1214
- package/dist/tiered/migration.js.map +0 -1
- package/dist/tiered/parquet-writer.d.ts +0 -1145
- package/dist/tiered/parquet-writer.d.ts.map +0 -1
- package/dist/tiered/parquet-writer.js +0 -1183
- package/dist/tiered/parquet-writer.js.map +0 -1
- package/dist/tiered/read-path.d.ts +0 -835
- package/dist/tiered/read-path.d.ts.map +0 -1
- package/dist/tiered/read-path.js +0 -487
- package/dist/tiered/read-path.js.map +0 -1
- package/dist/types/capability.d.ts +0 -1385
- package/dist/types/capability.d.ts.map +0 -1
- package/dist/types/capability.js +0 -36
- package/dist/types/capability.js.map +0 -1
- package/dist/types/index.d.ts +0 -13
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/index.js +0 -18
- package/dist/types/index.js.map +0 -1
- package/dist/types/objects.d.ts +0 -692
- package/dist/types/objects.d.ts.map +0 -1
- package/dist/types/objects.js +0 -837
- package/dist/types/objects.js.map +0 -1
- package/dist/types/storage.d.ts +0 -603
- package/dist/types/storage.d.ts.map +0 -1
- package/dist/types/storage.js +0 -191
- package/dist/types/storage.js.map +0 -1
- package/dist/types/worker-loader.d.ts +0 -60
- package/dist/types/worker-loader.d.ts.map +0 -1
- package/dist/types/worker-loader.js +0 -62
- package/dist/types/worker-loader.js.map +0 -1
- package/dist/utils/hash.d.ts +0 -197
- package/dist/utils/hash.d.ts.map +0 -1
- package/dist/utils/hash.js +0 -268
- package/dist/utils/hash.js.map +0 -1
- package/dist/utils/sha1.d.ts +0 -290
- package/dist/utils/sha1.d.ts.map +0 -1
- package/dist/utils/sha1.js +0 -582
- package/dist/utils/sha1.js.map +0 -1
- package/dist/wire/capabilities.d.ts +0 -1044
- package/dist/wire/capabilities.d.ts.map +0 -1
- package/dist/wire/capabilities.js +0 -941
- package/dist/wire/capabilities.js.map +0 -1
- package/dist/wire/path-security.d.ts +0 -157
- package/dist/wire/path-security.d.ts.map +0 -1
- package/dist/wire/path-security.js +0 -307
- package/dist/wire/path-security.js.map +0 -1
- package/dist/wire/pkt-line.d.ts +0 -345
- package/dist/wire/pkt-line.d.ts.map +0 -1
- package/dist/wire/pkt-line.js +0 -381
- package/dist/wire/pkt-line.js.map +0 -1
- package/dist/wire/receive-pack.d.ts +0 -1059
- package/dist/wire/receive-pack.d.ts.map +0 -1
- package/dist/wire/receive-pack.js +0 -1414
- package/dist/wire/receive-pack.js.map +0 -1
- package/dist/wire/smart-http.d.ts +0 -799
- package/dist/wire/smart-http.d.ts.map +0 -1
- package/dist/wire/smart-http.js +0 -945
- package/dist/wire/smart-http.js.map +0 -1
- package/dist/wire/upload-pack.d.ts +0 -727
- package/dist/wire/upload-pack.d.ts.map +0 -1
- package/dist/wire/upload-pack.js +0 -1138
- package/dist/wire/upload-pack.js.map +0 -1
|
@@ -1,633 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @fileoverview Git Object Store for Durable Objects
|
|
3
|
-
*
|
|
4
|
-
* This module provides a Git object storage implementation backed by SQLite
|
|
5
|
-
* within Cloudflare Durable Objects. It handles CRUD operations for all four
|
|
6
|
-
* Git object types (blob, tree, commit, tag) with proper SHA-1 hash computation.
|
|
7
|
-
*
|
|
8
|
-
* **Key Features**:
|
|
9
|
-
* - Content-addressable storage using SHA-1 hashes
|
|
10
|
-
* - Write-ahead logging (WAL) for durability
|
|
11
|
-
* - Object index for tiered storage support
|
|
12
|
-
* - Batch operations for efficiency with transaction support
|
|
13
|
-
* - LRU caching for hot tier objects
|
|
14
|
-
* - Metrics and logging infrastructure
|
|
15
|
-
* - Typed accessors for each Git object type
|
|
16
|
-
*
|
|
17
|
-
* @module durable-object/object-store
|
|
18
|
-
*
|
|
19
|
-
* @example
|
|
20
|
-
* ```typescript
|
|
21
|
-
* import { ObjectStore } from './durable-object/object-store'
|
|
22
|
-
*
|
|
23
|
-
* const store = new ObjectStore(durableObjectStorage, {
|
|
24
|
-
* cacheMaxCount: 1000,
|
|
25
|
-
* cacheMaxBytes: 50 * 1024 * 1024, // 50MB
|
|
26
|
-
* enableMetrics: true
|
|
27
|
-
* })
|
|
28
|
-
*
|
|
29
|
-
* // Store a blob
|
|
30
|
-
* const content = new TextEncoder().encode('Hello, World!')
|
|
31
|
-
* const sha = await store.putObject('blob', content)
|
|
32
|
-
*
|
|
33
|
-
* // Retrieve it (cached on second access)
|
|
34
|
-
* const obj = await store.getObject(sha)
|
|
35
|
-
* console.log(obj?.type, obj?.size)
|
|
36
|
-
*
|
|
37
|
-
* // Get typed object
|
|
38
|
-
* const blob = await store.getBlobObject(sha)
|
|
39
|
-
*
|
|
40
|
-
* // Get metrics
|
|
41
|
-
* const metrics = store.getMetrics()
|
|
42
|
-
* console.log(`Cache hit rate: ${metrics.cacheHitRate}%`)
|
|
43
|
-
* ```
|
|
44
|
-
*/
|
|
45
|
-
import { DurableObjectStorage } from './schema';
|
|
46
|
-
import { CacheStats } from '../storage/lru-cache';
|
|
47
|
-
import { ObjectType, BlobObject, TreeObject, CommitObject, TagObject, TreeEntry, Author } from '../types/objects';
|
|
48
|
-
import type { StorageBackend } from '../storage/backend';
|
|
49
|
-
/**
|
|
50
|
-
* Stored object record as persisted in SQLite.
|
|
51
|
-
*
|
|
52
|
-
* @description
|
|
53
|
-
* Represents a Git object with metadata as stored in the database.
|
|
54
|
-
* The `data` field contains the object content WITHOUT the Git header.
|
|
55
|
-
*
|
|
56
|
-
* @example
|
|
57
|
-
* ```typescript
|
|
58
|
-
* const obj: StoredObject = {
|
|
59
|
-
* sha: 'abc123...',
|
|
60
|
-
* type: 'blob',
|
|
61
|
-
* size: 13,
|
|
62
|
-
* data: new Uint8Array([...]),
|
|
63
|
-
* createdAt: 1704067200000
|
|
64
|
-
* }
|
|
65
|
-
* ```
|
|
66
|
-
*/
|
|
67
|
-
export interface StoredObject {
|
|
68
|
-
/** 40-character SHA-1 hash (primary key) */
|
|
69
|
-
sha: string;
|
|
70
|
-
/** Object type: 'blob', 'tree', 'commit', or 'tag' */
|
|
71
|
-
type: ObjectType;
|
|
72
|
-
/** Size of the data in bytes */
|
|
73
|
-
size: number;
|
|
74
|
-
/** Raw object content (without Git header) */
|
|
75
|
-
data: Uint8Array;
|
|
76
|
-
/** Unix timestamp (milliseconds) when object was created */
|
|
77
|
-
createdAt: number;
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* Configuration options for ObjectStore.
|
|
81
|
-
*
|
|
82
|
-
* @description
|
|
83
|
-
* Controls caching behavior, metrics collection, and logging.
|
|
84
|
-
*
|
|
85
|
-
* @example
|
|
86
|
-
* ```typescript
|
|
87
|
-
* const options: ObjectStoreOptions = {
|
|
88
|
-
* cacheMaxCount: 1000,
|
|
89
|
-
* cacheMaxBytes: 50 * 1024 * 1024,
|
|
90
|
-
* cacheTTL: 3600000,
|
|
91
|
-
* enableMetrics: true,
|
|
92
|
-
* logger: console
|
|
93
|
-
* }
|
|
94
|
-
* ```
|
|
95
|
-
*/
|
|
96
|
-
export interface ObjectStoreOptions {
|
|
97
|
-
/**
|
|
98
|
-
* Maximum number of objects to cache in memory.
|
|
99
|
-
* @default 500
|
|
100
|
-
*/
|
|
101
|
-
cacheMaxCount?: number;
|
|
102
|
-
/**
|
|
103
|
-
* Maximum cache size in bytes.
|
|
104
|
-
* @default 25MB
|
|
105
|
-
*/
|
|
106
|
-
cacheMaxBytes?: number;
|
|
107
|
-
/**
|
|
108
|
-
* Time-to-live for cached objects in milliseconds.
|
|
109
|
-
* @default undefined (no expiration)
|
|
110
|
-
*/
|
|
111
|
-
cacheTTL?: number;
|
|
112
|
-
/**
|
|
113
|
-
* Enable metrics collection.
|
|
114
|
-
* @default false
|
|
115
|
-
*/
|
|
116
|
-
enableMetrics?: boolean;
|
|
117
|
-
/**
|
|
118
|
-
* Logger interface for operation logging.
|
|
119
|
-
* @default undefined (no logging)
|
|
120
|
-
*/
|
|
121
|
-
logger?: ObjectStoreLogger;
|
|
122
|
-
/**
|
|
123
|
-
* Optional storage backend abstraction.
|
|
124
|
-
* If provided, delegates CAS operations to this backend instead of SQLite.
|
|
125
|
-
* This enables gradual migration to different storage implementations.
|
|
126
|
-
* @default undefined (uses SQLite directly)
|
|
127
|
-
*/
|
|
128
|
-
backend?: StorageBackend;
|
|
129
|
-
}
|
|
130
|
-
/**
|
|
131
|
-
* Logger interface for ObjectStore operations.
|
|
132
|
-
*/
|
|
133
|
-
export interface ObjectStoreLogger {
|
|
134
|
-
debug?(message: string, ...args: unknown[]): void;
|
|
135
|
-
info?(message: string, ...args: unknown[]): void;
|
|
136
|
-
warn?(message: string, ...args: unknown[]): void;
|
|
137
|
-
error?(message: string, ...args: unknown[]): void;
|
|
138
|
-
}
|
|
139
|
-
/**
|
|
140
|
-
* Metrics collected by ObjectStore operations.
|
|
141
|
-
*/
|
|
142
|
-
export interface ObjectStoreMetrics {
|
|
143
|
-
/** Total number of read operations */
|
|
144
|
-
reads: number;
|
|
145
|
-
/** Total number of write operations */
|
|
146
|
-
writes: number;
|
|
147
|
-
/** Total number of delete operations */
|
|
148
|
-
deletes: number;
|
|
149
|
-
/** Cache statistics */
|
|
150
|
-
cache: CacheStats;
|
|
151
|
-
/** Cache hit rate percentage */
|
|
152
|
-
cacheHitRate: number;
|
|
153
|
-
/** Total bytes written */
|
|
154
|
-
bytesWritten: number;
|
|
155
|
-
/** Total bytes read */
|
|
156
|
-
bytesRead: number;
|
|
157
|
-
/** Average write latency in ms */
|
|
158
|
-
avgWriteLatencyMs: number;
|
|
159
|
-
/** Average read latency in ms */
|
|
160
|
-
avgReadLatencyMs: number;
|
|
161
|
-
/** Number of batch operations */
|
|
162
|
-
batchOperations: number;
|
|
163
|
-
/** Total objects in batch operations */
|
|
164
|
-
batchObjectsTotal: number;
|
|
165
|
-
}
|
|
166
|
-
/**
|
|
167
|
-
* ObjectStore class for managing Git objects in SQLite storage.
|
|
168
|
-
*
|
|
169
|
-
* @description
|
|
170
|
-
* Provides a complete implementation of Git object storage operations.
|
|
171
|
-
* All objects are stored in the `objects` table and indexed in `object_index`
|
|
172
|
-
* for tiered storage support. Write operations are logged to WAL for durability.
|
|
173
|
-
*
|
|
174
|
-
* @example
|
|
175
|
-
* ```typescript
|
|
176
|
-
* const store = new ObjectStore(durableObjectStorage)
|
|
177
|
-
*
|
|
178
|
-
* // Create a commit
|
|
179
|
-
* const commitSha = await store.putCommitObject({
|
|
180
|
-
* tree: treeSha,
|
|
181
|
-
* parents: [parentSha],
|
|
182
|
-
* author: { name: 'Alice', email: 'alice@example.com', timestamp: 1704067200, timezone: '+0000' },
|
|
183
|
-
* committer: { name: 'Alice', email: 'alice@example.com', timestamp: 1704067200, timezone: '+0000' },
|
|
184
|
-
* message: 'Initial commit'
|
|
185
|
-
* })
|
|
186
|
-
*
|
|
187
|
-
* // Read it back
|
|
188
|
-
* const commit = await store.getCommitObject(commitSha)
|
|
189
|
-
* console.log(commit?.message)
|
|
190
|
-
* ```
|
|
191
|
-
*/
|
|
192
|
-
export declare class ObjectStore {
|
|
193
|
-
private storage;
|
|
194
|
-
private cache;
|
|
195
|
-
private options;
|
|
196
|
-
private logger?;
|
|
197
|
-
private backend;
|
|
198
|
-
private _reads;
|
|
199
|
-
private _writes;
|
|
200
|
-
private _deletes;
|
|
201
|
-
private _bytesWritten;
|
|
202
|
-
private _bytesRead;
|
|
203
|
-
private _totalWriteLatency;
|
|
204
|
-
private _totalReadLatency;
|
|
205
|
-
private _batchOperations;
|
|
206
|
-
private _batchObjectsTotal;
|
|
207
|
-
/**
|
|
208
|
-
* Create a new ObjectStore.
|
|
209
|
-
*
|
|
210
|
-
* @param storage - Durable Object storage interface with SQL support
|
|
211
|
-
* @param options - Configuration options for caching, metrics, logging, and backend
|
|
212
|
-
*
|
|
213
|
-
* @example
|
|
214
|
-
* ```typescript
|
|
215
|
-
* // Basic usage (SQLite backend)
|
|
216
|
-
* const store = new ObjectStore(storage)
|
|
217
|
-
*
|
|
218
|
-
* // With caching and metrics
|
|
219
|
-
* const store = new ObjectStore(storage, {
|
|
220
|
-
* cacheMaxCount: 1000,
|
|
221
|
-
* cacheMaxBytes: 50 * 1024 * 1024,
|
|
222
|
-
* enableMetrics: true,
|
|
223
|
-
* logger: console
|
|
224
|
-
* })
|
|
225
|
-
*
|
|
226
|
-
* // With StorageBackend abstraction
|
|
227
|
-
* const store = new ObjectStore(storage, {
|
|
228
|
-
* backend: fsBackend
|
|
229
|
-
* })
|
|
230
|
-
* ```
|
|
231
|
-
*/
|
|
232
|
-
constructor(storage: DurableObjectStorage, options?: ObjectStoreOptions);
|
|
233
|
-
/**
|
|
234
|
-
* Log a message if logger is configured.
|
|
235
|
-
* @internal
|
|
236
|
-
*/
|
|
237
|
-
private log;
|
|
238
|
-
/**
|
|
239
|
-
* Store a raw object and return its SHA.
|
|
240
|
-
*
|
|
241
|
-
* @description
|
|
242
|
-
* Computes the SHA-1 hash of the object in Git format (type + size + content),
|
|
243
|
-
* logs the operation to WAL, stores the object, and updates the object index.
|
|
244
|
-
* If an object with the same SHA already exists, it is replaced (idempotent).
|
|
245
|
-
* The object is also added to the LRU cache for fast subsequent reads.
|
|
246
|
-
*
|
|
247
|
-
* @param type - Object type ('blob', 'tree', 'commit', 'tag')
|
|
248
|
-
* @param data - Raw object content (without Git header)
|
|
249
|
-
* @returns 40-character SHA-1 hash of the stored object
|
|
250
|
-
*
|
|
251
|
-
* @example
|
|
252
|
-
* ```typescript
|
|
253
|
-
* const content = new TextEncoder().encode('file content')
|
|
254
|
-
* const sha = await store.putObject('blob', content)
|
|
255
|
-
* console.log(`Stored blob: ${sha}`)
|
|
256
|
-
* ```
|
|
257
|
-
*/
|
|
258
|
-
putObject(type: ObjectType, data: Uint8Array): Promise<string>;
|
|
259
|
-
/**
|
|
260
|
-
* Store a tree object with entries.
|
|
261
|
-
*
|
|
262
|
-
* @description
|
|
263
|
-
* Creates a Git tree object from an array of entries. Entries are sorted
|
|
264
|
-
* by name (with directories treated as having trailing slashes for sorting).
|
|
265
|
-
* Each entry is serialized as: "{mode} {name}\0{20-byte-sha}"
|
|
266
|
-
*
|
|
267
|
-
* @param entries - Array of tree entries (files and subdirectories)
|
|
268
|
-
* @returns 40-character SHA-1 hash of the stored tree
|
|
269
|
-
*
|
|
270
|
-
* @example
|
|
271
|
-
* ```typescript
|
|
272
|
-
* const treeSha = await store.putTreeObject([
|
|
273
|
-
* { mode: '100644', name: 'README.md', sha: blobSha },
|
|
274
|
-
* { mode: '040000', name: 'src', sha: subdirSha }
|
|
275
|
-
* ])
|
|
276
|
-
* ```
|
|
277
|
-
*/
|
|
278
|
-
putTreeObject(entries: TreeEntry[]): Promise<string>;
|
|
279
|
-
/**
|
|
280
|
-
* Store a commit object.
|
|
281
|
-
*
|
|
282
|
-
* @description
|
|
283
|
-
* Creates a Git commit object with the specified tree, parents, author,
|
|
284
|
-
* committer, and message. The commit content is formatted according to
|
|
285
|
-
* the Git commit format specification.
|
|
286
|
-
*
|
|
287
|
-
* @param commit - Commit data
|
|
288
|
-
* @param commit.tree - SHA of the root tree object
|
|
289
|
-
* @param commit.parents - Array of parent commit SHAs (empty for root commit)
|
|
290
|
-
* @param commit.author - Author information
|
|
291
|
-
* @param commit.committer - Committer information
|
|
292
|
-
* @param commit.message - Commit message
|
|
293
|
-
* @returns 40-character SHA-1 hash of the stored commit
|
|
294
|
-
*
|
|
295
|
-
* @example
|
|
296
|
-
* ```typescript
|
|
297
|
-
* const now = Math.floor(Date.now() / 1000)
|
|
298
|
-
* const author = { name: 'Alice', email: 'alice@example.com', timestamp: now, timezone: '+0000' }
|
|
299
|
-
*
|
|
300
|
-
* const sha = await store.putCommitObject({
|
|
301
|
-
* tree: treeSha,
|
|
302
|
-
* parents: [],
|
|
303
|
-
* author,
|
|
304
|
-
* committer: author,
|
|
305
|
-
* message: 'Initial commit\n\nThis is the first commit.'
|
|
306
|
-
* })
|
|
307
|
-
* ```
|
|
308
|
-
*/
|
|
309
|
-
putCommitObject(commit: {
|
|
310
|
-
tree: string;
|
|
311
|
-
parents: string[];
|
|
312
|
-
author: Author;
|
|
313
|
-
committer: Author;
|
|
314
|
-
message: string;
|
|
315
|
-
}): Promise<string>;
|
|
316
|
-
/**
|
|
317
|
-
* Store a tag object (annotated tag).
|
|
318
|
-
*
|
|
319
|
-
* @description
|
|
320
|
-
* Creates a Git tag object pointing to another object with tagger
|
|
321
|
-
* information and a message. The tag content is formatted according
|
|
322
|
-
* to the Git tag format specification.
|
|
323
|
-
*
|
|
324
|
-
* @param tag - Tag data
|
|
325
|
-
* @param tag.object - SHA of the object being tagged
|
|
326
|
-
* @param tag.objectType - Type of the object being tagged
|
|
327
|
-
* @param tag.tagger - Tagger information
|
|
328
|
-
* @param tag.message - Tag message
|
|
329
|
-
* @param tag.name - Tag name
|
|
330
|
-
* @returns 40-character SHA-1 hash of the stored tag object
|
|
331
|
-
*
|
|
332
|
-
* @example
|
|
333
|
-
* ```typescript
|
|
334
|
-
* const now = Math.floor(Date.now() / 1000)
|
|
335
|
-
* const tagger = { name: 'Bob', email: 'bob@example.com', timestamp: now, timezone: '+0000' }
|
|
336
|
-
*
|
|
337
|
-
* const sha = await store.putTagObject({
|
|
338
|
-
* object: commitSha,
|
|
339
|
-
* objectType: 'commit',
|
|
340
|
-
* tagger,
|
|
341
|
-
* message: 'Release v1.0.0',
|
|
342
|
-
* name: 'v1.0.0'
|
|
343
|
-
* })
|
|
344
|
-
* ```
|
|
345
|
-
*/
|
|
346
|
-
putTagObject(tag: {
|
|
347
|
-
object: string;
|
|
348
|
-
objectType: ObjectType;
|
|
349
|
-
tagger?: Author;
|
|
350
|
-
message: string;
|
|
351
|
-
name: string;
|
|
352
|
-
}): Promise<string>;
|
|
353
|
-
/**
|
|
354
|
-
* Retrieve an object by SHA.
|
|
355
|
-
*
|
|
356
|
-
* @description
|
|
357
|
-
* Fetches an object from the LRU cache first, falling back to the database
|
|
358
|
-
* if not cached. Returns null if the object doesn't exist or if the SHA is invalid.
|
|
359
|
-
*
|
|
360
|
-
* @param sha - 40-character SHA-1 hash
|
|
361
|
-
* @returns The stored object or null if not found
|
|
362
|
-
*
|
|
363
|
-
* @example
|
|
364
|
-
* ```typescript
|
|
365
|
-
* const obj = await store.getObject(sha)
|
|
366
|
-
* if (obj) {
|
|
367
|
-
* console.log(`Found ${obj.type} of ${obj.size} bytes`)
|
|
368
|
-
* }
|
|
369
|
-
* ```
|
|
370
|
-
*/
|
|
371
|
-
getObject(sha: string): Promise<StoredObject | null>;
|
|
372
|
-
/**
|
|
373
|
-
* Delete an object by SHA.
|
|
374
|
-
*
|
|
375
|
-
* @description
|
|
376
|
-
* Removes an object from the cache, objects table, and the object index.
|
|
377
|
-
* The operation is logged to WAL. Returns false if the object doesn't exist.
|
|
378
|
-
*
|
|
379
|
-
* **Warning**: Deleting objects that are still referenced by other objects
|
|
380
|
-
* (e.g., blobs referenced by trees) will corrupt the repository.
|
|
381
|
-
*
|
|
382
|
-
* @param sha - 40-character SHA-1 hash
|
|
383
|
-
* @returns True if the object was deleted, false if it didn't exist
|
|
384
|
-
*
|
|
385
|
-
* @example
|
|
386
|
-
* ```typescript
|
|
387
|
-
* const deleted = await store.deleteObject(sha)
|
|
388
|
-
* if (deleted) {
|
|
389
|
-
* console.log('Object removed')
|
|
390
|
-
* }
|
|
391
|
-
* ```
|
|
392
|
-
*/
|
|
393
|
-
deleteObject(sha: string): Promise<boolean>;
|
|
394
|
-
/**
|
|
395
|
-
* Check if an object exists.
|
|
396
|
-
*
|
|
397
|
-
* @description
|
|
398
|
-
* Efficiently checks for object existence without fetching the full content.
|
|
399
|
-
*
|
|
400
|
-
* @param sha - 40-character SHA-1 hash
|
|
401
|
-
* @returns True if the object exists, false otherwise
|
|
402
|
-
*
|
|
403
|
-
* @example
|
|
404
|
-
* ```typescript
|
|
405
|
-
* if (await store.hasObject(sha)) {
|
|
406
|
-
* console.log('Object exists')
|
|
407
|
-
* }
|
|
408
|
-
* ```
|
|
409
|
-
*/
|
|
410
|
-
hasObject(sha: string): Promise<boolean>;
|
|
411
|
-
/**
|
|
412
|
-
* Verify an object's integrity by recomputing its hash.
|
|
413
|
-
*
|
|
414
|
-
* @description
|
|
415
|
-
* Computes the SHA-1 hash of the stored object and compares it
|
|
416
|
-
* to the stored SHA. Returns false if the object is corrupted
|
|
417
|
-
* or doesn't exist.
|
|
418
|
-
*
|
|
419
|
-
* @param sha - 40-character SHA-1 hash to verify
|
|
420
|
-
* @returns True if the computed hash matches, false otherwise
|
|
421
|
-
*
|
|
422
|
-
* @example
|
|
423
|
-
* ```typescript
|
|
424
|
-
* if (await store.verifyObject(sha)) {
|
|
425
|
-
* console.log('Object integrity verified')
|
|
426
|
-
* } else {
|
|
427
|
-
* console.log('Object is corrupted or missing')
|
|
428
|
-
* }
|
|
429
|
-
* ```
|
|
430
|
-
*/
|
|
431
|
-
verifyObject(sha: string): Promise<boolean>;
|
|
432
|
-
/**
|
|
433
|
-
* Get object type by SHA.
|
|
434
|
-
*
|
|
435
|
-
* @description
|
|
436
|
-
* Returns just the type of an object without fetching its content.
|
|
437
|
-
*
|
|
438
|
-
* @param sha - 40-character SHA-1 hash
|
|
439
|
-
* @returns Object type or null if not found
|
|
440
|
-
*
|
|
441
|
-
* @example
|
|
442
|
-
* ```typescript
|
|
443
|
-
* const type = await store.getObjectType(sha)
|
|
444
|
-
* if (type === 'commit') {
|
|
445
|
-
* // Handle commit
|
|
446
|
-
* }
|
|
447
|
-
* ```
|
|
448
|
-
*/
|
|
449
|
-
getObjectType(sha: string): Promise<ObjectType | null>;
|
|
450
|
-
/**
|
|
451
|
-
* Get object size by SHA.
|
|
452
|
-
*
|
|
453
|
-
* @description
|
|
454
|
-
* Returns just the size of an object without fetching its content.
|
|
455
|
-
*
|
|
456
|
-
* @param sha - 40-character SHA-1 hash
|
|
457
|
-
* @returns Object size in bytes or null if not found
|
|
458
|
-
*
|
|
459
|
-
* @example
|
|
460
|
-
* ```typescript
|
|
461
|
-
* const size = await store.getObjectSize(sha)
|
|
462
|
-
* console.log(`Object is ${size} bytes`)
|
|
463
|
-
* ```
|
|
464
|
-
*/
|
|
465
|
-
getObjectSize(sha: string): Promise<number | null>;
|
|
466
|
-
/**
|
|
467
|
-
* Store multiple objects in a batch using a single transaction.
|
|
468
|
-
*
|
|
469
|
-
* @description
|
|
470
|
-
* Stores multiple objects atomically within a single SQLite transaction.
|
|
471
|
-
* This is more efficient than individual puts for bulk operations as it:
|
|
472
|
-
* - Reduces the number of disk flushes
|
|
473
|
-
* - Ensures atomic writes (all-or-nothing)
|
|
474
|
-
* - Batches WAL entries for better performance
|
|
475
|
-
*
|
|
476
|
-
* @param objects - Array of objects to store
|
|
477
|
-
* @returns Array of SHA-1 hashes in the same order as input
|
|
478
|
-
*
|
|
479
|
-
* @example
|
|
480
|
-
* ```typescript
|
|
481
|
-
* const shas = await store.putObjects([
|
|
482
|
-
* { type: 'blob', data: content1 },
|
|
483
|
-
* { type: 'blob', data: content2 }
|
|
484
|
-
* ])
|
|
485
|
-
* ```
|
|
486
|
-
*/
|
|
487
|
-
putObjects(objects: {
|
|
488
|
-
type: ObjectType;
|
|
489
|
-
data: Uint8Array;
|
|
490
|
-
}[]): Promise<string[]>;
|
|
491
|
-
/**
|
|
492
|
-
* Retrieve multiple objects by SHA using optimized batch queries.
|
|
493
|
-
*
|
|
494
|
-
* @description
|
|
495
|
-
* Fetches multiple objects efficiently by:
|
|
496
|
-
* 1. First checking the LRU cache for each SHA
|
|
497
|
-
* 2. Batching uncached SHAs into a single SQL query with IN clause
|
|
498
|
-
* 3. Returning results in the original order with null for missing objects
|
|
499
|
-
*
|
|
500
|
-
* @param shas - Array of 40-character SHA-1 hashes
|
|
501
|
-
* @returns Array of objects (or null for missing) in the same order
|
|
502
|
-
*
|
|
503
|
-
* @example
|
|
504
|
-
* ```typescript
|
|
505
|
-
* const objects = await store.getObjects([sha1, sha2, sha3])
|
|
506
|
-
* objects.forEach((obj, i) => {
|
|
507
|
-
* if (obj) {
|
|
508
|
-
* console.log(`${i}: ${obj.type}`)
|
|
509
|
-
* }
|
|
510
|
-
* })
|
|
511
|
-
* ```
|
|
512
|
-
*/
|
|
513
|
-
getObjects(shas: string[]): Promise<(StoredObject | null)[]>;
|
|
514
|
-
/**
|
|
515
|
-
* Get a blob object with typed result.
|
|
516
|
-
*
|
|
517
|
-
* @description
|
|
518
|
-
* Fetches an object and returns it as a BlobObject if it's a blob.
|
|
519
|
-
* Returns null if the object doesn't exist or isn't a blob.
|
|
520
|
-
*
|
|
521
|
-
* @param sha - 40-character SHA-1 hash
|
|
522
|
-
* @returns Typed BlobObject or null
|
|
523
|
-
*
|
|
524
|
-
* @example
|
|
525
|
-
* ```typescript
|
|
526
|
-
* const blob = await store.getBlobObject(sha)
|
|
527
|
-
* if (blob) {
|
|
528
|
-
* const content = new TextDecoder().decode(blob.data)
|
|
529
|
-
* console.log(content)
|
|
530
|
-
* }
|
|
531
|
-
* ```
|
|
532
|
-
*/
|
|
533
|
-
getBlobObject(sha: string): Promise<BlobObject | null>;
|
|
534
|
-
/**
|
|
535
|
-
* Get a tree object with parsed entries.
|
|
536
|
-
*
|
|
537
|
-
* @description
|
|
538
|
-
* Fetches and parses a tree object, extracting all entries
|
|
539
|
-
* with their modes, names, and SHA references.
|
|
540
|
-
*
|
|
541
|
-
* @param sha - 40-character SHA-1 hash
|
|
542
|
-
* @returns Parsed TreeObject with entries or null
|
|
543
|
-
*
|
|
544
|
-
* @example
|
|
545
|
-
* ```typescript
|
|
546
|
-
* const tree = await store.getTreeObject(sha)
|
|
547
|
-
* if (tree) {
|
|
548
|
-
* for (const entry of tree.entries) {
|
|
549
|
-
* console.log(`${entry.mode} ${entry.name} ${entry.sha}`)
|
|
550
|
-
* }
|
|
551
|
-
* }
|
|
552
|
-
* ```
|
|
553
|
-
*/
|
|
554
|
-
getTreeObject(sha: string): Promise<TreeObject | null>;
|
|
555
|
-
/**
|
|
556
|
-
* Get a commit object with parsed fields.
|
|
557
|
-
*
|
|
558
|
-
* @description
|
|
559
|
-
* Fetches and parses a commit object, extracting tree SHA,
|
|
560
|
-
* parent SHAs, author, committer, and message.
|
|
561
|
-
*
|
|
562
|
-
* @param sha - 40-character SHA-1 hash
|
|
563
|
-
* @returns Parsed CommitObject or null
|
|
564
|
-
*
|
|
565
|
-
* @example
|
|
566
|
-
* ```typescript
|
|
567
|
-
* const commit = await store.getCommitObject(sha)
|
|
568
|
-
* if (commit) {
|
|
569
|
-
* console.log(`Author: ${commit.author.name}`)
|
|
570
|
-
* console.log(`Message: ${commit.message}`)
|
|
571
|
-
* console.log(`Parents: ${commit.parents.length}`)
|
|
572
|
-
* }
|
|
573
|
-
* ```
|
|
574
|
-
*/
|
|
575
|
-
getCommitObject(sha: string): Promise<CommitObject | null>;
|
|
576
|
-
/**
|
|
577
|
-
* Get a tag object with parsed fields.
|
|
578
|
-
*
|
|
579
|
-
* @description
|
|
580
|
-
* Fetches and parses an annotated tag object, extracting
|
|
581
|
-
* the tagged object SHA, object type, tag name, tagger, and message.
|
|
582
|
-
*
|
|
583
|
-
* @param sha - 40-character SHA-1 hash
|
|
584
|
-
* @returns Parsed TagObject or null
|
|
585
|
-
*
|
|
586
|
-
* @example
|
|
587
|
-
* ```typescript
|
|
588
|
-
* const tag = await store.getTagObject(sha)
|
|
589
|
-
* if (tag) {
|
|
590
|
-
* console.log(`Tag: ${tag.name}`)
|
|
591
|
-
* console.log(`Points to: ${tag.object} (${tag.objectType})`)
|
|
592
|
-
* console.log(`Tagger: ${tag.tagger?.name}`)
|
|
593
|
-
* }
|
|
594
|
-
* ```
|
|
595
|
-
*/
|
|
596
|
-
getTagObject(sha: string): Promise<TagObject | null>;
|
|
597
|
-
/**
|
|
598
|
-
* Get raw serialized object with Git header.
|
|
599
|
-
*
|
|
600
|
-
* @description
|
|
601
|
-
* Returns the complete Git object format including header:
|
|
602
|
-
* "{type} {size}\0{content}"
|
|
603
|
-
*
|
|
604
|
-
* This is the format used for hashing and storage in pack files.
|
|
605
|
-
*
|
|
606
|
-
* @param sha - 40-character SHA-1 hash
|
|
607
|
-
* @returns Complete object with Git header or null
|
|
608
|
-
*
|
|
609
|
-
* @example
|
|
610
|
-
* ```typescript
|
|
611
|
-
* const raw = await store.getRawObject(sha)
|
|
612
|
-
* if (raw) {
|
|
613
|
-
* // Can be written directly to a pack file or loose object
|
|
614
|
-
* }
|
|
615
|
-
* ```
|
|
616
|
-
*/
|
|
617
|
-
getRawObject(sha: string): Promise<Uint8Array | null>;
|
|
618
|
-
/**
|
|
619
|
-
* Log operation to WAL.
|
|
620
|
-
*
|
|
621
|
-
* @description
|
|
622
|
-
* Writes an operation entry to the write-ahead log for durability.
|
|
623
|
-
* The WAL ensures operations can be recovered after crashes.
|
|
624
|
-
*
|
|
625
|
-
* @param operation - Operation type ('PUT', 'DELETE', etc.)
|
|
626
|
-
* @param sha - Object SHA being operated on
|
|
627
|
-
* @param type - Object type
|
|
628
|
-
* @param _data - Object data (not stored in WAL, just for signature compatibility)
|
|
629
|
-
* @internal
|
|
630
|
-
*/
|
|
631
|
-
private logToWAL;
|
|
632
|
-
}
|
|
633
|
-
//# sourceMappingURL=object-store.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"object-store.d.ts","sourceRoot":"","sources":["../../src/durable-object/object-store.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAA;AAC/C,OAAO,EAAY,UAAU,EAAE,MAAM,sBAAsB,CAAA;AAC3D,OAAO,EACL,UAAU,EACV,UAAU,EACV,UAAU,EACV,YAAY,EACZ,SAAS,EACT,SAAS,EACT,MAAM,EAIP,MAAM,kBAAkB,CAAA;AAEzB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAMxD;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,WAAW,YAAY;IAC3B,4CAA4C;IAC5C,GAAG,EAAE,MAAM,CAAA;IACX,sDAAsD;IACtD,IAAI,EAAE,UAAU,CAAA;IAChB,gCAAgC;IAChC,IAAI,EAAE,MAAM,CAAA;IACZ,8CAA8C;IAC9C,IAAI,EAAE,UAAU,CAAA;IAChB,4DAA4D;IAC5D,SAAS,EAAE,MAAM,CAAA;CAClB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,WAAW,kBAAkB;IACjC;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAA;IAEtB;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAA;IAEtB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAA;IAEjB;;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