fastdb4ts 0.0.2 → 0.0.3
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 +6 -7
- package/dist/call-db.d.ts +117 -0
- package/dist/call-db.js +1857 -0
- package/dist/column.d.ts +1 -0
- package/dist/column.js +35 -1
- package/dist/database-buffer.d.ts +20 -0
- package/dist/database-buffer.js +101 -0
- package/dist/feature.d.ts +1 -1
- package/dist/feature.js +46 -5
- package/dist/index.d.ts +4 -0
- package/dist/index.js +2 -0
- package/dist/orm.d.ts +4 -1
- package/dist/orm.js +128 -26
- package/dist/serializer.d.ts +2 -1
- package/dist/serializer.js +4 -4
- package/dist/table.js +3 -0
- package/dist/types.d.ts +1 -0
- package/dist/types.js +31 -0
- package/dist/wasm/fastdb4ts.js +1 -1
- package/dist/wasm/fastdb4ts.wasm +0 -0
- package/dist/wasm-loader.d.ts +12 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Browser-oriented TypeScript bindings for `fastdb`, powered by WebAssembly.
|
|
4
4
|
|
|
5
|
-
`fastdb4ts` brings the `fastdb` storage model to TypeScript with a browser-first API centered around typed schemas, structured table access, binary buffer transport
|
|
5
|
+
`fastdb4ts` brings the `fastdb` storage model to TypeScript with a browser-first API centered around typed schemas, structured table access, and binary buffer transport.
|
|
6
6
|
|
|
7
7
|
## What this package provides
|
|
8
8
|
|
|
@@ -12,8 +12,8 @@ Browser-oriented TypeScript bindings for `fastdb`, powered by WebAssembly.
|
|
|
12
12
|
- use `ORM`, `TableDefn`, `Table`, and column accessors
|
|
13
13
|
- **Binary buffer roundtrips**
|
|
14
14
|
- import/export databases as `Uint8Array` / `ArrayBuffer`
|
|
15
|
-
- **
|
|
16
|
-
-
|
|
15
|
+
- **Legacy graph serialization**
|
|
16
|
+
- `FastSerializer` remains available for existing nested-feature and cyclic-reference users, but new cross-runtime provider work should use neutral schema descriptors and explicit codec profiles
|
|
17
17
|
- **Shared native semantics**
|
|
18
18
|
- backed by the same C++ core as `fastdb4py`
|
|
19
19
|
|
|
@@ -26,7 +26,7 @@ Included:
|
|
|
26
26
|
- browser-first WASM runtime
|
|
27
27
|
- `Feature` + `defineSchema(...)`
|
|
28
28
|
- `ORM`, `TableDefn`, `Table`, column access
|
|
29
|
-
- `FastSerializer`
|
|
29
|
+
- `FastSerializer` legacy compatibility APIs
|
|
30
30
|
- `Uint8Array` / `ArrayBuffer` import/export
|
|
31
31
|
|
|
32
32
|
Not included in the current TS package:
|
|
@@ -159,9 +159,9 @@ const copyTable = copy.table(Particle);
|
|
|
159
159
|
console.log(copyTable.get(2).x); // 2.0
|
|
160
160
|
```
|
|
161
161
|
|
|
162
|
-
## FastSerializer
|
|
162
|
+
## FastSerializer Legacy Compatibility
|
|
163
163
|
|
|
164
|
-
`FastSerializer` is the graph-oriented layer for feature graphs that are more naturally represented as nested objects than flat tables.
|
|
164
|
+
`FastSerializer` is the legacy graph-oriented layer for feature graphs that are more naturally represented as nested objects than flat tables. It remains available for compatibility and migration tests, but it is not the foundation for new C-Two provider work.
|
|
165
165
|
|
|
166
166
|
Supported scenarios include:
|
|
167
167
|
|
|
@@ -287,4 +287,3 @@ For fuller project documentation, see:
|
|
|
287
287
|
- TypeScript/WASM binding guide: [`ts/README.md`](../README.md)
|
|
288
288
|
- C++ core guide: [`fastcarto/README.md`](../../fastcarto/README.md)
|
|
289
289
|
- Python binding guide: [`python/README.md`](../../python/README.md)
|
|
290
|
-
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { Feature, type FeatureClass } from './feature.js';
|
|
2
|
+
import { ORM } from './orm.js';
|
|
3
|
+
import { type FastdbDatabaseBytes } from './database-buffer.js';
|
|
4
|
+
import type { StridedColumn } from './column.js';
|
|
5
|
+
import { type FastdbModule, type WxDatabaseHandle } from './wasm-loader.js';
|
|
6
|
+
export interface FastdbFeatureCodecBinding<T extends Feature = Feature> {
|
|
7
|
+
readonly codecId: string;
|
|
8
|
+
readonly profile: string;
|
|
9
|
+
readonly schemaSha256: string;
|
|
10
|
+
readonly feature: FeatureClass<T>;
|
|
11
|
+
}
|
|
12
|
+
export interface FastdbCallDbScalarField {
|
|
13
|
+
readonly name: string;
|
|
14
|
+
readonly kind: string;
|
|
15
|
+
readonly parameter?: string;
|
|
16
|
+
readonly valuePosition: number;
|
|
17
|
+
}
|
|
18
|
+
export interface FastdbCallDbArrayItem {
|
|
19
|
+
readonly name: string;
|
|
20
|
+
readonly kind: string;
|
|
21
|
+
}
|
|
22
|
+
export interface FastdbCallDbFeatureDependency {
|
|
23
|
+
readonly feature: FeatureClass;
|
|
24
|
+
readonly featureSchemaSha256: string;
|
|
25
|
+
}
|
|
26
|
+
export interface FastdbCallDbTable {
|
|
27
|
+
readonly name: string;
|
|
28
|
+
readonly kind: 'scalars' | 'array' | 'feature';
|
|
29
|
+
readonly cardinality: string;
|
|
30
|
+
readonly feature?: FeatureClass;
|
|
31
|
+
readonly featureSchemaSha256?: string;
|
|
32
|
+
readonly featureDependencies?: readonly FastdbCallDbFeatureDependency[];
|
|
33
|
+
readonly parameter?: string;
|
|
34
|
+
readonly returnIndex?: number;
|
|
35
|
+
readonly valuePosition?: number;
|
|
36
|
+
readonly fields?: readonly FastdbCallDbScalarField[];
|
|
37
|
+
readonly item?: FastdbCallDbArrayItem;
|
|
38
|
+
}
|
|
39
|
+
export interface FastdbCallDbBinding {
|
|
40
|
+
readonly codecId: string;
|
|
41
|
+
readonly profile: string;
|
|
42
|
+
readonly schemaSha256: string;
|
|
43
|
+
readonly method: string;
|
|
44
|
+
readonly direction: 'input' | 'output';
|
|
45
|
+
readonly tables: readonly FastdbCallDbTable[];
|
|
46
|
+
}
|
|
47
|
+
export declare function encodeFastdbFeature<T extends Feature>(binding: FastdbFeatureCodecBinding<T>, value: T): Uint8Array;
|
|
48
|
+
export declare function decodeFastdbFeature<T extends Feature>(binding: FastdbFeatureCodecBinding<T>, payload: FastdbDatabaseBytes): T;
|
|
49
|
+
export declare function encodeFastdbCallDb(binding: FastdbCallDbBinding, value: unknown): Uint8Array;
|
|
50
|
+
export declare function decodeFastdbCallDb(binding: FastdbCallDbBinding, payload: FastdbDatabaseBytes): unknown;
|
|
51
|
+
export declare function viewFastdbCallDb(binding: FastdbCallDbBinding, payload: FastdbDatabaseBytes): FastdbCallDbView;
|
|
52
|
+
export declare class FastdbCallDbView {
|
|
53
|
+
readonly binding: FastdbCallDbBinding;
|
|
54
|
+
private readonly storage;
|
|
55
|
+
private closed;
|
|
56
|
+
private readonly mode;
|
|
57
|
+
constructor(binding: FastdbCallDbBinding, storage: ORM | ObjectGraphLoadContext);
|
|
58
|
+
materialize(): unknown;
|
|
59
|
+
table(nameOrIndex: string | number): FastdbCallDbTableView;
|
|
60
|
+
feature(nameOrIndex: string | number): Feature;
|
|
61
|
+
array(nameOrIndex: string | number): FastdbCallDbArrayView;
|
|
62
|
+
scalar(nameOrIndex: string | number): unknown;
|
|
63
|
+
close(): void;
|
|
64
|
+
ensureOpen(): void;
|
|
65
|
+
tableLength(spec: FastdbCallDbTable): number;
|
|
66
|
+
tableFeature(spec: FastdbCallDbTable, index: number): Feature;
|
|
67
|
+
arrayValue(spec: FastdbCallDbTable, index: number): unknown;
|
|
68
|
+
tableColumn(spec: FastdbCallDbTable, fieldName: string): FastdbCallDbColumnSource | undefined;
|
|
69
|
+
private tableFor;
|
|
70
|
+
private objectGraphLayerIndex;
|
|
71
|
+
private orm;
|
|
72
|
+
private objectGraphContext;
|
|
73
|
+
private resolveTable;
|
|
74
|
+
private resolveScalarField;
|
|
75
|
+
}
|
|
76
|
+
type FastdbCallDbColumnArray = ReturnType<StridedColumn['toArray']> | unknown[];
|
|
77
|
+
interface FastdbCallDbColumnSource {
|
|
78
|
+
readonly length: number;
|
|
79
|
+
get(index: number): unknown;
|
|
80
|
+
toArray(): FastdbCallDbColumnArray;
|
|
81
|
+
forEach(fn: (value: unknown, index: number) => void): void;
|
|
82
|
+
}
|
|
83
|
+
export declare class FastdbCallDbTableView {
|
|
84
|
+
private readonly view;
|
|
85
|
+
private readonly spec;
|
|
86
|
+
private columnAccessor;
|
|
87
|
+
constructor(view: FastdbCallDbView, spec: FastdbCallDbTable);
|
|
88
|
+
get length(): number;
|
|
89
|
+
get column(): Record<string, FastdbCallDbColumnView>;
|
|
90
|
+
get(index: number): Feature;
|
|
91
|
+
[Symbol.iterator](): Iterator<Feature>;
|
|
92
|
+
}
|
|
93
|
+
export declare class FastdbCallDbArrayView {
|
|
94
|
+
private readonly view;
|
|
95
|
+
private readonly spec;
|
|
96
|
+
constructor(view: FastdbCallDbView, spec: FastdbCallDbTable);
|
|
97
|
+
get length(): number;
|
|
98
|
+
get(index: number): unknown;
|
|
99
|
+
toArray(): unknown[];
|
|
100
|
+
[Symbol.iterator](): Iterator<unknown>;
|
|
101
|
+
}
|
|
102
|
+
export declare class FastdbCallDbColumnView {
|
|
103
|
+
private readonly view;
|
|
104
|
+
private readonly column;
|
|
105
|
+
constructor(view: FastdbCallDbView, column: FastdbCallDbColumnSource);
|
|
106
|
+
get length(): number;
|
|
107
|
+
get(index: number): unknown;
|
|
108
|
+
toArray(): FastdbCallDbColumnArray;
|
|
109
|
+
forEach(fn: (value: unknown, index: number) => void): void;
|
|
110
|
+
}
|
|
111
|
+
interface ObjectGraphLoadContext {
|
|
112
|
+
readonly db: WxDatabaseHandle;
|
|
113
|
+
readonly module: FastdbModule;
|
|
114
|
+
readonly typeByLayerName: ReadonlyMap<string, FeatureClass>;
|
|
115
|
+
readonly seen: Map<string, Feature>;
|
|
116
|
+
}
|
|
117
|
+
export {};
|