@hold-baby/bucket-db 0.3.0 → 0.3.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.
- package/README.md +234 -19
- package/dist/cache/lru-cache.d.ts +47 -0
- package/dist/cache/lru-cache.d.ts.map +1 -0
- package/dist/cache/lru-cache.js +110 -0
- package/dist/cache/lru-cache.js.map +1 -0
- package/dist/core/bucket-db.d.ts +20 -0
- package/dist/core/bucket-db.d.ts.map +1 -0
- package/dist/core/bucket-db.js +32 -0
- package/dist/core/bucket-db.js.map +1 -0
- package/dist/core/collection.d.ts +26 -0
- package/dist/core/collection.d.ts.map +1 -0
- package/dist/core/collection.js +213 -0
- package/dist/core/collection.js.map +1 -0
- package/dist/core/wal.d.ts +45 -0
- package/dist/core/wal.d.ts.map +1 -0
- package/dist/core/wal.js +80 -0
- package/dist/core/wal.js.map +1 -0
- package/dist/index/shard-manager.d.ts +36 -0
- package/dist/index/shard-manager.d.ts.map +1 -0
- package/dist/index/shard-manager.js +177 -0
- package/dist/index/shard-manager.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -0
- package/dist/query/evaluator.d.ts +10 -0
- package/dist/query/evaluator.d.ts.map +1 -0
- package/dist/query/evaluator.js +127 -0
- package/dist/query/evaluator.js.map +1 -0
- package/dist/storage/fs-adapter.d.ts +24 -0
- package/dist/storage/fs-adapter.d.ts.map +1 -0
- package/dist/storage/fs-adapter.js +208 -0
- package/dist/storage/fs-adapter.js.map +1 -0
- package/dist/storage/memory-adapter.d.ts +22 -0
- package/dist/storage/memory-adapter.d.ts.map +1 -0
- package/dist/storage/memory-adapter.js +78 -0
- package/dist/storage/memory-adapter.js.map +1 -0
- package/dist/storage/oss-adapter.d.ts +26 -0
- package/dist/storage/oss-adapter.d.ts.map +1 -0
- package/dist/storage/oss-adapter.js +145 -0
- package/dist/storage/oss-adapter.js.map +1 -0
- package/dist/storage/s3-adapter.d.ts +26 -0
- package/dist/storage/s3-adapter.d.ts.map +1 -0
- package/dist/storage/s3-adapter.js +170 -0
- package/dist/storage/s3-adapter.js.map +1 -0
- package/dist/types/collection.d.ts +40 -0
- package/dist/types/collection.d.ts.map +1 -0
- package/dist/types/collection.js +2 -0
- package/dist/types/collection.js.map +1 -0
- package/{src/types/document.ts → dist/types/document.d.ts} +6 -10
- package/dist/types/document.d.ts.map +1 -0
- package/dist/types/document.js +2 -0
- package/dist/types/document.js.map +1 -0
- package/dist/types/errors.d.ts +32 -0
- package/dist/types/errors.d.ts.map +1 -0
- package/dist/types/errors.js +48 -0
- package/dist/types/errors.js.map +1 -0
- package/dist/types/index.d.ts +6 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +3 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/query.d.ts +37 -0
- package/dist/types/query.d.ts.map +1 -0
- package/dist/types/query.js +2 -0
- package/dist/types/query.js.map +1 -0
- package/dist/types/storage.d.ts +45 -0
- package/dist/types/storage.d.ts.map +1 -0
- package/dist/types/storage.js +2 -0
- package/dist/types/storage.js.map +1 -0
- package/dist/utils/hash.d.ts +13 -0
- package/dist/utils/hash.d.ts.map +1 -0
- package/dist/utils/hash.js +23 -0
- package/dist/utils/hash.js.map +1 -0
- package/dist/utils/path-validator.d.ts +46 -0
- package/dist/utils/path-validator.d.ts.map +1 -0
- package/dist/utils/path-validator.js +99 -0
- package/dist/utils/path-validator.js.map +1 -0
- package/llms.txt +46 -0
- package/package.json +14 -3
- package/src/cache/lru-cache.ts +0 -131
- package/src/core/bucket-db.ts +0 -47
- package/src/core/collection.ts +0 -278
- package/src/core/wal.ts +0 -106
- package/src/index/shard-manager.ts +0 -197
- package/src/index.ts +0 -37
- package/src/query/evaluator.ts +0 -143
- package/src/storage/ali-oss.d.ts +0 -43
- package/src/storage/fs-adapter.ts +0 -248
- package/src/storage/memory-adapter.ts +0 -105
- package/src/storage/oss-adapter.ts +0 -164
- package/src/storage/s3-adapter.ts +0 -200
- package/src/types/collection.ts +0 -43
- package/src/types/errors.ts +0 -49
- package/src/types/index.ts +0 -37
- package/src/types/query.ts +0 -50
- package/src/types/storage.ts +0 -46
- package/src/utils/hash.ts +0 -24
- package/src/utils/path-validator.ts +0 -119
- package/tests/core/bucket-db.test.d.ts +0 -2
- package/tests/core/bucket-db.test.d.ts.map +0 -1
- package/tests/core/bucket-db.test.js +0 -34
- package/tests/core/bucket-db.test.js.map +0 -1
- package/tests/core/bucket-db.test.ts +0 -50
- package/tests/core/collection.test.d.ts +0 -2
- package/tests/core/collection.test.d.ts.map +0 -1
- package/tests/core/collection.test.js +0 -148
- package/tests/core/collection.test.js.map +0 -1
- package/tests/core/collection.test.ts +0 -195
- package/tests/core/dbpath.test.ts +0 -52
- package/tests/index/shard-manager.test.d.ts +0 -2
- package/tests/index/shard-manager.test.d.ts.map +0 -1
- package/tests/index/shard-manager.test.js +0 -106
- package/tests/index/shard-manager.test.js.map +0 -1
- package/tests/index/shard-manager.test.ts +0 -129
- package/tests/query/evaluator.test.d.ts +0 -2
- package/tests/query/evaluator.test.d.ts.map +0 -1
- package/tests/query/evaluator.test.js +0 -87
- package/tests/query/evaluator.test.js.map +0 -1
- package/tests/query/evaluator.test.ts +0 -104
- package/tests/storage/fs-adapter.test.ts +0 -111
- package/tests/storage/memory-adapter.test.d.ts +0 -2
- package/tests/storage/memory-adapter.test.d.ts.map +0 -1
- package/tests/storage/memory-adapter.test.js +0 -65
- package/tests/storage/memory-adapter.test.js.map +0 -1
- package/tests/storage/memory-adapter.test.ts +0 -84
- package/tests/storage/oss-adapter.test.d.ts +0 -2
- package/tests/storage/oss-adapter.test.d.ts.map +0 -1
- package/tests/storage/oss-adapter.test.js +0 -34
- package/tests/storage/oss-adapter.test.js.map +0 -1
- package/tests/storage/oss-adapter.test.ts +0 -40
- package/tests/storage/s3-adapter.test.d.ts +0 -2
- package/tests/storage/s3-adapter.test.d.ts.map +0 -1
- package/tests/storage/s3-adapter.test.js +0 -51
- package/tests/storage/s3-adapter.test.js.map +0 -1
- package/tests/storage/s3-adapter.test.ts +0 -62
- package/tests/utils/hash.test.d.ts +0 -2
- package/tests/utils/hash.test.d.ts.map +0 -1
- package/tests/utils/hash.test.js +0 -36
- package/tests/utils/hash.test.js.map +0 -1
- package/tests/utils/hash.test.ts +0 -42
- package/tsconfig.json +0 -12
package/src/types/collection.ts
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import type { Document, InsertDocument, UpdateDocument } from './document.js';
|
|
2
|
-
import type { QueryFilter, QueryOptions, UpdateOptions } from './query.js';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Collection interface for type-safe CRUD operations
|
|
6
|
-
*/
|
|
7
|
-
export interface ICollection<T extends Document> {
|
|
8
|
-
insert(data: InsertDocument<T>): Promise<T>;
|
|
9
|
-
findById(id: string): Promise<T | null>;
|
|
10
|
-
find(filter: QueryFilter<T>, options?: QueryOptions): Promise<T[]>;
|
|
11
|
-
update(id: string, data: UpdateDocument<T>, options?: UpdateOptions): Promise<T>;
|
|
12
|
-
delete(id: string): Promise<void>;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Collection metadata
|
|
17
|
-
*/
|
|
18
|
-
export interface CollectionMeta {
|
|
19
|
-
name: string;
|
|
20
|
-
version: number;
|
|
21
|
-
indexShardCount: number;
|
|
22
|
-
indexedFields: string[];
|
|
23
|
-
createdAt: string;
|
|
24
|
-
documentCount: number;
|
|
25
|
-
lastUpdated: string;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Index shard structure
|
|
30
|
-
*/
|
|
31
|
-
export interface IndexShard {
|
|
32
|
-
shardId: string;
|
|
33
|
-
documents: Record<string, any>;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* Shard metadata for performance optimization
|
|
38
|
-
*/
|
|
39
|
-
export interface ShardMetadata {
|
|
40
|
-
shardId: string;
|
|
41
|
-
docCount: number;
|
|
42
|
-
lastUpdated: string;
|
|
43
|
-
}
|
package/src/types/errors.ts
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Base error class for BucketDB
|
|
3
|
-
*/
|
|
4
|
-
export class BucketDBError extends Error {
|
|
5
|
-
constructor(message: string) {
|
|
6
|
-
super(message);
|
|
7
|
-
this.name = 'BucketDBError';
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Document not found error
|
|
13
|
-
*/
|
|
14
|
-
export class DocumentNotFoundError extends BucketDBError {
|
|
15
|
-
constructor(id: string) {
|
|
16
|
-
super(`Document not found: ${id}`);
|
|
17
|
-
this.name = 'DocumentNotFoundError';
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Concurrent update conflict error
|
|
23
|
-
*/
|
|
24
|
-
export class ConcurrentUpdateError extends BucketDBError {
|
|
25
|
-
constructor(message: string = 'Concurrent update conflict, please retry') {
|
|
26
|
-
super(message);
|
|
27
|
-
this.name = 'ConcurrentUpdateError';
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Validation error
|
|
33
|
-
*/
|
|
34
|
-
export class ValidationError extends BucketDBError {
|
|
35
|
-
constructor(message: string) {
|
|
36
|
-
super(message);
|
|
37
|
-
this.name = 'ValidationError';
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Storage error
|
|
43
|
-
*/
|
|
44
|
-
export class StorageError extends BucketDBError {
|
|
45
|
-
constructor(message: string, public readonly cause?: Error) {
|
|
46
|
-
super(message);
|
|
47
|
-
this.name = 'StorageError';
|
|
48
|
-
}
|
|
49
|
-
}
|
package/src/types/index.ts
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
// Document types
|
|
2
|
-
export type { Document, InsertDocument, UpdateDocument } from './document.js';
|
|
3
|
-
|
|
4
|
-
// Query types
|
|
5
|
-
export type {
|
|
6
|
-
QueryOperator,
|
|
7
|
-
QueryValue,
|
|
8
|
-
QueryFilter,
|
|
9
|
-
QueryOptions,
|
|
10
|
-
UpdateOptions,
|
|
11
|
-
} from './query.js';
|
|
12
|
-
|
|
13
|
-
// Storage types
|
|
14
|
-
export type {
|
|
15
|
-
StorageObject,
|
|
16
|
-
PutOptions,
|
|
17
|
-
StorageAdapter,
|
|
18
|
-
StorageCredentials,
|
|
19
|
-
StorageAdapterConfig,
|
|
20
|
-
} from './storage.js';
|
|
21
|
-
|
|
22
|
-
// Collection types
|
|
23
|
-
export type {
|
|
24
|
-
ICollection,
|
|
25
|
-
CollectionMeta,
|
|
26
|
-
IndexShard,
|
|
27
|
-
ShardMetadata,
|
|
28
|
-
} from './collection.js';
|
|
29
|
-
|
|
30
|
-
// Error classes
|
|
31
|
-
export {
|
|
32
|
-
BucketDBError,
|
|
33
|
-
DocumentNotFoundError,
|
|
34
|
-
ConcurrentUpdateError,
|
|
35
|
-
ValidationError,
|
|
36
|
-
StorageError,
|
|
37
|
-
} from './errors.js';
|
package/src/types/query.ts
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Supported query operators
|
|
3
|
-
*/
|
|
4
|
-
export type QueryOperator =
|
|
5
|
-
| '$eq'
|
|
6
|
-
| '$ne'
|
|
7
|
-
| '$gt'
|
|
8
|
-
| '$gte'
|
|
9
|
-
| '$lt'
|
|
10
|
-
| '$lte'
|
|
11
|
-
| '$in'
|
|
12
|
-
| '$nin';
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Query value can be direct value or operator object
|
|
16
|
-
*/
|
|
17
|
-
export type QueryValue<T> =
|
|
18
|
-
| T
|
|
19
|
-
| {
|
|
20
|
-
$eq?: T;
|
|
21
|
-
$ne?: T;
|
|
22
|
-
$gt?: T;
|
|
23
|
-
$gte?: T;
|
|
24
|
-
$lt?: T;
|
|
25
|
-
$lte?: T;
|
|
26
|
-
$in?: T[];
|
|
27
|
-
$nin?: T[];
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Query filter for type-safe queries
|
|
32
|
-
*/
|
|
33
|
-
export type QueryFilter<T> = {
|
|
34
|
-
[K in keyof T]?: QueryValue<T[K]>;
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Query options for pagination and sorting
|
|
39
|
-
*/
|
|
40
|
-
export interface QueryOptions {
|
|
41
|
-
limit?: number;
|
|
42
|
-
offset?: number;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Update options with optimistic locking
|
|
47
|
-
*/
|
|
48
|
-
export interface UpdateOptions {
|
|
49
|
-
etag?: string;
|
|
50
|
-
}
|
package/src/types/storage.ts
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Storage object returned by adapter
|
|
3
|
-
*/
|
|
4
|
-
export interface StorageObject {
|
|
5
|
-
data: any;
|
|
6
|
-
etag: string;
|
|
7
|
-
lastModified: Date;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Put options for conditional writes
|
|
12
|
-
*/
|
|
13
|
-
export interface PutOptions {
|
|
14
|
-
ifMatch?: string;
|
|
15
|
-
ifNoneMatch?: string;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Storage adapter interface (abstraction for S3/OSS)
|
|
20
|
-
*/
|
|
21
|
-
export interface StorageAdapter {
|
|
22
|
-
get(key: string): Promise<StorageObject>;
|
|
23
|
-
put(key: string, data: any, options?: PutOptions): Promise<{ etag: string }>;
|
|
24
|
-
delete(key: string): Promise<void>;
|
|
25
|
-
exists(key: string): Promise<boolean>;
|
|
26
|
-
listKeys(prefix: string): Promise<string[]>;
|
|
27
|
-
batchGet(keys: string[]): Promise<Map<string, StorageObject>>;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Storage credentials
|
|
32
|
-
*/
|
|
33
|
-
export interface StorageCredentials {
|
|
34
|
-
accessKeyId: string;
|
|
35
|
-
secretAccessKey: string;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Storage adapter configuration
|
|
40
|
-
*/
|
|
41
|
-
export interface StorageAdapterConfig {
|
|
42
|
-
bucket: string;
|
|
43
|
-
region: string;
|
|
44
|
-
credentials: StorageCredentials;
|
|
45
|
-
endpoint?: string;
|
|
46
|
-
}
|
package/src/utils/hash.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Simple string hash function (DJB2 algorithm)
|
|
3
|
-
*/
|
|
4
|
-
export function hashString(str: string): number {
|
|
5
|
-
let hash = 5381;
|
|
6
|
-
for (let i = 0; i < str.length; i++) {
|
|
7
|
-
hash = (hash * 33) ^ str.charCodeAt(i);
|
|
8
|
-
}
|
|
9
|
-
return hash >>> 0; // Convert to unsigned 32-bit integer
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Get shard ID for a document ID
|
|
14
|
-
*/
|
|
15
|
-
export function getShardId(docId: string, shardCount: number): number {
|
|
16
|
-
return hashString(docId) % shardCount;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Format shard ID as zero-padded string (e.g., "00", "01", "15")
|
|
21
|
-
*/
|
|
22
|
-
export function formatShardId(shardId: number): string {
|
|
23
|
-
return shardId.toString().padStart(2, '0');
|
|
24
|
-
}
|
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
import { join, resolve, relative } from 'path';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* ValidationError for path validation failures
|
|
5
|
-
*/
|
|
6
|
-
export class PathValidationError extends Error {
|
|
7
|
-
constructor(message: string) {
|
|
8
|
-
super(message);
|
|
9
|
-
this.name = 'PathValidationError';
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Sanitize and validate path components to prevent directory traversal attacks
|
|
15
|
-
* This is for SINGLE path components (like collection names, document IDs)
|
|
16
|
-
*
|
|
17
|
-
* @param input - Path component to sanitize
|
|
18
|
-
* @returns Sanitized path component
|
|
19
|
-
* @throws PathValidationError if validation fails
|
|
20
|
-
*/
|
|
21
|
-
export function sanitizePathComponent(input: string): string {
|
|
22
|
-
if (!input || typeof input !== 'string') {
|
|
23
|
-
throw new PathValidationError('Path component must be a non-empty string');
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
// Remove any path traversal sequences
|
|
27
|
-
let sanitized = input.replace(/\.\./g, '');
|
|
28
|
-
|
|
29
|
-
// Remove directory separators (single components cannot have slashes)
|
|
30
|
-
sanitized = sanitized.replace(/[\/\\]/g, '_');
|
|
31
|
-
|
|
32
|
-
// Only allow alphanumeric, underscore, hyphen, and dot
|
|
33
|
-
if (!/^[a-zA-Z0-9_.-]+$/.test(sanitized)) {
|
|
34
|
-
throw new PathValidationError(
|
|
35
|
-
`Invalid characters in path component. Only alphanumeric, underscore, hyphen, and dot are allowed.`
|
|
36
|
-
);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
// Prevent excessively long names
|
|
40
|
-
if (sanitized.length > 255) {
|
|
41
|
-
throw new PathValidationError('Path component exceeds maximum length of 255 characters');
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
// Prevent hidden files (starting with .)
|
|
45
|
-
if (sanitized.startsWith('.')) {
|
|
46
|
-
throw new PathValidationError('Path component cannot start with a dot');
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
return sanitized;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* Validate that a target path is within the allowed base path
|
|
54
|
-
* Prevents directory traversal attacks by ensuring the resolved path
|
|
55
|
-
* doesn't escape the base directory
|
|
56
|
-
*
|
|
57
|
-
* @param basePath - Base directory path
|
|
58
|
-
* @param targetPath - Target path to validate
|
|
59
|
-
* @throws PathValidationError if path escapes base directory
|
|
60
|
-
*/
|
|
61
|
-
export function validatePathWithinBase(basePath: string, targetPath: string): void {
|
|
62
|
-
const normalizedBase = resolve(basePath);
|
|
63
|
-
const normalizedTarget = resolve(targetPath);
|
|
64
|
-
|
|
65
|
-
const relativePath = relative(normalizedBase, normalizedTarget);
|
|
66
|
-
|
|
67
|
-
// If relative path starts with '..', it's outside the base directory
|
|
68
|
-
if (relativePath.startsWith('..') || resolve(normalizedBase, relativePath) !== normalizedTarget) {
|
|
69
|
-
throw new PathValidationError('Path traversal detected: target path is outside base directory');
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* Safely join path components with validation
|
|
75
|
-
* This is for joining SINGLE components (not full paths with slashes)
|
|
76
|
-
*
|
|
77
|
-
* @param basePath - Base directory path
|
|
78
|
-
* @param components - Path components to join
|
|
79
|
-
* @returns Validated full path
|
|
80
|
-
* @throws PathValidationError if validation fails
|
|
81
|
-
*/
|
|
82
|
-
export function safePathJoin(basePath: string, ...components: string[]): string {
|
|
83
|
-
// Sanitize each component
|
|
84
|
-
const sanitizedComponents = components.map(sanitizePathComponent);
|
|
85
|
-
|
|
86
|
-
// Join paths
|
|
87
|
-
const fullPath = join(basePath, ...sanitizedComponents);
|
|
88
|
-
|
|
89
|
-
// Validate the result doesn't escape base path
|
|
90
|
-
validatePathWithinBase(basePath, fullPath);
|
|
91
|
-
|
|
92
|
-
return fullPath;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* Safely join a key (which may contain slashes) with base path
|
|
97
|
-
* Validates the result doesn't escape base directory
|
|
98
|
-
*
|
|
99
|
-
* @param basePath - Base directory path
|
|
100
|
-
* @param key - Storage key (may contain path separators)
|
|
101
|
-
* @returns Validated full path
|
|
102
|
-
* @throws PathValidationError if validation fails
|
|
103
|
-
*/
|
|
104
|
-
export function safeKeyPath(basePath: string, key: string): string {
|
|
105
|
-
if (!key || typeof key !== 'string') {
|
|
106
|
-
throw new PathValidationError('Key must be a non-empty string');
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
// Check for path traversal patterns
|
|
110
|
-
if (key.includes('..')) {
|
|
111
|
-
throw new PathValidationError('Key contains path traversal sequence');
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
// Join and validate
|
|
115
|
-
const fullPath = join(basePath, key);
|
|
116
|
-
validatePathWithinBase(basePath, fullPath);
|
|
117
|
-
|
|
118
|
-
return fullPath;
|
|
119
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"bucket-db.test.d.ts","sourceRoot":"","sources":["bucket-db.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { describe, test, expect } from 'bun:test';
|
|
2
|
-
import { BucketDB } from '../../src/core/bucket-db';
|
|
3
|
-
import { MemoryStorageAdapter } from '../../src/storage/memory-adapter';
|
|
4
|
-
describe('BucketDB', () => {
|
|
5
|
-
test('creates database instance with memory adapter', () => {
|
|
6
|
-
const adapter = new MemoryStorageAdapter();
|
|
7
|
-
const db = new BucketDB(adapter, 'test-db');
|
|
8
|
-
expect(db).toBeDefined();
|
|
9
|
-
});
|
|
10
|
-
test('creates collection', () => {
|
|
11
|
-
const adapter = new MemoryStorageAdapter();
|
|
12
|
-
const db = new BucketDB(adapter, 'test-db');
|
|
13
|
-
const users = db.collection('users');
|
|
14
|
-
expect(users).toBeDefined();
|
|
15
|
-
});
|
|
16
|
-
test('same collection name returns same instance', () => {
|
|
17
|
-
const adapter = new MemoryStorageAdapter();
|
|
18
|
-
const db = new BucketDB(adapter, 'test-db');
|
|
19
|
-
const users1 = db.collection('users');
|
|
20
|
-
const users2 = db.collection('users');
|
|
21
|
-
expect(users1).toBe(users2);
|
|
22
|
-
});
|
|
23
|
-
test('end-to-end: insert and query across collections', async () => {
|
|
24
|
-
const adapter = new MemoryStorageAdapter();
|
|
25
|
-
const db = new BucketDB(adapter, 'test-db');
|
|
26
|
-
const users = db.collection('users');
|
|
27
|
-
await users.insert({ name: 'Alice', email: 'alice@example.com' });
|
|
28
|
-
await users.insert({ name: 'Bob', email: 'bob@example.com' });
|
|
29
|
-
const results = await users.find({ name: 'Alice' });
|
|
30
|
-
expect(results).toHaveLength(1);
|
|
31
|
-
expect(results[0].email).toBe('alice@example.com');
|
|
32
|
-
});
|
|
33
|
-
});
|
|
34
|
-
//# sourceMappingURL=bucket-db.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"bucket-db.test.js","sourceRoot":"","sources":["bucket-db.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AAQxE,QAAQ,CAAC,UAAU,EAAE,GAAG,EAAE;IACxB,IAAI,CAAC,+CAA+C,EAAE,GAAG,EAAE;QACzD,MAAM,OAAO,GAAG,IAAI,oBAAoB,EAAE,CAAC;QAC3C,MAAM,EAAE,GAAG,IAAI,QAAQ,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;QAE5C,MAAM,CAAC,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC;IAC3B,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,oBAAoB,EAAE,GAAG,EAAE;QAC9B,MAAM,OAAO,GAAG,IAAI,oBAAoB,EAAE,CAAC;QAC3C,MAAM,EAAE,GAAG,IAAI,QAAQ,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;QAE5C,MAAM,KAAK,GAAG,EAAE,CAAC,UAAU,CAAO,OAAO,CAAC,CAAC;QAC3C,MAAM,CAAC,KAAK,CAAC,CAAC,WA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|
1
|
-
import { describe, test, expect } from 'bun:test';
|
|
2
|
-
import { BucketDB } from '../../src/core/bucket-db';
|
|
3
|
-
import { MemoryStorageAdapter } from '../../src/storage/memory-adapter';
|
|
4
|
-
import type { Document } from '../../src/index.js';
|
|
5
|
-
|
|
6
|
-
interface User extends Document {
|
|
7
|
-
name: string;
|
|
8
|
-
email: string;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
describe('BucketDB', () => {
|
|
12
|
-
test('creates database instance with memory adapter', () => {
|
|
13
|
-
const adapter = new MemoryStorageAdapter();
|
|
14
|
-
const db = new BucketDB(adapter, 'test-db');
|
|
15
|
-
|
|
16
|
-
expect(db).toBeDefined();
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
test('creates collection', () => {
|
|
20
|
-
const adapter = new MemoryStorageAdapter();
|
|
21
|
-
const db = new BucketDB(adapter, 'test-db');
|
|
22
|
-
|
|
23
|
-
const users = db.collection<User>('users');
|
|
24
|
-
expect(users).toBeDefined();
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
test('same collection name returns same instance', () => {
|
|
28
|
-
const adapter = new MemoryStorageAdapter();
|
|
29
|
-
const db = new BucketDB(adapter, 'test-db');
|
|
30
|
-
|
|
31
|
-
const users1 = db.collection<User>('users');
|
|
32
|
-
const users2 = db.collection<User>('users');
|
|
33
|
-
|
|
34
|
-
expect(users1).toBe(users2);
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
test('end-to-end: insert and query across collections', async () => {
|
|
38
|
-
const adapter = new MemoryStorageAdapter();
|
|
39
|
-
const db = new BucketDB(adapter, 'test-db');
|
|
40
|
-
|
|
41
|
-
const users = db.collection<User>('users');
|
|
42
|
-
|
|
43
|
-
await users.insert({ name: 'Alice', email: 'alice@example.com' });
|
|
44
|
-
await users.insert({ name: 'Bob', email: 'bob@example.com' });
|
|
45
|
-
|
|
46
|
-
const results = await users.find({ name: 'Alice' });
|
|
47
|
-
expect(results).toHaveLength(1);
|
|
48
|
-
expect(results[0].email).toBe('alice@example.com');
|
|
49
|
-
});
|
|
50
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"collection.test.d.ts","sourceRoot":"","sources":["collection.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
import { describe, test, expect, beforeEach } from 'bun:test';
|
|
2
|
-
import { Collection } from '../../src/core/collection';
|
|
3
|
-
import { MemoryStorageAdapter } from '../../src/storage/memory-adapter';
|
|
4
|
-
import { DocumentNotFoundError, ConcurrentUpdateError } from '../../src/index.js';
|
|
5
|
-
describe('Collection', () => {
|
|
6
|
-
let adapter;
|
|
7
|
-
let collection;
|
|
8
|
-
beforeEach(() => {
|
|
9
|
-
adapter = new MemoryStorageAdapter();
|
|
10
|
-
collection = new Collection(adapter, 'test-db', 'users', { shardCount: 16 });
|
|
11
|
-
});
|
|
12
|
-
describe('insert', () => {
|
|
13
|
-
test('inserts document with generated ID', async () => {
|
|
14
|
-
const user = await collection.insert({
|
|
15
|
-
name: 'Alice',
|
|
16
|
-
age: 25,
|
|
17
|
-
email: 'alice@example.com',
|
|
18
|
-
status: 'active',
|
|
19
|
-
});
|
|
20
|
-
expect(user.id).toBeDefined();
|
|
21
|
-
expect(user.name).toBe('Alice');
|
|
22
|
-
expect(user.age).toBe(25);
|
|
23
|
-
expect(user._etag).toBeDefined();
|
|
24
|
-
expect(user._createdAt).toBeDefined();
|
|
25
|
-
expect(user._updatedAt).toBeDefined();
|
|
26
|
-
});
|
|
27
|
-
test('inserts multiple documents', async () => {
|
|
28
|
-
const user1 = await collection.insert({ name: 'Alice', age: 25, email: 'alice@example.com', status: 'active' });
|
|
29
|
-
const user2 = await collection.insert({ name: 'Bob', age: 30, email: 'bob@example.com', status: 'active' });
|
|
30
|
-
expect(user1.id).not.toBe(user2.id);
|
|
31
|
-
});
|
|
32
|
-
});
|
|
33
|
-
describe('findById', () => {
|
|
34
|
-
test('finds existing document', async () => {
|
|
35
|
-
const inserted = await collection.insert({
|
|
36
|
-
name: 'Alice',
|
|
37
|
-
age: 25,
|
|
38
|
-
email: 'alice@example.com',
|
|
39
|
-
status: 'active',
|
|
40
|
-
});
|
|
41
|
-
const found = await collection.findById(inserted.id);
|
|
42
|
-
expect(found).toEqual(inserted);
|
|
43
|
-
});
|
|
44
|
-
test('returns null for non-existent document', async () => {
|
|
45
|
-
const found = await collection.findById('non-existent');
|
|
46
|
-
expect(found).toBeNull();
|
|
47
|
-
});
|
|
48
|
-
});
|
|
49
|
-
describe('find', () => {
|
|
50
|
-
beforeEach(async () => {
|
|
51
|
-
await collection.insert({ name: 'Alice', age: 25, email: 'alice@example.com', status: 'active' });
|
|
52
|
-
await collection.insert({ name: 'Bob', age: 30, email: 'bob@example.com', status: 'active' });
|
|
53
|
-
await collection.insert({ name: 'Charlie', age: 35, email: 'charlie@example.com', status: 'inactive' });
|
|
54
|
-
});
|
|
55
|
-
test('finds documents by equality filter', async () => {
|
|
56
|
-
const results = await collection.find({ status: 'active' });
|
|
57
|
-
expect(results).toHaveLength(2);
|
|
58
|
-
expect(results.every(r => r.status === 'active')).toBe(true);
|
|
59
|
-
});
|
|
60
|
-
test('finds documents with operator filter', async () => {
|
|
61
|
-
const results = await collection.find({ age: { $gte: 30 } });
|
|
62
|
-
expect(results).toHaveLength(2);
|
|
63
|
-
expect(results.every(r => r.age >= 30)).toBe(true);
|
|
64
|
-
});
|
|
65
|
-
test('finds documents with multiple conditions', async () => {
|
|
66
|
-
const results = await collection.find({
|
|
67
|
-
status: 'active',
|
|
68
|
-
age: { $gte: 25, $lt: 35 },
|
|
69
|
-
});
|
|
70
|
-
expect(results).toHaveLength(2);
|
|
71
|
-
});
|
|
72
|
-
test('returns empty array when no matches', async () => {
|
|
73
|
-
const results = await collection.find({ name: 'David' });
|
|
74
|
-
expect(results).toHaveLength(0);
|
|
75
|
-
});
|
|
76
|
-
test('applies limit option', async () => {
|
|
77
|
-
const results = await collection.find({ status: 'active' }, { limit: 1 });
|
|
78
|
-
expect(results).toHaveLength(1);
|
|
79
|
-
});
|
|
80
|
-
test('applies offset option', async () => {
|
|
81
|
-
const all = await collection.find({ status: 'active' });
|
|
82
|
-
const withOffset = await collection.find({ status: 'active' }, { offset: 1 });
|
|
83
|
-
expect(withOffset).toHaveLength(1);
|
|
84
|
-
expect(withOffset[0].id).toBe(all[1].id);
|
|
85
|
-
});
|
|
86
|
-
test('applies limit and offset together', async () => {
|
|
87
|
-
const results = await collection.find({}, { limit: 1, offset: 1 });
|
|
88
|
-
expect(results).toHaveLength(1);
|
|
89
|
-
});
|
|
90
|
-
});
|
|
91
|
-
describe('update', () => {
|
|
92
|
-
test('updates existing document', async () => {
|
|
93
|
-
const user = await collection.insert({
|
|
94
|
-
name: 'Alice',
|
|
95
|
-
age: 25,
|
|
96
|
-
email: 'alice@example.com',
|
|
97
|
-
status: 'active',
|
|
98
|
-
});
|
|
99
|
-
// Wait 1ms to ensure different timestamp
|
|
100
|
-
await new Promise(resolve => setTimeout(resolve, 1));
|
|
101
|
-
const updated = await collection.update(user.id, { age: 26 });
|
|
102
|
-
expect(updated.id).toBe(user.id);
|
|
103
|
-
expect(updated.age).toBe(26);
|
|
104
|
-
expect(updated.name).toBe('Alice');
|
|
105
|
-
expect(updated._etag).not.toBe(user._etag);
|
|
106
|
-
expect(updated._updatedAt).not.toBe(user._updatedAt);
|
|
107
|
-
});
|
|
108
|
-
test('throws error when document not found', async () => {
|
|
109
|
-
await expect(collection.update('non-existent', { age: 30 })).rejects.toThrow(DocumentNotFoundError);
|
|
110
|
-
});
|
|
111
|
-
test('optimistic locking with correct etag', async () => {
|
|
112
|
-
const user = await collection.insert({
|
|
113
|
-
name: 'Alice',
|
|
114
|
-
age: 25,
|
|
115
|
-
email: 'alice@example.com',
|
|
116
|
-
status: 'active',
|
|
117
|
-
});
|
|
118
|
-
const updated = await collection.update(user.id, { age: 26 }, { etag: user._etag });
|
|
119
|
-
expect(updated.age).toBe(26);
|
|
120
|
-
});
|
|
121
|
-
test('optimistic locking fails with wrong etag', async () => {
|
|
122
|
-
const user = await collection.insert({
|
|
123
|
-
name: 'Alice',
|
|
124
|
-
age: 25,
|
|
125
|
-
email: 'alice@example.com',
|
|
126
|
-
status: 'active',
|
|
127
|
-
});
|
|
128
|
-
await expect(collection.update(user.id, { age: 26 }, { etag: 'wrong-etag' })).rejects.toThrow(ConcurrentUpdateError);
|
|
129
|
-
});
|
|
130
|
-
});
|
|
131
|
-
describe('delete', () => {
|
|
132
|
-
test('deletes existing document', async () => {
|
|
133
|
-
const user = await collection.insert({
|
|
134
|
-
name: 'Alice',
|
|
135
|
-
age: 25,
|
|
136
|
-
email: 'alice@example.com',
|
|
137
|
-
status: 'active',
|
|
138
|
-
});
|
|
139
|
-
await collection.delete(user.id);
|
|
140
|
-
const found = await collection.findById(user.id);
|
|
141
|
-
expect(found).toBeNull();
|
|
142
|
-
});
|
|
143
|
-
test('throws error when document not found', async () => {
|
|
144
|
-
await expect(collection.delete('non-existent')).rejects.toThrow(DocumentNotFoundError);
|
|
145
|
-
});
|
|
146
|
-
});
|
|
147
|
-
});
|
|
148
|
-
//# sourceMappingURL=collection.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"collection.test.js","sourceRoot":"","sources":["collection.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AAExE,OAAO,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAShF,QAAQ,CAAC,YAAY,EAAE,GAAG,EAAE;IAC1B,IAAI,OAA6B,CAAC;IAClC,IAAI,UAA4B,CAAC;IAEjC,UAAU,CAAC,GAAG,EAAE;QACd,OAAO,GAAG,IAAI,oBAAoB,EAAE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